diff --git a/FL/mac.H b/FL/mac.H index 8b24ce94e..5bf5db679 100644 --- a/FL/mac.H +++ b/FL/mac.H @@ -197,6 +197,7 @@ public: static void GLcontext_release(NSOpenGLContext*); static void GLcontext_makecurrent(NSOpenGLContext*); static void GL_cleardrawable(void); + static void gl_start(NSOpenGLContext*); void destroy(void); void map(void); void unmap(void); diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 62008f7cc..cd4060e78 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -2425,9 +2425,11 @@ static CGContextRef prepare_bitmap_for_layer(int w, int h ) { Fl_X::q_release_context(); through_drawRect = NO; window->clear_damage(); - CGImageRef cgimg = CGBitmapContextCreateImage(layer_gc); // requires 10.4 - layer.contents = (id)cgimg; - CGImageRelease(cgimg); + if (layer_gc) { + CGImageRef cgimg = CGBitmapContextCreateImage(layer_gc); // requires 10.4 + layer.contents = (id)cgimg; + CGImageRelease(cgimg); + } } } -(void)viewFrameDidChange @@ -4808,6 +4810,17 @@ void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset) this->print_widget(win, x_offset, y_offset + bt); // print the window inner part } +void Fl_X::gl_start(NSOpenGLContext *ctxt) { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 + if (views_use_CA) { + Fl_X::q_release_context(); + [(FLView*)[fl_window contentView] viewFrameDidChange]; + [(FLView*)[fl_window contentView] layer].contentsScale = 1.; + } +#endif + [ctxt update]; // supports window resizing +} + /* Returns the address of a Carbon function after dynamically loading the Carbon library if needed. Supports old Mac OS X versions that may use a couple of Carbon calls: diff --git a/src/gl_start.cxx b/src/gl_start.cxx index 7e2bee25c..49be7e0ca 100644 --- a/src/gl_start.cxx +++ b/src/gl_start.cxx @@ -68,7 +68,7 @@ void gl_start() { } fl_set_gl_context(Fl_Window::current(), context); #ifdef __APPLE__ - Fl_X::GLcontext_update(context); // supports window resizing + Fl_X::gl_start(context); #elif !defined(WIN32) glXWaitX(); #endif