ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/pango-render.c
(Generate patch)

Comparing deliantra/Deliantra-Client/pango-render.c (file contents):
Revision 1.2 by root, Tue Jul 4 23:44:23 2006 UTC vs.
Revision 1.3 by root, Tue Jul 4 23:56:34 2006 UTC

146} 146}
147 147
148typedef struct glyph_info { 148typedef struct glyph_info {
149 tc_area tex; 149 tc_area tex;
150 int left, top; 150 int left, top;
151 int generation;
151} glyph_info; 152} glyph_info;
152 153
153static void 154static void
154free_glyph_info (glyph_info *g) 155free_glyph_info (glyph_info *g)
155{ 156{
172 glyph = PANGO_GLYPH_UNKNOWN_FLAG; 173 glyph = PANGO_GLYPH_UNKNOWN_FLAG;
173 } 174 }
174 175
175 g = _pango_opengl_font_get_cache_glyph_data (font, glyph); 176 g = _pango_opengl_font_get_cache_glyph_data (font, glyph);
176 177
177 if (!g) 178 if (!g || g->generation != tc_generation)
178 { 179 {
179 Glyph bm; 180 Glyph bm;
180 font_render_glyph (&bm, font, glyph); 181 font_render_glyph (&bm, font, glyph);
181 182
183 if (g)
184 g->generation = tc_generation;
185 else
186 {
182 g = g_slice_new (glyph_info); 187 g = g_slice_new (glyph_info);
188
189 _pango_opengl_font_set_glyph_cache_destroy (font, (GDestroyNotify)free_glyph_info);
190 _pango_opengl_font_set_cache_glyph_data (font, glyph, g);
191 }
183 192
184 tc_get (&g->tex, bm.width, bm.height); 193 tc_get (&g->tex, bm.width, bm.height);
185 194
186 g->left = bm.left; 195 g->left = bm.left;
187 g->top = bm.top; 196 g->top = bm.top;
196 glPixelStorei (GL_UNPACK_ROW_LENGTH, bm.stride); 205 glPixelStorei (GL_UNPACK_ROW_LENGTH, bm.stride);
197 glPixelStorei (GL_UNPACK_ALIGNMENT, 1); 206 glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
198 glTexSubImage2D (GL_TEXTURE_2D, 0, g->tex.x, g->tex.y, bm.width, bm.height, GL_ALPHA, GL_UNSIGNED_BYTE, bm.bitmap); 207 glTexSubImage2D (GL_TEXTURE_2D, 0, g->tex.x, g->tex.y, bm.width, bm.height, GL_ALPHA, GL_UNSIGNED_BYTE, bm.bitmap);
199 glPixelStorei (GL_UNPACK_ROW_LENGTH, 0); 208 glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
200 glPixelStorei (GL_UNPACK_ALIGNMENT, 4); 209 glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
201
202 _pango_opengl_font_set_glyph_cache_destroy (font, (GDestroyNotify)free_glyph_info);
203 _pango_opengl_font_set_cache_glyph_data (font, glyph, g);
204 } 210 }
205 211
206 x += g->left; 212 x += g->left;
207 y -= g->top; 213 y -= g->top;
208 214

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines