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.11 by root, Sun Aug 12 08:44:22 2007 UTC vs.
Revision 1.14 by root, Sun Jan 13 08:22:33 2008 UTC

164static void 164static void
165draw_glyph (PangoRenderer *renderer_, PangoFont *font, PangoGlyph glyph, double x, double y) 165draw_glyph (PangoRenderer *renderer_, PangoFont *font, PangoGlyph glyph, double x, double y)
166{ 166{
167 PangoOpenGLRenderer *renderer = PANGO_OPENGL_RENDERER (renderer_); 167 PangoOpenGLRenderer *renderer = PANGO_OPENGL_RENDERER (renderer_);
168 glyph_info *g; 168 glyph_info *g;
169 float x1, y1, x2, y2;
170 169
171 if (glyph & PANGO_GLYPH_UNKNOWN_FLAG) 170 if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
172 { 171 {
173 glyph = pango_opengl_get_unknown_glyph (font); 172 glyph = pango_opengl_get_unknown_glyph (font);
174 173
181 if (!g || g->generation != tc_generation) 180 if (!g || g->generation != tc_generation)
182 { 181 {
183 Glyph bm; 182 Glyph bm;
184 font_render_glyph (&bm, font, glyph); 183 font_render_glyph (&bm, font, glyph);
185 184
186 if (g) 185 if (!g)
187 g->generation = tc_generation;
188 else
189 { 186 {
190 g = g_slice_new (glyph_info); 187 g = g_slice_new (glyph_info);
191 188
192 _pango_opengl_font_set_glyph_cache_destroy (font, (GDestroyNotify)free_glyph_info); 189 _pango_opengl_font_set_glyph_cache_destroy (font, (GDestroyNotify)free_glyph_info);
193 _pango_opengl_font_set_cache_glyph_data (font, glyph, g); 190 _pango_opengl_font_set_cache_glyph_data (font, glyph, g);
194 } 191 }
195 192
193 g->generation = tc_generation;
196 tc_get (&g->tex, bm.width, bm.height); 194 tc_get (&g->tex, bm.width, bm.height);
197 195
198 g->left = bm.left; 196 g->left = bm.left;
199 g->top = bm.top; 197 g->top = bm.top;
200 198
199 if (bm.width && bm.height)
200 {
201 glBindTexture (GL_TEXTURE_2D, g->tex.name); 201 glBindTexture (GL_TEXTURE_2D, g->tex.name);
202 glPixelStorei (GL_UNPACK_ROW_LENGTH, bm.stride); 202 glPixelStorei (GL_UNPACK_ROW_LENGTH, bm.stride);
203 glPixelStorei (GL_UNPACK_ALIGNMENT, 1); 203 glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
204 glTexSubImage2D (GL_TEXTURE_2D, 0, g->tex.x, g->tex.y, bm.width, bm.height, GL_ALPHA, GL_UNSIGNED_BYTE, bm.bitmap); 204 glTexSubImage2D (GL_TEXTURE_2D, 0, g->tex.x, g->tex.y, bm.width, bm.height, GL_ALPHA, GL_UNSIGNED_BYTE, bm.bitmap);
205 glPixelStorei (GL_UNPACK_ROW_LENGTH, 0); 205 glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
206 glPixelStorei (GL_UNPACK_ALIGNMENT, 4); 206 glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
207 }
207 } 208 }
208 209
209 x += g->left; 210 x += g->left;
210 y -= g->top; 211 y -= g->top;
211 212

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines