Commit 20bae25df240c1bd5bfb6511827dafe9fe58185f

henry 2001-08-01T22:58:44

Removed the <vector> include and some debug code. Changed the render code to use glDisplayList. There was NO performance improvement but it will make it the same as FTPolyGlyph. Now uses glTranslate for the pen pos, again to make it the same as FTPolyGlyph. Changes because of the changes tp FTPOINT in FTVectoriser.

diff --git a/src/FTVectorGlyph.cpp b/src/FTVectorGlyph.cpp
index abfdd2e..3de78a4 100755
--- a/src/FTVectorGlyph.cpp
+++ b/src/FTVectorGlyph.cpp
@@ -30,13 +30,33 @@ FTVectorGlyph::FTVectorGlyph( FT_Glyph glyph, int gi)
 			}
 			
 			numPoints = vectoriser->points();
-			data = new float[ numPoints * 2];
+			data = new float[ numPoints * 3];
 			vectoriser->Output( data);
 			
 			advance = glyph->advance.x >> 16; // this is 6 in the freetype docs!!!!!!
 		}
 	
 		delete vectoriser;
+		
+	    if ( ( numContours < 1) || ( numPoints < 1))
+			return;
+			
+ 		glList = glGenLists(1);
+ 		int d = 0;
+ 
+ 		glNewList( glList, GL_COMPILE);
+ 			for( int c = 0; c < numContours; ++c)
+ 			{
+ 				glBegin( GL_LINE_LOOP);
+ 				for( int p = 0; p < ( contourLength[c]); ++p)
+ 				{
+ 					glVertex2f( data[d], data[d + 1]);
+ 					d += 3;
+ 				}
+ 				glEnd();
+ 			}
+ 		glEndList();
+	
 	}
 }
 
@@ -49,35 +69,9 @@ FTVectorGlyph::~FTVectorGlyph()
 
 float FTVectorGlyph::Render( FT_Vector& pen)
 {
-	int d = 0;
-	
-	for( int c = 0; c < numContours; ++c)
-	{
-//		switch(c)
-//		{
-//			case 0:
-//				glColor3f( 1.0, 0.0, 0.0);
-//				break;
-//			case 1:
-//				glColor3f( 0.0, 1.0, 0.0);
-//				break;
-//			case 2:
-//				glColor3f( 0.0, 0.0, 1.0);
-//				break;
-//			case 3:
-//				glColor3f( 1.0, 1.0, 0.0);
-//				break;
-//		}
-		
-		glBegin( GL_LINE_LOOP);
-			for( int p = 0; p < ( contourLength[c] * 2); p += 2)
-			{
-				glVertex2f( data[d] + pen.x, data[d + 1] + pen.y);
-				
-				d += 2;
-			}
-		glEnd();
-	}
+	glTranslatef( pen.x, pen.y, 0);
+		glCallList( glList);
+	glTranslatef( -pen.x, -pen.y, 0);
 	
 	return advance;
 }
diff --git a/src/FTVectorGlyph.h b/src/FTVectorGlyph.h
index 8cc440d..381f957 100755
--- a/src/FTVectorGlyph.h
+++ b/src/FTVectorGlyph.h
@@ -1,8 +1,6 @@
 #ifndef		__FTVectorGlyph__
 #define		__FTVectorGlyph__
 
-#include <vector>
-
 #include <ft2build.h>
 #include FT_FREETYPE_H
 #include FT_GLYPH_H
@@ -30,6 +28,7 @@ class	FTVectorGlyph : public FTGlyph
 		int numContours;
 		int * contourLength;
 		float* data;
+		int glList;
 	
 };