diff options
| author | Manolo Gouy <Manolo> | 2018-04-26 09:05:20 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2018-04-26 09:05:20 +0000 |
| commit | 069ab1b54fe658fa9b692d6a1a438e21b54acfa2 (patch) | |
| tree | 8d90dc67f5b6472cb1d1f8487ac1adbd07639271 /src | |
| parent | 3ec2f9687760f6aa7358ab905f4a172dddd4db92 (diff) | |
Fix Fl_GDI_Graphics_Driver::copy_offscreen() when the destination surface is an Fl_Copy_Surface object.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12872 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx index 694fcc59d..962b9ada5 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx @@ -22,7 +22,7 @@ #include <FL/Fl.H> #include <FL/platform.H> #include <FL/fl_draw.H> - +#include <FL/Fl_Screen_Driver.H> /* * By linking this module, the following static method will instantiate the @@ -106,10 +106,18 @@ HDC fl_makeDC(HBITMAP bitmap) { } void Fl_GDI_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offscreen bitmap, int srcx, int srcy) { + x *= scale(); y *= scale(); w *= scale(); h *= scale(); srcx *= scale(); srcy *= scale(); + if (srcx < 0) {w += srcx; x -= srcx; srcx = 0;} + if (srcy < 0) {h += srcy; y -= srcy; srcy = 0;} + int off_width, off_height; + Fl::screen_driver()->offscreen_size(bitmap, off_width, off_height); + if (srcx + w >= off_width) {w = off_width - srcx;} + if (srcy + h >= off_height) {h = off_height - srcy;} + if (w <= 0 || h <= 0) return; HDC new_gc = CreateCompatibleDC(gc_); int save = SaveDC(new_gc); SelectObject(new_gc, bitmap); - BitBlt(gc_, x*scale(), y*scale(), w*scale(), h*scale(), new_gc, srcx*scale(), srcy*scale(), SRCCOPY); + BitBlt(gc_, x, y, w, h, new_gc, srcx, srcy, SRCCOPY); RestoreDC(new_gc, save); DeleteDC(new_gc); } |
