Author: manolo
Date: 2011-04-17 01:48:40 -0700 (Sun, 17 Apr 2011)
New Revision: 8595
Log:
Fixed Fl_Paged_Device::print_window() that did not work under Windows seven.

Modified:
   branches/branch-1.3/src/Fl_win32.cxx
   branches/branch-1.3/src/fl_read_image_win32.cxx

Modified: branches/branch-1.3/src/Fl_win32.cxx
===================================================================
--- branches/branch-1.3/src/Fl_win32.cxx        2011-04-15 21:41:34 UTC (rev 
8594)
+++ branches/branch-1.3/src/Fl_win32.cxx        2011-04-17 08:48:40 UTC (rev 
8595)
@@ -1976,12 +1976,15 @@
   win->show();
   Fl::check();
   win->make_current();
+  HDC save_gc = fl_gc;
+  fl_gc = GetDC(NULL); // get the screen device context
   // capture the 4 window sides from screen
-  // use negative 4th argument to allow negative 2nd or 3rd arguments
-  uchar *top_image = fl_read_image(NULL, -bx, - bt - by, -ww, bt + by);
-  uchar *left_image = fl_read_image(NULL, -bx, - bt - by, -bx, wh);
-  uchar *right_image = fl_read_image(NULL, win->w(), - bt - by, -bx, wh);
-  uchar *bottom_image = fl_read_image(NULL, -bx, win->h(), -ww, by);
+  RECT r; GetWindowRect(fl_window, &r);
+  uchar *top_image = fl_read_image(NULL, r.left, r.top, ww, bt + by);
+  uchar *left_image = fl_read_image(NULL, r.left, r.top, bx, wh);
+  uchar *right_image = fl_read_image(NULL, r.right - bx, r.top, bx, wh);
+  uchar *bottom_image = fl_read_image(NULL, r.left, r.bottom-by, ww, by);
+  ReleaseDC(NULL, fl_gc); fl_gc = save_gc;
   this->set_current();
   // print the 4 window sides
   fl_draw_image(top_image, x_offset, y_offset, ww, bt + by, 3);

Modified: branches/branch-1.3/src/fl_read_image_win32.cxx
===================================================================
--- branches/branch-1.3/src/fl_read_image_win32.cxx     2011-04-15 21:41:34 UTC 
(rev 8594)
+++ branches/branch-1.3/src/fl_read_image_win32.cxx     2011-04-17 08:48:40 UTC 
(rev 8595)
@@ -34,13 +34,10 @@
               int   X,         // I - Left position
              int   Y,          // I - Top position
              int   w,          // I - Width of area to read
-                               //     negative w means negative X or Y are 
allowed
              int   h,          // I - Height of area to read
              int   alpha) {    // I - Alpha value for image (0 for none)
 
   int  d;                      // Depth of image
-  int allow_outside = w < 0;    // negative w allows negative X or Y, that is, 
window border
-  if (w < 0) w = - w;
 
   // Allocate the image data array as needed...
   d = alpha ? 4 : 3;
@@ -61,18 +58,16 @@
   int shift_x = 0; // X target shift if X modified
   int shift_y = 0; // Y target shift if X modified
 
-  if (!allow_outside) {
-    if (X < 0) {
-      shift_x = -X;
-      w += X;
-      X = 0;
-    }
-    if (Y < 0) {
-      shift_y = -Y;
-      h += Y;
-      Y = 0;
-    }
+  if (X < 0) {
+    shift_x = -X;
+    w += X;
+    X = 0;
   }
+  if (Y < 0) {
+    shift_y = -Y;
+    h += Y;
+    Y = 0;
+  }
 
   if (h < 1 || w < 1) return p;                // nothing to copy
 

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to