diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2019-06-06 18:28:49 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2019-06-06 18:28:49 +0200 |
| commit | 94fffb701ce88adf7398fb37a007a04c08f1ca6f (patch) | |
| tree | 39c02278fa18939ebf7d5df8e1459e5297c086ea /src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx | |
| parent | 50b1c0878085b5f231616d78f1f1775874b1c9ae (diff) | |
Add one argument to Fl_Screen_Driver::read_win_rectangle()
The new argument gives the window to be captured, or NULL to indicate capture
from the current offscreen.
Calling this function becomes easier because less dependent on global variables.
Diffstat (limited to 'src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx')
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx index 147933446..f390a4f50 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx @@ -501,7 +501,8 @@ Fl_WinAPI_Screen_Driver::read_win_rectangle( int X, // I - Left position int Y, // I - Top position int w, // I - Width of area to read - int h) // I - Height of area to read + int h, // I - Height of area to read + Fl_Window *win) // I - window to capture from or NULL to capture from current offscreen { float s = Fl_Surface_Device::surface()->driver()->scale(); int ws, hs; @@ -512,10 +513,10 @@ Fl_WinAPI_Screen_Driver::read_win_rectangle( if (ws < 1) ws = 1; if (hs < 1) hs = 1; } - return read_win_rectangle_unscaled(X*s, Y*s, ws, hs); + return read_win_rectangle_unscaled(X*s, Y*s, ws, hs, win); } -Fl_RGB_Image *Fl_WinAPI_Screen_Driver::read_win_rectangle_unscaled(int X, int Y, int w, int h) +Fl_RGB_Image *Fl_WinAPI_Screen_Driver::read_win_rectangle_unscaled(int X, int Y, int w, int h, Fl_Window *win) { int d = 3; // Depth of image int alpha = 0; uchar *p = NULL; @@ -569,6 +570,7 @@ Fl_RGB_Image *Fl_WinAPI_Screen_Driver::read_win_rectangle_unscaled(int X, int Y, bi.bmiHeader.biClrImportant = 0; // copy bitmap from original DC (Window, Fl_Offscreen, ...) + if (win && Fl_Window::current() != win) win->make_current(); HDC gc = (HDC)fl_graphics_driver->gc(); HDC hdc = CreateCompatibleDC(gc); HBITMAP hbm = CreateCompatibleBitmap(gc,w,h); |
