summaryrefslogtreecommitdiff
path: root/FL
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-07-09 17:31:33 +0000
committerManolo Gouy <Manolo>2010-07-09 17:31:33 +0000
commit8306c3d0b31d4e60a9ba9c4d0ca4ed6a32226de1 (patch)
tree03b7946071d9ded7cdc647da9a88b6414b3e9897 /FL
parent0ac2bc4d40209005b37931bc4541c2af777635fa (diff)
Fixed fl_XXX_offscreen functions when the current output goes to a printer or a PostScript device
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7671 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
-rw-r--r--FL/win32.H7
-rw-r--r--FL/x.H16
2 files changed, 15 insertions, 8 deletions
diff --git a/FL/win32.H b/FL/win32.H
index 8ad6ccf45..cd9233179 100644
--- a/FL/win32.H
+++ b/FL/win32.H
@@ -121,16 +121,19 @@ extern FL_EXPORT void fl_save_dc( HWND w, HDC dc);
// off-screen pixmaps: create, destroy, draw into, copy to window
typedef HBITMAP Fl_Offscreen;
-#define fl_create_offscreen(w, h) CreateCompatibleBitmap(fl_gc, w, h)
+#define fl_create_offscreen(w, h) \
+ CreateCompatibleBitmap( (fl_gc ? fl_gc : fl_GetDC(0) ) , w, h)
extern FL_EXPORT HDC fl_makeDC(HBITMAP);
# define fl_begin_offscreen(b) \
HDC _sgc=fl_gc; Window _sw=fl_window; \
+ Fl_Surface_Device *_ss = fl_surface; fl_display_device->set_current(); \
fl_gc=fl_makeDC(b); int _savedc = SaveDC(fl_gc); fl_window=(HWND)b; fl_push_no_clip()
# define fl_end_offscreen() \
- fl_pop_clip(); RestoreDC(fl_gc, _savedc); DeleteDC(fl_gc); fl_window=_sw; fl_gc = _sgc
+ fl_pop_clip(); RestoreDC(fl_gc, _savedc); DeleteDC(fl_gc); _ss->set_current(); fl_window=_sw; fl_gc = _sgc
+
FL_EXPORT void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy);
FL_EXPORT void fl_copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy);
diff --git a/FL/x.H b/FL/x.H
index 6c2bb07c7..81022cf15 100644
--- a/FL/x.H
+++ b/FL/x.H
@@ -110,16 +110,20 @@ extern FL_EXPORT ulong fl_event_time;
// off-screen pixmaps: create, destroy, draw into, copy to window:
typedef ulong Fl_Offscreen;
-#define fl_create_offscreen(w,h) \
- XCreatePixmap(fl_display, fl_window, w, h, fl_visual->depth)
+# define fl_create_offscreen(w,h) \
+ XCreatePixmap(fl_display, \
+ (fl_surface->type() == Fl_Display_Device::device_type ? \
+ fl_window : fl_xid(Fl::first_window()) ) , \
+ w, h, fl_visual->depth)
// begin/end are macros that save the old state in local variables:
# define fl_begin_offscreen(pixmap) \
- Window _sw=fl_window; fl_window=pixmap; fl_push_no_clip()
+ Window _sw=fl_window; fl_window=pixmap; \
+ Fl_Surface_Device *_ss = fl_surface; fl_display_device->set_current(); \
+ fl_push_no_clip()
# define fl_end_offscreen() \
- fl_pop_clip(); fl_window = _sw
+ fl_pop_clip(); fl_window = _sw; _ss->set_current()
-# define fl_copy_offscreen(x,y,w,h,pixmap,srcx,srcy) \
- XCopyArea(fl_display, pixmap, fl_window, fl_gc, srcx, srcy, w, h, x, y)
+extern void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
# define fl_delete_offscreen(pixmap) XFreePixmap(fl_display, pixmap)
// Bitmap masks