Mac OS: when computing a texture, save/restore the global fl_gc variable.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10061 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2014-01-15 21:47:37 +00:00
parent fe1793f13b
commit 9c6eb8be29
1 changed files with 2 additions and 1 deletions

View File

@ -473,6 +473,7 @@ int gl_texture_fifo::compute_texture(const char* str, int n)
CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
void *base = calloc(4*fifo[current].width, fifo[current].height);
if (base == NULL) return -1;
CGContextRef save_gc = fl_gc;
fl_gc = CGBitmapContextCreate(base, fifo[current].width, fifo[current].height, 8, fifo[current].width*4, lut, kCGImageAlphaPremultipliedLast);
CGColorSpaceRelease(lut);
fl_graphics_driver->font_descriptor(gl_fontsize);
@ -488,7 +489,7 @@ int gl_texture_fifo::compute_texture(const char* str, int n)
glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA, fifo[current].width, fifo[current].height, 0, GL_RGBA, GL_UNSIGNED_BYTE, base);
glPopAttrib();
CGContextRelease(fl_gc);
fl_gc = NULL;
fl_gc = save_gc;
free(base);
fifo[current].fdesc = gl_fontsize;
return current;