Author: manolo
Date: 2012-05-07 05:42:32 -0700 (Mon, 07 May 2012)
New Revision: 9454
Log:
Fixed use of widget-relative coordinates for image drawing.

Modified:
   branches/branch-3.0/src/fltk3/Device.cxx
   branches/branch-3.0/src/fltk3/Image.cxx
   branches/branch-3.0/src/fltk3/Pixmap.cxx
   branches/branch-3.0/src/fltk3/draw_pixmap.cxx
   branches/branch-3.0/src/fltk3/rect.cxx
   branches/branch-3.0/src/fltk3/vertex.cxx
   branches/branch-3.0/src/fltk3/x11_font.cxx
   branches/branch-3.0/src/fltk3/xft_font.cxx

Modified: branches/branch-3.0/src/fltk3/Device.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Device.cxx    2012-05-07 07:18:35 UTC (rev 
9453)
+++ branches/branch-3.0/src/fltk3/Device.cxx    2012-05-07 12:42:32 UTC (rev 
9454)
@@ -58,6 +58,8 @@
   font_descriptor_ = NULL;
   p_size = 0;
   n = 0;
+  o.x = o.y = 0;
+  optr = 0;
 };
 
 void fltk3::GraphicsDriver::text_extents(const char*t, int n, int& dx, int& 
dy, int& w, int& h)

Modified: branches/branch-3.0/src/fltk3/Image.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Image.cxx     2012-05-07 07:18:35 UTC (rev 
9453)
+++ branches/branch-3.0/src/fltk3/Image.cxx     2012-05-07 12:42:32 UTC (rev 
9454)
@@ -582,7 +582,7 @@
       XSetClipOrigin(fl_display, fl_gc, X-cx, Y-cy);
     }
     
-    copy_offscreen(X, Y, W, H, img->id_, cx, cy);
+    copy_offscreen(X+origin_x(), Y+origin_y(), W, H, img->id_, cx, cy);
     
     if (img->mask_) {
       // put the old clip region back
@@ -591,7 +591,7 @@
     }
   } else {
     // Composite image with alpha manually each time...
-    alpha_blend(img, X, Y, W, H, cx, cy);
+    alpha_blend(img, X+origin_x(), Y+origin_y(), W, H, cx, cy);
   }
 }
 

Modified: branches/branch-3.0/src/fltk3/Pixmap.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Pixmap.cxx    2012-05-07 07:18:35 UTC (rev 
9453)
+++ branches/branch-3.0/src/fltk3/Pixmap.cxx    2012-05-07 12:42:32 UTC (rev 
9454)
@@ -144,7 +144,7 @@
 void fltk3::QuartzGraphicsDriver::draw(fltk3::Pixmap *pxm, int XP, int YP, int 
WP, int HP, int cx, int cy) {
   int X, Y, W, H;
   if (pxm->prepare(XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
-  copy_offscreen(X, Y, W, H, (fltk3::Offscreen)pxm->id_, cx, cy);
+  copy_offscreen(X+origin_x(), Y+origin_y(), W, H, (fltk3::Offscreen)pxm->id_, 
cx, cy);
 }
 
 #elif defined(WIN32)
@@ -204,9 +204,9 @@
     XSetClipMask(fl_display, fl_gc, pxm->mask_);
     int ox = X-cx; if (ox < 0) ox += pxm->w();
     int oy = Y-cy; if (oy < 0) oy += pxm->h();
-    XSetClipOrigin(fl_display, fl_gc, X-cx, Y-cy);
+    XSetClipOrigin(fl_display, fl_gc, X+origin_x()-cx, Y+origin_y()-cy);
   }
-  copy_offscreen(X, Y, W, H, pxm->id_, cx, cy);
+  copy_offscreen(X+origin_x(), Y+origin_y(), W, H, pxm->id_, cx, cy);
   if (pxm->mask_) {
     // put the old clip region back
     XSetClipOrigin(fl_display, fl_gc, 0, 0);

Modified: branches/branch-3.0/src/fltk3/draw_pixmap.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/draw_pixmap.cxx       2012-05-07 07:18:35 UTC 
(rev 9453)
+++ branches/branch-3.0/src/fltk3/draw_pixmap.cxx       2012-05-07 12:42:32 UTC 
(rev 9454)
@@ -357,7 +357,7 @@
       }
     }
     fltk3::RGBImage* rgb = new fltk3::RGBImage((uchar*)array, d.w, d.h, 4);
-    rgb->draw(x, y);
+    rgb->draw(x - origin_x(), y - origin_y());
     delete rgb;
     delete[] array;
     }

Modified: branches/branch-3.0/src/fltk3/rect.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/rect.cxx      2012-05-07 07:18:35 UTC (rev 
9453)
+++ branches/branch-3.0/src/fltk3/rect.cxx      2012-05-07 12:42:32 UTC (rev 
9454)
@@ -642,7 +642,7 @@
 // Missing X call: (is this the fastest way to init a 1-rectangle region?)
 // MSWindows equivalent exists, implemented inline in win32.h
 fltk3::Region XRectangleRegion(int x, int y, int w, int h) {
-  x += fltk3::origin_x(); y += fltk3::origin_y();
+  //x += fltk3::origin_x(); y += fltk3::origin_y();
   XRectangle R;
   clip_to_short(x, y, w, h);
   R.x = x; R.y = y; R.width = w; R.height = h;
@@ -846,10 +846,11 @@
 }
 #elif defined(WIN32)
 int fltk3::GDIGraphicsDriver::clip_box(int x, int y, int w, int h, int& X, 
int& Y, int& W, int& H){
-  x += origin_x(); y += origin_y();
   X = x; Y = y; W = w; H = h;
   fltk3::Region r = clip_region();
   if (!r) return 0;
+  x += origin_x(); y += origin_y();
+  X = x; Y = y;
   // The win32 API makes no distinction between partial and complete
   // intersection, so we have to check for partial intersection ourselves.
   // However, given that the regions may be composite, we have to do
@@ -882,8 +883,8 @@
 }
 #else
 int fltk3::XlibGraphicsDriver::clip_box(int x, int y, int w, int h, int& X, 
int& Y, int& W, int& H){
+  X = x; Y = y; W = w; H = h;
   x += origin_x(); y += origin_y();
-  X = x; Y = y; W = w; H = h;
   fltk3::Region r = clip_region();
   if (!r) return 0;
   switch (XRectInRegion(r, x, y, w, h)) {

Modified: branches/branch-3.0/src/fltk3/vertex.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/vertex.cxx    2012-05-07 07:18:35 UTC (rev 
9453)
+++ branches/branch-3.0/src/fltk3/vertex.cxx    2012-05-07 12:42:32 UTC (rev 
9454)
@@ -371,7 +371,7 @@
   double xt, yt;
   prepare_circle(x, y, r, llx, lly, w, h, xt, yt);
   (vertex_kind() == POLYGON ? XFillArc : XDrawArc)
-  (fl_display, fl_window, fl_gc, llx, lly, w, h, 0, 360*64);
+  (fl_display, fl_window, fl_gc, llx+origin_x(), lly+origin_y(), w, h, 0, 
360*64);
 }
 #endif
 //

Modified: branches/branch-3.0/src/fltk3/x11_font.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/x11_font.cxx  2012-05-07 07:18:35 UTC (rev 
9453)
+++ branches/branch-3.0/src/fltk3/x11_font.cxx  2012-05-07 12:42:32 UTC (rev 
9454)
@@ -323,7 +323,7 @@
     font_gc = fl_gc;
     XSetFont(fl_display, fl_gc, font_descriptor()->font->fid);
   }
-  if (fl_gc) XUtf8DrawString(fl_display, fl_window, font_descriptor()->font, 
fl_gc, x, y, c, n);
+  if (fl_gc) XUtf8DrawString(fl_display, fl_window, font_descriptor()->font, 
fl_gc, x+origin_x(), y+origin_y(), c, n);
 }
 
 void fltk3::XlibGraphicsDriver::draw(int angle, const char *str, int n, int x, 
int y) {

Modified: branches/branch-3.0/src/fltk3/xft_font.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/xft_font.cxx  2012-05-07 07:18:35 UTC (rev 
9453)
+++ branches/branch-3.0/src/fltk3/xft_font.cxx  2012-05-07 12:42:32 UTC (rev 
9454)
@@ -614,6 +614,8 @@
   color.color.alpha = 0xffff;
   
   const wchar_t *buffer = utf8reformat(str, n);
+  x += origin_x();
+  y += origin_y();
 #ifdef __CYGWIN__
   XftDrawString16(draw_, &color, font_descriptor()->font, x, y, (XftChar16 
*)buffer, n);
 #else

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

Reply via email to