MacOS Mojave: restore support of gl_start()/gl_finish().

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13107 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy
2018-11-01 21:01:41 +00:00
parent fa89042fac
commit 04e782d946
3 changed files with 18 additions and 4 deletions
+1
View File
@@ -197,6 +197,7 @@ public:
static void GLcontext_release(NSOpenGLContext*); static void GLcontext_release(NSOpenGLContext*);
static void GLcontext_makecurrent(NSOpenGLContext*); static void GLcontext_makecurrent(NSOpenGLContext*);
static void GL_cleardrawable(void); static void GL_cleardrawable(void);
static void gl_start(NSOpenGLContext*);
void destroy(void); void destroy(void);
void map(void); void map(void);
void unmap(void); void unmap(void);
+13
View File
@@ -2425,10 +2425,12 @@ static CGContextRef prepare_bitmap_for_layer(int w, int h ) {
Fl_X::q_release_context(); Fl_X::q_release_context();
through_drawRect = NO; through_drawRect = NO;
window->clear_damage(); window->clear_damage();
if (layer_gc) {
CGImageRef cgimg = CGBitmapContextCreateImage(layer_gc); // requires 10.4 CGImageRef cgimg = CGBitmapContextCreateImage(layer_gc); // requires 10.4
layer.contents = (id)cgimg; layer.contents = (id)cgimg;
CGImageRelease(cgimg); CGImageRelease(cgimg);
} }
}
} }
-(void)viewFrameDidChange -(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 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. /* 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: Supports old Mac OS X versions that may use a couple of Carbon calls:
+1 -1
View File
@@ -68,7 +68,7 @@ void gl_start() {
} }
fl_set_gl_context(Fl_Window::current(), context); fl_set_gl_context(Fl_Window::current(), context);
#ifdef __APPLE__ #ifdef __APPLE__
Fl_X::GLcontext_update(context); // supports window resizing Fl_X::gl_start(context);
#elif !defined(WIN32) #elif !defined(WIN32)
glXWaitX(); glXWaitX();
#endif #endif