… | |
… | |
180 | if (!g || g->generation != tc_generation) |
180 | if (!g || g->generation != tc_generation) |
181 | { |
181 | { |
182 | Glyph bm; |
182 | Glyph bm; |
183 | font_render_glyph (&bm, font, glyph); |
183 | font_render_glyph (&bm, font, glyph); |
184 | |
184 | |
185 | if (g) |
185 | if (!g) |
186 | g->generation = tc_generation; |
|
|
187 | else |
|
|
188 | { |
186 | { |
189 | g = g_slice_new (glyph_info); |
187 | g = g_slice_new (glyph_info); |
190 | |
188 | |
191 | _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); |
192 | _pango_opengl_font_set_cache_glyph_data (font, glyph, g); |
190 | _pango_opengl_font_set_cache_glyph_data (font, glyph, g); |
193 | } |
191 | } |
194 | |
192 | |
|
|
193 | g->generation = tc_generation; |
195 | tc_get (&g->tex, bm.width, bm.height); |
194 | tc_get (&g->tex, bm.width, bm.height); |
196 | |
195 | |
197 | g->left = bm.left; |
196 | g->left = bm.left; |
198 | g->top = bm.top; |
197 | g->top = bm.top; |
199 | |
198 | |
|
|
199 | if (bm.width && bm.height) |
|
|
200 | { |
200 | glBindTexture (GL_TEXTURE_2D, g->tex.name); |
201 | glBindTexture (GL_TEXTURE_2D, g->tex.name); |
201 | glPixelStorei (GL_UNPACK_ROW_LENGTH, bm.stride); |
202 | glPixelStorei (GL_UNPACK_ROW_LENGTH, bm.stride); |
202 | glPixelStorei (GL_UNPACK_ALIGNMENT, 1); |
203 | glPixelStorei (GL_UNPACK_ALIGNMENT, 1); |
203 | 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); |
204 | glPixelStorei (GL_UNPACK_ROW_LENGTH, 0); |
205 | glPixelStorei (GL_UNPACK_ROW_LENGTH, 0); |
205 | glPixelStorei (GL_UNPACK_ALIGNMENT, 4); |
206 | glPixelStorei (GL_UNPACK_ALIGNMENT, 4); |
|
|
207 | } |
206 | } |
208 | } |
207 | |
209 | |
208 | x += g->left; |
210 | x += g->left; |
209 | y -= g->top; |
211 | y -= g->top; |
210 | |
212 | |