diff options
author | corvid <corvid@lavabit.com> | 2010-03-11 17:39:28 +0000 |
---|---|---|
committer | corvid <corvid@lavabit.com> | 2010-03-11 17:39:28 +0000 |
commit | 910cb898f28aba06b3257332dbaebac6fb40984e (patch) | |
tree | d35f858b4e5b7db3ba65968daad08a2d3587fad5 | |
parent | 286bfdb1e392ed133642f2e60e6c993102bcbea9 (diff) |
drawArc() take coordinates of center
-rw-r--r-- | dw/bullet.cc | 2 | ||||
-rw-r--r-- | dw/fltkviewbase.cc | 8 | ||||
-rw-r--r-- | dw/fltkviewbase.hh | 2 | ||||
-rw-r--r-- | dw/types.cc | 6 | ||||
-rw-r--r-- | dw/view.hh | 2 |
5 files changed, 9 insertions, 11 deletions
diff --git a/dw/bullet.cc b/dw/bullet.cc index 2534e07c..af7f5451 100644 --- a/dw/bullet.cc +++ b/dw/bullet.cc @@ -57,7 +57,7 @@ void Bullet::draw (core::View *view, core::Rectangle *area) case core::style::LIST_STYLE_TYPE_DISC: default: view->drawArc (getStyle()->color, core::style::Color::SHADING_NORMAL, - filled, x, y, l, l, 0, 360); + filled, x + l/2, y + l/2, l, l, 0, 360); } } diff --git a/dw/fltkviewbase.cc b/dw/fltkviewbase.cc index 437c109a..7d519f05 100644 --- a/dw/fltkviewbase.cc +++ b/dw/fltkviewbase.cc @@ -401,13 +401,13 @@ void FltkViewBase::drawRectangle (core::style::Color *color, void FltkViewBase::drawArc (core::style::Color *color, core::style::Color::Shading shading, bool filled, - int x, int y, int width, int height, + int centerX, int centerY, int width, int height, int angle1, int angle2) { setcolor(((FltkColor*)color)->colors[shading]); - int x1 = translateCanvasXToViewX (x); - int y1 = translateCanvasYToViewY (y); - ::fltk::Rectangle rect (x1, y1, width, height); + int x = translateCanvasXToViewX (centerX) - width / 2; + int y = translateCanvasYToViewY (centerY) - height / 2; + ::fltk::Rectangle rect (x, y, width, height); addchord(rect, angle1, angle2); closepath(); if (filled) diff --git a/dw/fltkviewbase.hh b/dw/fltkviewbase.hh index ba4cc6d2..5e1981f8 100644 --- a/dw/fltkviewbase.hh +++ b/dw/fltkviewbase.hh @@ -77,7 +77,7 @@ public: int x, int y, int width, int height); void drawArc (core::style::Color *color, core::style::Color::Shading shading, bool filled, - int x, int y, int width, int height, + int centerX, int centerY, int width, int height, int angle1, int angle2); void drawPolygon (core::style::Color *color, core::style::Color::Shading shading, diff --git a/dw/types.cc b/dw/types.cc index 3bc78ded..672ec7f6 100644 --- a/dw/types.cc +++ b/dw/types.cc @@ -142,11 +142,9 @@ void Circle::draw (core::View *view, core::style::Style *style, int x, int y) { const bool filled = false; - /* drawArc() wants x, y, w, h for a rectangle, and then it draws the arc - * inside that */ view->drawArc(style->color, core::style::Color::SHADING_NORMAL, filled, - x + this->x - this->radius, y + this->y - this->radius, - 2 * this->radius, 2 * this->radius, 0, 360); + x + this->x, y + this->y, 2 * this->radius, 2 * this->radius, + 0, 360); } bool Circle::isPointWithin (int x, int y) @@ -171,7 +171,7 @@ public: int x, int y, int width, int height) = 0; virtual void drawArc (style::Color *color, style::Color::Shading shading, bool filled, - int x, int y, int width, int height, + int centerX, int centerY, int width, int height, int angle1, int angle2) = 0; virtual void drawPolygon (style::Color *color, style::Color::Shading shading, |