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.15 by root, Sun Jan 13 08:31:45 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
196 tc_get (&g->tex, bm.width, bm.height); 193 g->generation = tc_generation;
197 194
198 g->left = bm.left; 195 g->left = bm.left;
199 g->top = bm.top; 196 g->top = bm.top;
200 197
198 tc_get (&g->tex, bm.width, bm.height);
199
200 if (bm.width && bm.height)
201 {
201 glBindTexture (GL_TEXTURE_2D, g->tex.name); 202 glBindTexture (GL_TEXTURE_2D, g->tex.name);
202 glPixelStorei (GL_UNPACK_ROW_LENGTH, bm.stride); 203 glPixelStorei (GL_UNPACK_ROW_LENGTH, bm.stride);
203 glPixelStorei (GL_UNPACK_ALIGNMENT, 1); 204 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); 205 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); 206 glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
206 glPixelStorei (GL_UNPACK_ALIGNMENT, 4); 207 glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
208 }
207 } 209 }
208 210
209 x += g->left; 211 x += g->left;
210 y -= g->top; 212 y -= g->top;
211 213
277 int x, int y, 279 int x, int y,
278 float r, float g, float b, float a, 280 float r, float g, float b, float a,
279 int flags) 281 int flags)
280{ 282{
281 pango_opengl_render_layout_subpixel ( 283 pango_opengl_render_layout_subpixel (
282 layout, rc, x * PANGO_SCALE, y * PANGO_SCALE, r, g, b, a, flags 284 layout, rc, x * PANGO_SCALE, y * PANGO_SCALE, r, g, b, a, flags
283 ); 285 );
284} 286}
285 287
286static void 288static void
287pango_opengl_renderer_init (PangoOpenGLRenderer *renderer) 289pango_opengl_renderer_init (PangoOpenGLRenderer *renderer)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines