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.16 by root, Thu Nov 26 07:19:11 2009 UTC vs.
Revision 1.17 by root, Sun Nov 29 14:45:12 2009 UTC

159{ 159{
160 tc_put (&g->tex); 160 tc_put (&g->tex);
161 g_slice_free (glyph_info, g); 161 g_slice_free (glyph_info, g);
162} 162}
163 163
164static char *apple_nvidia_bug_buf; 164static int apple_nvidia_bug_workaround;
165 165
166static void 166static void
167apple_nvidia_bug (int enable) 167apple_nvidia_bug (int enable)
168{ 168{
169 g_slice_free1 (TC_WIDTH * TC_HEIGHT, apple_nvidia_bug_buf); 169 apple_nvidia_bug_workaround = enable;
170 apple_nvidia_bug_buf = enable ? g_slice_alloc (TC_WIDTH * TC_HEIGHT) : 0;
171} 170}
172 171
173static void 172static void
174tex_update (int name, int x, int y, int w, int stride, int h, void *bm) 173tex_update (int name, int x, int y, int w, int stride, int h, void *bm)
175{ 174{
176 glBindTexture (GL_TEXTURE_2D, name); 175 glBindTexture (GL_TEXTURE_2D, name);
177 176
178 if (!apple_nvidia_bug_buf) 177 if (!apple_nvidia_bug_workaround)
179 { 178 {
180 glPixelStorei (GL_UNPACK_ROW_LENGTH, stride); 179 glPixelStorei (GL_UNPACK_ROW_LENGTH, stride);
181 glPixelStorei (GL_UNPACK_ALIGNMENT, 1); 180 glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
182 glTexSubImage2D (GL_TEXTURE_2D, 0, x, y, w, h, GL_ALPHA, GL_UNSIGNED_BYTE, bm); 181 glTexSubImage2D (GL_TEXTURE_2D, 0, x, y, w, h, GL_ALPHA, GL_UNSIGNED_BYTE, bm);
183 glPixelStorei (GL_UNPACK_ROW_LENGTH, 0); 182 glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
188 /* starting with 10.5.5 (or 10.5.6), pple's nvidia driver corrupts textures */ 187 /* starting with 10.5.5 (or 10.5.6), pple's nvidia driver corrupts textures */
189 /* when glTexSubImage is used, so do it the horribly slow way, */ 188 /* when glTexSubImage is used, so do it the horribly slow way, */
190 /* reading/patching/uploading the full texture one each change */ 189 /* reading/patching/uploading the full texture one each change */
191 int r; 190 int r;
192 191
193 glGetTexImage (GL_TEXTURE_2D, 0, GL_ALPHA, GL_UNSIGNED_BYTE, apple_nvidia_bug_buf); 192 glGetTexImage (GL_TEXTURE_2D, 0, GL_ALPHA, GL_UNSIGNED_BYTE, tc_temptile);
194 193
195 for (r = 0; r < h; ++r) 194 for (r = 0; r < h; ++r)
196 memcpy ((char *)apple_nvidia_bug_buf + (y + r) * TC_WIDTH + x, (char *)bm + r * stride, w); 195 memcpy (tc_temptile + (y + r) * TC_WIDTH + x, (char *)bm + r * stride, w);
197 196
198 glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, TC_WIDTH, TC_HEIGHT, 0, GL_ALPHA, GL_UNSIGNED_BYTE, apple_nvidia_bug_buf); 197 glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, TC_WIDTH, TC_HEIGHT, 0, GL_ALPHA, GL_UNSIGNED_BYTE, tc_temptile);
199 } 198 }
200} 199}
201 200
202static void 201static void
203draw_glyph (PangoRenderer *renderer_, PangoFont *font, PangoGlyph glyph, double x, double y) 202draw_glyph (PangoRenderer *renderer_, PangoFont *font, PangoGlyph glyph, double x, double y)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines