diff options
| author | Manolo Gouy <Manolo> | 2010-03-16 17:40:03 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2010-03-16 17:40:03 +0000 |
| commit | 664c2f4b4e9d6d6d46375cef455127e168fcf88b (patch) | |
| tree | b369a5459aff1b002b2e34a4784048d048ee330e /src | |
| parent | 7f001d1fb95273b59b5ccf6a6db5bd98a4ad802b (diff) | |
Fixed CGcontext stack error appearing under Mac OS X.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7278 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Gl_Printer.cxx | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/Fl_Gl_Printer.cxx b/src/Fl_Gl_Printer.cxx index 2e4f89378..233327913 100644 --- a/src/Fl_Gl_Printer.cxx +++ b/src/Fl_Gl_Printer.cxx @@ -9,10 +9,12 @@ #include "FL/fl_draw.H" #endif +#if defined(__APPLE__) static void imgProviderReleaseData (void *info, const void *data, size_t size) { free((void *)data); } +#endif void Fl_Gl_Printer::print_gl_window(Fl_Gl_Window *glw, int x, int y) { @@ -23,10 +25,11 @@ void Fl_Gl_Printer::print_gl_window(Fl_Gl_Window *glw, int x, int y) CGContextRef save_gc = fl_gc; const int bytesperpixel = 4; #else - _XGC *save_gc = fl_gc; // FIXME Linux/Unix + _XGC *save_gc = fl_gc; const int bytesperpixel = 3; #endif glw->redraw(); + fl_gc = NULL; Fl::check(); glw->make_current(); // select front buffer as our source for pixel data @@ -53,9 +56,7 @@ void Fl_Gl_Printer::print_gl_window(Fl_Gl_Window *glw, int x, int y) baseAddress); glPopClientAttrib(); fl_gc = save_gc; -#ifdef WIN32 - fl_draw_image(baseAddress + (glw->h() - 1) * mByteWidth, x, y , glw->w(), glw->h(), bytesperpixel, - mByteWidth); -#elif defined(__APPLE__) +#if defined(__APPLE__) #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4 #define kCGBitmapByteOrder32Big 0 #define CGBitmapInfo CGImageAlphaInfo @@ -69,9 +70,6 @@ void Fl_Gl_Printer::print_gl_window(Fl_Gl_Window *glw, int x, int y) kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Little /* XRGB Little Endian */ #endif , provider, NULL, false, kCGRenderingIntentDefault); - CGColorSpaceRelease(cSpace); - CGDataProviderRelease(provider); - if(image == NULL) return; CGContextSaveGState(fl_gc); int w, h; @@ -83,11 +81,11 @@ void Fl_Gl_Printer::print_gl_window(Fl_Gl_Window *glw, int x, int y) CGContextDrawImage(fl_gc, rect, image); Fl_X::q_end_image(); CGContextRestoreGState(fl_gc); - CFRelease(image); -#else // FIXME Linux/Unix + CGImageRelease(image); + CGColorSpaceRelease(cSpace); + CGDataProviderRelease(provider); +#else fl_draw_image(baseAddress + (glw->h() - 1) * mByteWidth, x, y , glw->w(), glw->h(), bytesperpixel, - mByteWidth); -#endif // WIN32 -#ifndef __APPLE__ free(baseAddress); -#endif +#endif // __APPLE__ } |
