diff options
Diffstat (limited to 'src/Fl_Double_Window.cxx')
| -rw-r--r-- | src/Fl_Double_Window.cxx | 106 |
1 files changed, 13 insertions, 93 deletions
diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx index 37bdd9e96..9264efc86 100644 --- a/src/Fl_Double_Window.cxx +++ b/src/Fl_Double_Window.cxx @@ -64,7 +64,13 @@ void Fl_Double_Window::show() { Fl_Window::show(); } -#ifdef WIN32 +#if defined(X11) + +// maybe someone feels inclined to implement alpha blending on X11? +char fl_can_do_alpha_blending() { + return 0; +} +#elif defined(WIN32) // Code used to switch output to an off-screen window. See macros in // win32.H which save the old state in local variables. @@ -154,83 +160,6 @@ void fl_copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP bitmap,int src extern void fl_restore_clip(); -#elif defined(__APPLE_QD__) - -char fl_can_do_alpha_blending() { - return 0; -} - -GWorldPtr fl_create_offscreen(int w, int h) { - GWorldPtr gw; - Rect bounds; - bounds.left=0; bounds.right=w; bounds.top=0; bounds.bottom=h; - QDErr err = NewGWorld(&gw, 0, &bounds, 0L, 0L, 0); // 'useTempMem' should not be used (says the Carbon port manual) - if ( err == -108 ) - { } -// fl_message( "The application memory is low. Please increase the initial memory assignment.\n" ); - if (err!=noErr || gw==0L) return 0L; - return gw; -} - -void fl_copy_offscreen(int x,int y,int w,int h,GWorldPtr gWorld,int srcx,int srcy) { - Rect src; - if ( !gWorld ) return; - src.top = srcy; src.left = srcx; src.bottom = srcy+h; src.right = srcx+w; - Rect dst; - GrafPtr dstPort; GetPort(&dstPort); - dst.top = y; dst.left = x; dst.bottom = y+h; dst.right = x+w; - RGBColor rgb, oldbg, oldfg; - GetForeColor(&oldfg); - GetBackColor(&oldbg); - rgb.red = 0xffff; rgb.green = 0xffff; rgb.blue = 0xffff; - RGBBackColor( &rgb ); - rgb.red = 0x0000; rgb.green = 0x0000; rgb.blue = 0x0000; - RGBForeColor( &rgb ); - CopyBits(GetPortBitMapForCopyBits(gWorld), GetPortBitMapForCopyBits(dstPort), &src, &dst, srcCopy, 0L); - RGBBackColor(&oldbg); - RGBForeColor(&oldfg); -} - -void fl_delete_offscreen(GWorldPtr gWorld) { - DisposeGWorld(gWorld); -} - -static GrafPtr prevPort; -static GDHandle prevGD; - -void fl_begin_offscreen(GWorldPtr gWorld) { - GetGWorld( &prevPort, &prevGD ); - if ( gWorld ) - { - SetGWorld( gWorld, 0 ); // sets the correct port - PixMapHandle pm = GetGWorldPixMap(gWorld); - Boolean ret = LockPixels(pm); - if ( ret == false ) - { - Rect rect; - GetPortBounds( gWorld, &rect ); - UpdateGWorld( &gWorld, 0, &rect, 0, 0, 0 ); - pm = GetGWorldPixMap( gWorld ); - LockPixels( pm ); - } - fl_window = 0; - } - fl_push_no_clip(); -} - -void fl_end_offscreen() { - GWorldPtr currPort; - GDHandle currGD; - GetGWorld( &currPort, &currGD ); - fl_pop_clip(); - PixMapHandle pm = GetGWorldPixMap(currPort); - UnlockPixels(pm); - SetGWorld( prevPort, prevGD ); - fl_window = GetWindowFromPort( prevPort ); -} - -extern void fl_restore_clip(); - #elif defined(__APPLE_QUARTZ__) char fl_can_do_alpha_blending() { @@ -318,13 +247,8 @@ void fl_end_offscreen() { extern void fl_restore_clip(); -#else // X11 - -// maybe someone feels inclined to implement alpha blending on X11? -char fl_can_do_alpha_blending() { - return 0; -} - +#else +# error unsupported platform #endif /** @@ -351,20 +275,16 @@ void Fl_Double_Window::flush(int eraseoverlay) { myi->backbuffer_bad = 1; } else #endif -#ifdef __APPLE_QD__ - if ( ( !QDIsPortBuffered( GetWindowPort(myi->xid) ) ) - || force_doublebuffering_ ) { - myi->other_xid = fl_create_offscreen(w(), h()); - clear_damage(FL_DAMAGE_ALL); - } +#if defined(USE_X11) || defined(WIN32) + myi->other_xid = fl_create_offscreen(w(), h()); + clear_damage(FL_DAMAGE_ALL); #elif defined(__APPLE_QUARTZ__) if (force_doublebuffering_) { myi->other_xid = fl_create_offscreen(w(), h()); clear_damage(FL_DAMAGE_ALL); } #else - myi->other_xid = fl_create_offscreen(w(), h()); - clear_damage(FL_DAMAGE_ALL); +# error unsupported platform #endif } #if USE_XDBE |
