From 7e60d67377407c19215e313c09295abd9990b02d Mon Sep 17 00:00:00 2001 From: johanengelen Date: Sat, 12 Jul 2008 16:31:41 +0000 Subject: [PATCH] remove no longer used methods (livarot to nartbpath ; font glyphs to nartbpath) --- src/libnrtype/FontInstance.cpp | 20 ----- src/libnrtype/font-glyph.h | 1 - src/libnrtype/font-instance.h | 2 - src/livarot/Path.h | 1 - src/livarot/PathCutting.cpp | 148 --------------------------------- 5 files changed, 172 deletions(-) diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index 9504a9713..5058e8e22 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -178,7 +178,6 @@ font_instance::~font_instance(void) for (int i=0;iFastBBox(n_g.bbox[0],n_g.bbox[1],n_g.bbox[2],n_g.bbox[3]); - n_g.artbpath=n_g.outline->MakeArtBPath(); n_g.pathvector=n_g.outline->MakePathVector(); } glyphs[nbGlyph]=n_g; @@ -661,23 +658,6 @@ Path* font_instance::Outline(int glyph_id,Path* copyInto) return src_o; } -void* font_instance::ArtBPath(int glyph_id) -{ - int no=-1; - if ( id_to_no.find(glyph_id) == id_to_no.end() ) { - LoadGlyph(glyph_id); - if ( id_to_no.find(glyph_id) == id_to_no.end() ) { - // didn't load - } else { - no=id_to_no[glyph_id]; - } - } else { - no=id_to_no[glyph_id]; - } - if ( no < 0 ) return NULL; - return glyphs[no].artbpath; -} - Geom::PathVector* font_instance::PathVector(int glyph_id) { int no = -1; diff --git a/src/libnrtype/font-glyph.h b/src/libnrtype/font-glyph.h index 11e0206b5..234502f9d 100644 --- a/src/libnrtype/font-glyph.h +++ b/src/libnrtype/font-glyph.h @@ -12,7 +12,6 @@ struct font_glyph { double bbox[4]; // bbox of the path (and the artbpath), not the bbox of the glyph // as the fonts sometimes contain Path* outline; // outline as a livarot Path - void* artbpath; // outline as a artbpath, for text->curve stuff (should be unified with livarot) Geom::PathVector* pathvector; // outline as 2geom pathvector, for text->curve stuff (should be unified with livarot) }; diff --git a/src/libnrtype/font-instance.h b/src/libnrtype/font-instance.h index 9fb33e470..e204f5df1 100644 --- a/src/libnrtype/font-instance.h +++ b/src/libnrtype/font-instance.h @@ -70,8 +70,6 @@ public: Path* Outline(int glyph_id, Path *copyInto=NULL); // queries the outline of the glyph (in livarot Path form), and copies it into copyInto instead // of allocating a new Path if copyInto != NULL - void* ArtBPath(int glyph_id); - // returns the artbpath for this glyph. no refcounting needed, it's deallocated when the font_instance dies Geom::PathVector* PathVector(int glyph_id); // returns the 2geom-type pathvector for this glyph. no refcounting needed, it's deallocated when the font_instance dies double Advance(int glyph_id, bool vertical); diff --git a/src/livarot/Path.h b/src/livarot/Path.h index a7c3dec72..4887883c8 100644 --- a/src/livarot/Path.h +++ b/src/livarot/Path.h @@ -180,7 +180,6 @@ public: void LoadPath(Geom::Path const &path, Geom::Matrix const &tr, bool doTransformation, bool append = false); void LoadPathVector(Geom::PathVector const &pv, Geom::Matrix const &tr, bool doTransformation); void LoadPathVector(Geom::PathVector const &pv); - void* MakeArtBPath(); Geom::PathVector* MakePathVector(); void Transform(const NR::Matrix &trans); diff --git a/src/livarot/PathCutting.cpp b/src/livarot/PathCutting.cpp index 5aa77c1e5..99a8713b3 100644 --- a/src/livarot/PathCutting.cpp +++ b/src/livarot/PathCutting.cpp @@ -20,7 +20,6 @@ #include "Path.h" #include "style.h" #include "livarot/path-description.h" -#include "libnr/n-art-bpath.h" #include "libnr/nr-point-matrix-ops.h" #include "libnr/nr-convert2geom.h" #include <2geom/pathvector.h> @@ -263,153 +262,6 @@ void Path::DashSubPath(int spL, int spP, std::vector const &orig_pt } } -void* Path::MakeArtBPath(void) -{ - int nb_cmd=0,max_cmd=0; - NArtBpath* bpath=(NArtBpath*)g_malloc((max_cmd+1)*sizeof(NArtBpath)); - - NR::Point lastP,bezSt,bezEn,lastMP; - int lastM=-1,bezNb=0; - for (int i=0;igetType(); - switch ( typ ) { - case descr_close: - { - if ( lastM >= 0 ) { - bpath[lastM].code=NR_MOVETO; - if ( nb_cmd >= max_cmd ) { - max_cmd=2*nb_cmd+1; - bpath=(NArtBpath*)g_realloc(bpath,(max_cmd+1)*sizeof(NArtBpath)); - } - bpath[nb_cmd].code=NR_LINETO; - bpath[nb_cmd].x3=lastMP[0]; - bpath[nb_cmd].y3=lastMP[1]; - nb_cmd++; - } - lastM=-1; - } - break; - case descr_lineto: - { - PathDescrLineTo *nData = dynamic_cast(descr_cmd[i]); - if ( nb_cmd >= max_cmd ) { - max_cmd=2*nb_cmd+1; - bpath=(NArtBpath*)g_realloc(bpath,(max_cmd+1)*sizeof(NArtBpath)); - } - bpath[nb_cmd].code=NR_LINETO; - bpath[nb_cmd].x3=nData->p[0]; - bpath[nb_cmd].y3=nData->p[1]; - nb_cmd++; - lastP=nData->p; - } - break; - case descr_moveto: - { - PathDescrMoveTo *nData = dynamic_cast(descr_cmd[i]); - if ( nb_cmd >= max_cmd ) { - max_cmd=2*nb_cmd+1; - bpath=(NArtBpath*)g_realloc(bpath,(max_cmd+1)*sizeof(NArtBpath)); - } - bpath[nb_cmd].code=NR_MOVETO_OPEN; - bpath[nb_cmd].x3=nData->p[0]; - bpath[nb_cmd].y3=nData->p[1]; - lastM=nb_cmd; - nb_cmd++; - lastP=lastMP=nData->p; - } - break; - case descr_arcto: - { - PathDescrArcTo *nData = dynamic_cast(descr_cmd[i]); - lastP=nData->p; - } - break; - case descr_cubicto: - { - PathDescrCubicTo *nData = dynamic_cast(descr_cmd[i]); - if ( nb_cmd >= max_cmd ) { - max_cmd=2*nb_cmd+1; - bpath=(NArtBpath*)g_realloc(bpath,(max_cmd+1)*sizeof(NArtBpath)); - } - bpath[nb_cmd].code=NR_CURVETO; - bpath[nb_cmd].x1=lastP[0]+0.333333*nData->start[0]; - bpath[nb_cmd].y1=lastP[1]+0.333333*nData->start[1]; - bpath[nb_cmd].x2=nData->p[0]-0.333333*nData->end[0]; - bpath[nb_cmd].y2=nData->p[1]-0.333333*nData->end[1]; - bpath[nb_cmd].x3=nData->p[0]; - bpath[nb_cmd].y3=nData->p[1]; - nb_cmd++; - lastP=nData->p; - } - break; - case descr_bezierto: - { - PathDescrBezierTo *nData = dynamic_cast(descr_cmd[i]); - if ( nb_cmd >= max_cmd ) { - max_cmd=2*nb_cmd+1; - bpath=(NArtBpath*)g_realloc(bpath,(max_cmd+1)*sizeof(NArtBpath)); - } - if ( nData->nb <= 0 ) { - bpath[nb_cmd].code=NR_LINETO; - bpath[nb_cmd].x3=nData->p[0]; - bpath[nb_cmd].y3=nData->p[1]; - nb_cmd++; - bezNb=0; - } else if ( nData->nb == 1 ){ - PathDescrIntermBezierTo *iData = dynamic_cast(descr_cmd[i+1]); - bpath[nb_cmd].code=NR_CURVETO; - bpath[nb_cmd].x1=0.333333*(lastP[0]+2*iData->p[0]); - bpath[nb_cmd].y1=0.333333*(lastP[1]+2*iData->p[1]); - bpath[nb_cmd].x2=0.333333*(nData->p[0]+2*iData->p[0]); - bpath[nb_cmd].y2=0.333333*(nData->p[1]+2*iData->p[1]); - bpath[nb_cmd].x3=nData->p[0]; - bpath[nb_cmd].y3=nData->p[1]; - nb_cmd++; - bezNb=0; - } else { - bezSt=2*lastP-nData->p; - bezEn=nData->p; - bezNb=nData->nb; - } - lastP=nData->p; - } - break; - case descr_interm_bezier: - { - if ( bezNb > 0 ) { - PathDescrIntermBezierTo *nData = dynamic_cast(descr_cmd[i]); - NR::Point p_m=nData->p,p_s=0.5*(bezSt+p_m),p_e; - if ( bezNb > 1 ) { - PathDescrIntermBezierTo *iData = dynamic_cast(descr_cmd[i+1]); - p_e=0.5*(p_m+iData->p); - } else { - p_e=bezEn; - } - - if ( nb_cmd >= max_cmd ) { - max_cmd=2*nb_cmd+1; - bpath=(NArtBpath*)g_realloc(bpath,(max_cmd+1)*sizeof(NArtBpath)); - } - bpath[nb_cmd].code=NR_CURVETO; - NR::Point cp1=0.333333*(p_s+2*p_m),cp2=0.333333*(2*p_m+p_e); - bpath[nb_cmd].x1=cp1[0]; - bpath[nb_cmd].y1=cp1[1]; - bpath[nb_cmd].x2=cp2[0]; - bpath[nb_cmd].y2=cp2[1]; - bpath[nb_cmd].x3=p_e[0]; - bpath[nb_cmd].y3=p_e[1]; - nb_cmd++; - - bezNb--; - } - } - break; - } - } - bpath[nb_cmd].code=NR_END; - return bpath; -} - Geom::PathVector * Path::MakePathVector() { -- 2.30.2