~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include    "FTOutlineGlyph.h"
 
2
#include    "FTVectoriser.h"
 
3
 
 
4
 
 
5
FTOutlineGlyph::FTOutlineGlyph( 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
    size_t numContours = vectoriser.ContourCount();
 
18
    if ( ( numContours < 1) || ( vectoriser.PointCount() < 3))
 
19
    {
 
20
        return;
 
21
    }
 
22
 
 
23
    glList = glGenLists(1);
 
24
    glNewList( glList, GL_COMPILE);
 
25
        for( unsigned int c = 0; c < numContours; ++c)
 
26
        {
 
27
            const FTContour* contour = vectoriser.Contour(c);
 
28
            
 
29
            glBegin( GL_LINE_LOOP);
 
30
                for( unsigned int p = 0; p < contour->PointCount(); ++p)
 
31
                {
 
32
                    glVertex2f( contour->Point(p).x / 64.0f, contour->Point(p).y / 64.0f);
 
33
                }
 
34
            glEnd();
 
35
        }
 
36
    glEndList();
 
37
}
 
38
 
 
39
 
 
40
FTOutlineGlyph::~FTOutlineGlyph()
 
41
{
 
42
    glDeleteLists( glList, 1);
 
43
}
 
44
 
 
45
 
 
46
float FTOutlineGlyph::Render( const FTPoint& pen)
 
47
{
 
48
    if( glList)
 
49
    {
 
50
        glTranslatef( pen.x, pen.y, 0);
 
51
            glCallList( glList);
 
52
        glTranslatef( -pen.x, -pen.y, 0);
 
53
    }
 
54
    
 
55
    return advance;
 
56
}
 
57