summaryrefslogtreecommitdiff
path: root/src
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 /src
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 'src')
-rw-r--r--src/Fl_Double_Window.cxx28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx
index 03e0240b8..a09134879 100644
--- a/src/Fl_Double_Window.cxx
+++ b/src/Fl_Double_Window.cxx
@@ -65,8 +65,28 @@ void Fl_Double_Window::show() {
Fl_Window::show();
}
+static void fl_copy_offscreen_to_display(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
+
+void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) {
+ if( fl_graphics_driver == fl_display_device->driver()) {
+ fl_copy_offscreen_to_display(x, y, w, h, pixmap, srcx, srcy);
+ }
+ else { // when copy is not to the display
+ fl_begin_offscreen(pixmap);
+ uchar *img = fl_read_image(NULL, srcx, srcy, w, h, 0);
+ fl_end_offscreen();
+ fl_draw_image(img, x, y, w, h, 3, 0);
+ delete img;
+ }
+}
+
#if defined(USE_X11)
+static void fl_copy_offscreen_to_display(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) {
+ XCopyArea(fl_display, pixmap, fl_window, fl_gc, srcx, srcy, w, h, x, y);
+}
+
+
// maybe someone feels inclined to implement alpha blending on X11?
char fl_can_do_alpha_blending() {
return 0;
@@ -134,7 +154,7 @@ HDC fl_makeDC(HBITMAP bitmap) {
return new_gc;
}
-void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP bitmap,int srcx,int srcy) {
+static void fl_copy_offscreen_to_display(int x,int y,int w,int h,HBITMAP bitmap,int srcx,int srcy) {
HDC new_gc = CreateCompatibleDC(fl_gc);
int save = SaveDC(new_gc);
SelectObject(new_gc, bitmap);
@@ -195,7 +215,7 @@ static void bmProviderRelease (void *src, const void *data, size_t size)
if(count == 1) free((void*)data);
}
-void fl_copy_offscreen(int x,int y,int w,int h,Fl_Offscreen osrc,int srcx,int srcy) {
+static void fl_copy_offscreen_to_display(int x,int y,int w,int h,Fl_Offscreen osrc,int srcx,int srcy) {
CGContextRef src = (CGContextRef)osrc;
void *data = CGBitmapContextGetData(src);
int sw = CGBitmapContextGetWidth(src);
@@ -230,8 +250,11 @@ const int stack_max = 16;
static int stack_ix = 0;
static CGContextRef stack_gc[stack_max];
static Window stack_window[stack_max];
+static Fl_Surface_Device *_ss;
void fl_begin_offscreen(Fl_Offscreen ctx) {
+ _ss = fl_surface;
+ fl_display_device->set_current();
if (stack_ix<stack_max) {
stack_gc[stack_ix] = fl_gc;
stack_window[stack_ix] = fl_window;
@@ -256,6 +279,7 @@ void fl_end_offscreen() {
fl_gc = stack_gc[stack_ix];
fl_window = stack_window[stack_ix];
}
+ _ss->set_current();
}
extern void fl_restore_clip();