diff options
| author | Manolo Gouy <Manolo> | 2015-07-24 22:17:36 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2015-07-24 22:17:36 +0000 |
| commit | a3e48a4afd6e0749da300b4a1728dd79b4627b84 (patch) | |
| tree | d8e67bde9a33377ebb14a0dd98f035fdd675b211 /src/Fl_Double_Window.cxx | |
| parent | 80402f622c06196c0cc27fb2e0f0d2b9bf275796 (diff) | |
Use -(NSGraphicsContext*)[NSWindow graphicsContext] to obtain the adequate
graphics context to draw to a window. This requires Mac OS 10.4.
The advantage is that it is possible for a secondary thread to call
Fl_Window::make_current() without needing to create an autorelease pool.
We save the native graphics state, and also the state with origin at top.
Fl_X::q_release_context() restores the graphics state twice to return to
the native state. This allows to use a single graphics context for a single
window and a single thread.
Under 10.3, we have to create a new NSGraphicsContext when Fl_Window::make_current()
is called directly, so that secondary threads cannot call Fl_Window::make_current() without
having created an autorelease pool.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10816 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Double_Window.cxx')
| -rw-r--r-- | src/Fl_Double_Window.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx index 6f823d41e..83af44b62 100644 --- a/src/Fl_Double_Window.cxx +++ b/src/Fl_Double_Window.cxx @@ -361,8 +361,9 @@ void fl_begin_offscreen(Fl_Offscreen ctx) { /** Quit sending drawing commands to the current offscreen buffer. */ void fl_end_offscreen() { - Fl_X::q_release_context(); fl_pop_clip(); + CGContextRestoreGState(fl_gc); // matches CGContextSaveGState in fl_begin_offscreen() + CGContextFlush(fl_gc); if (stack_ix>0) stack_ix--; else |
