Code

remove no longer used methods (livarot to nartbpath ; font glyphs to nartbpath)
authorjohanengelen <johanengelen@users.sourceforge.net>
Sat, 12 Jul 2008 16:31:41 +0000 (16:31 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Sat, 12 Jul 2008 16:31:41 +0000 (16:31 +0000)
src/libnrtype/FontInstance.cpp
src/libnrtype/font-glyph.h
src/libnrtype/font-instance.h
src/livarot/Path.h
src/livarot/PathCutting.cpp

index 9504a97136177757f78c15a38fb12e9cff4efe15..5058e8e229b7428f06ff45b67849102cb4a7e722 100644 (file)
@@ -178,7 +178,6 @@ font_instance::~font_instance(void)
 
        for (int i=0;i<nbGlyph;i++) {
                if ( glyphs[i].outline ) delete glyphs[i].outline;
-               if ( glyphs[i].artbpath ) free(glyphs[i].artbpath);
         if ( glyphs[i].pathvector ) delete glyphs[i].pathvector;
        }
        if ( glyphs ) free(glyphs);
@@ -430,7 +429,6 @@ void font_instance::LoadGlyph(int glyph_id)
                }
                font_glyph  n_g;
                n_g.outline=NULL;
-               n_g.artbpath=NULL;
         n_g.pathvector=NULL;
                n_g.bbox[0]=n_g.bbox[1]=n_g.bbox[2]=n_g.bbox[3]=0;
                bool   doAdd=false;
@@ -558,7 +556,6 @@ void font_instance::LoadGlyph(int glyph_id)
                if ( doAdd ) {
                        if ( n_g.outline ) {
                                n_g.outline->FastBBox(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;
index 11e0206b5d437b543a7d54e823ab530afc9d9790..234502f9d5a0c4a07391c1266fed09ec9bd4fec7 100644 (file)
@@ -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)
 };
 
index 9fb33e47084d1134bcb5986a76d693a2106fffe8..e204f5df1ee2462382618562153d6be6935fff9e 100644 (file)
@@ -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);
index a7c3dec724dd41c9080e822f5662aafa55ccbe6a..4887883c8102a6064a7a2c8f19b78cbfcb5429ec 100644 (file)
@@ -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);
index 5aa77c1e54abe81bad613bffcf27e14723a871a6..99a8713b3feab5847c60f56eeaabbf1f9cd7b561 100644 (file)
@@ -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<path_lineto> 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;i<int(descr_cmd.size());i++) {
-    int const typ = descr_cmd[i]->getType();
-    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<PathDescrLineTo *>(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<PathDescrMoveTo *>(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<PathDescrArcTo *>(descr_cmd[i]);
-                               lastP=nData->p;
-      }
-        break;
-      case descr_cubicto:
-      {
-        PathDescrCubicTo *nData = dynamic_cast<PathDescrCubicTo *>(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<PathDescrBezierTo *>(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<PathDescrIntermBezierTo *>(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<PathDescrIntermBezierTo *>(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<PathDescrIntermBezierTo *>(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()
 {