From 0ea7755d28ee2a566b3a44b5d5870f26041d2bc5 Mon Sep 17 00:00:00 2001 From: DarkWyrm Date: Tue, 14 Sep 2004 22:20:16 +0000 Subject: [PATCH] Rearranged attachment protocols for Stroke/Fill Arc and Ellipse git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8952 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/View.cpp | 100 ++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 56 deletions(-) diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index 02f41e1a70..22c6159e0d 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -2323,17 +2323,10 @@ void BView::DrawString(const char* aString, int32 length, BPoint location, void BView::StrokeEllipse(BPoint center, float xRadius, float yRadius, pattern p) { - if (owner) + if(owner) { - check_lock(); - - if ( _is_new_pattern( fState->patt, p ) ) - SetPattern( p ); - - owner->fLink->StartMessage( AS_STROKE_ELLIPSE ); - owner->fLink->Attach( center ); - owner->fLink->Attach( xRadius ); - owner->fLink->Attach( yRadius ); + StrokeEllipse( BRect(center.x-xRadius, center.y-yRadius, center.x+xRadius, + center.y+yRadius), p ); } } @@ -2343,8 +2336,13 @@ void BView::StrokeEllipse(BRect r, pattern p) { if (owner) { - StrokeEllipse( r.LeftTop() + BPoint(r.Width()/2, r.Height()/2), - r.Width()/2, r.Height()/2, p ); + check_lock(); + + if ( _is_new_pattern( fState->patt, p ) ) + SetPattern( p ); + + owner->fLink->StartMessage( AS_STROKE_ELLIPSE ); + owner->fLink->Attach( r ); } } @@ -2353,17 +2351,10 @@ void BView::StrokeEllipse(BRect r, pattern p) void BView::FillEllipse(BPoint center, float xRadius, float yRadius, pattern p) { - if (owner) + if(owner) { - check_lock(); - - if ( _is_new_pattern( fState->patt, p ) ) - SetPattern( p ); - - owner->fLink->StartMessage( AS_FILL_ELLIPSE ); - owner->fLink->Attach( center ); - owner->fLink->Attach( xRadius ); - owner->fLink->Attach( yRadius ); + FillEllipse( BRect(center.x-xRadius, center.y-yRadius, center.x+xRadius, + center.y+yRadius), p ); } } @@ -2373,8 +2364,13 @@ void BView::FillEllipse(BRect r, pattern p) { if (owner) { - FillEllipse(r.LeftTop() + BPoint(r.Width()/2, r.Height()/2), - r.Width()/2, r.Height()/2, p ); + check_lock(); + + if ( _is_new_pattern( fState->patt, p ) ) + SetPattern( p ); + + owner->fLink->StartMessage( AS_FILL_ELLIPSE ); + owner->fLink->Attach( r ); } } @@ -2383,20 +2379,8 @@ void BView::FillEllipse(BRect r, pattern p) void BView::StrokeArc(BPoint center, float xRadius, float yRadius, float start_angle, float arc_angle, pattern p) { - if (owner) - { - check_lock(); - - if ( _is_new_pattern( fState->patt, p ) ) - SetPattern( p ); - - owner->fLink->StartMessage( AS_STROKE_ARC ); - owner->fLink->Attach( center ); - owner->fLink->Attach( xRadius ); - owner->fLink->Attach( yRadius ); - owner->fLink->Attach( start_angle ); - owner->fLink->Attach( arc_angle ); - } + StrokeArc( BRect(center.x-xRadius, center.y-yRadius, center.x+xRadius, + center.y+yRadius), start_angle, arc_angle, p ); } //--------------------------------------------------------------------------- @@ -2406,9 +2390,17 @@ void BView::StrokeArc(BRect r, float start_angle, float arc_angle, { if (owner) { - StrokeArc( r.LeftTop() + BPoint(r.Width()/2, r.Height()/2), - r.Width()/2, r.Height()/2, start_angle, arc_angle, p ); + check_lock(); + + if ( _is_new_pattern( fState->patt, p ) ) + SetPattern( p ); + + owner->fLink->StartMessage( AS_STROKE_ARC ); + owner->fLink->Attach(r); + owner->fLink->Attach( start_angle ); + owner->fLink->Attach( arc_angle ); } + } //--------------------------------------------------------------------------- @@ -2416,20 +2408,8 @@ void BView::StrokeArc(BRect r, float start_angle, float arc_angle, void BView::FillArc(BPoint center,float xRadius, float yRadius, float start_angle, float arc_angle, pattern p) { - if (owner) - { - check_lock(); - - if ( _is_new_pattern( fState->patt, p ) ) - SetPattern( p ); - - owner->fLink->StartMessage( AS_FILL_ARC ); - owner->fLink->Attach( center ); - owner->fLink->Attach( xRadius ); - owner->fLink->Attach( yRadius ); - owner->fLink->Attach( start_angle ); - owner->fLink->Attach( arc_angle ); - } + FillArc( BRect(center.x-xRadius, center.y-yRadius, center.x+xRadius, + center.y+yRadius), start_angle, arc_angle, p ); } //--------------------------------------------------------------------------- @@ -2439,9 +2419,17 @@ void BView::FillArc(BRect r, float start_angle, float arc_angle, { if (owner) { - FillArc(r.LeftTop() + BPoint(r.Width()/2, r.Height()/2), - r.Width()/2, r.Height()/2,start_angle, arc_angle, p ); + check_lock(); + + if ( _is_new_pattern( fState->patt, p ) ) + SetPattern( p ); + + owner->fLink->StartMessage( AS_FILL_ARC ); + owner->fLink->Attach(r); + owner->fLink->Attach( start_angle ); + owner->fLink->Attach( arc_angle ); } + } //---------------------------------------------------------------------------