~ubuntu-branches/ubuntu/intrepid/blender/intrepid-updates

« back to all changes in this revision

Viewing changes to extern/bFTGL/src/FTPolyGlyph.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Cyril Brulebois
  • Date: 2008-08-08 02:45:40 UTC
  • mfrom: (12.1.14 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080808024540-kkjp7ekfivzhuw3l
Tags: 2.46+dfsg-4
* Fix python syntax warning in import_dxf.py, which led to nasty output
  in installation/upgrade logs during byte-compilation, using a patch
  provided by the script author (Closes: #492280):
   - debian/patches/45_fix_python_syntax_warning

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "FTPolyGlyph.h"
2
 
#include "FTVectoriser.h"
3
 
 
4
 
 
5
 
FTPolyGlyph::FTPolyGlyph( FT_GlyphSlot glyph)
6
 
:   FTGlyph( glyph),
7
 
    glList(0)
8
 
{
9
 
    if( ft_glyph_format_outline != glyph->format)
10
 
    {
11
 
        err = 0x14; // Invalid_Outline
12
 
        return;
13
 
    }
14
 
 
15
 
    FTVectoriser vectoriser( glyph);
16
 
 
17
 
    if(( vectoriser.ContourCount() < 1) || ( vectoriser.PointCount() < 3))
18
 
    {
19
 
        return;
20
 
    }
21
 
 
22
 
    vectoriser.MakeMesh( 1.0);
23
 
    
24
 
    glList = glGenLists( 1);
25
 
    glNewList( glList, GL_COMPILE);
26
 
 
27
 
        const FTMesh* mesh = vectoriser.GetMesh();
28
 
        for( unsigned int index = 0; index < mesh->TesselationCount(); ++index)
29
 
        {
30
 
            const FTTesselation* subMesh = mesh->Tesselation( index);
31
 
            unsigned int polyonType = subMesh->PolygonType();
32
 
 
33
 
            glBegin( polyonType);
34
 
                for( unsigned int x = 0; x < subMesh->PointCount(); ++x)
35
 
                {
36
 
                    glVertex3f( subMesh->Point(x).x / 64.0f,
37
 
                                subMesh->Point(x).y / 64.0f,
38
 
                                0.0f);
39
 
                }
40
 
            glEnd();
41
 
        }
42
 
    glEndList();
43
 
}
44
 
 
45
 
 
46
 
FTPolyGlyph::~FTPolyGlyph()
47
 
{
48
 
    glDeleteLists( glList, 1);
49
 
}
50
 
 
51
 
 
52
 
float FTPolyGlyph::Render( const FTPoint& pen)
53
 
{
54
 
    if( glList)
55
 
    {
56
 
        glTranslatef(  pen.x,  pen.y, 0);
57
 
        glCallList( glList);    
58
 
        glTranslatef( -pen.x, -pen.y, 0);
59
 
    }
60
 
    
61
 
    return advance;
62
 
}