Fixed FltkViewBase::drawRectangle()
Hi Jorge, regarding the last change in fltkviewbase.cc: --- a/dw/fltkviewbase.ccSat Sep 06 19:51:25 2008 +0200 +++ b/dw/fltkviewbase.ccSun Sep 07 10:51:04 2008 +0200 @@ -384,7 +384,9 @@ setcolor(((FltkColor*)color)->colors[shading]); int x1 = translateCanvasXToViewX (x); int y1 = translateCanvasYToViewY (y); - ::fltk::Rectangle rect (x1, y1, width, height); + int x2 = translateCanvasXToViewX (x + width); + int y2 = translateCanvasYToViewY (y + height); + ::fltk::Rectangle rect (x1, y1, x2 - x1, y2 - y1); if (filled) fillrect (rect); else To me it looks like this change is only necessary, if translateCanvasXToViewX() would do some sort of scaling. Was there a real problem, or did you change it just for consistency? Cheers, Johannes
Johannes wrote:
Hi Jorge,
regarding the last change in fltkviewbase.cc:
--- a/dw/fltkviewbase.ccSat Sep 06 19:51:25 2008 +0200 +++ b/dw/fltkviewbase.ccSun Sep 07 10:51:04 2008 +0200 @@ -384,7 +384,9 @@ setcolor(((FltkColor*)color)->colors[shading]); int x1 = translateCanvasXToViewX (x); int y1 = translateCanvasYToViewY (y); - ::fltk::Rectangle rect (x1, y1, width, height); + int x2 = translateCanvasXToViewX (x + width); + int y2 = translateCanvasYToViewY (y + height); + ::fltk::Rectangle rect (x1, y1, x2 - x1, y2 - y1); if (filled) fillrect (rect); else
To me it looks like this change is only necessary, if translateCanvasXToViewX() would do some sort of scaling. Was there a real problem, or did you change it just for consistency?
Ah, that's what it was for -- fltkpreview has scaling, which I forgot about. (was fltkpreview intended to be hooked into something somewhere? I have mixed feelings about carrying around code that we don't have any particular plans to do anything with...)
participants (2)
-
corvid@lavabit.com
-
Johannes.Hofmann@gmx.de