simplify: only accept RectF

This commit is contained in:
Chris Danford
2004-09-22 02:20:50 +00:00
parent 6aaa517c62
commit 1ec8cbb208
4 changed files with 11 additions and 21 deletions
+5 -11
View File
@@ -409,11 +409,11 @@ void Actor::HurryTweening( float factor )
}
}
void Actor::ScaleTo( const RectI &rect, StretchType st )
void Actor::ScaleTo( const RectF &rect, StretchType st )
{
// width and height of rectangle
float rect_width = (float) rect.GetWidth();
float rect_height = (float) rect.GetHeight();
float rect_width = rect.GetWidth();
float rect_height = rect.GetHeight();
if( rect_width < 0 ) SetRotationY( 180 );
if( rect_height < 0 ) SetRotationX( 180 );
@@ -467,12 +467,6 @@ void Actor::SetEffectClock( CString s )
else ASSERT(0);
}
void Actor::StretchTo( const RectI &r )
{
RectF r2( (float)r.left, (float)r.top, (float)r.right, (float)r.bottom );
StretchTo( r2 );
}
void Actor::StretchTo( const RectF &r )
{
// width and height of rectangle
@@ -714,8 +708,8 @@ void Actor::HandleCommand( const ParsedCommand &command )
else if( sName=="effectdelay" ) SetEffectDelay( fParam(1) );
else if( sName=="effectclock" ) SetEffectClock( sParam(1) );
else if( sName=="effectmagnitude" ) SetEffectMagnitude( RageVector3(fParam(1),fParam(2),fParam(3)) );
else if( sName=="scaletocover" ) { RectI R(iParam(1), iParam(2), iParam(3), iParam(4)); ScaleToCover(R); }
else if( sName=="scaletofit" ) { RectI R(iParam(1), iParam(2), iParam(3), iParam(4)); ScaleToFitInside(R); }
else if( sName=="scaletocover" ) { RectF R(fParam(1), fParam(2), fParam(3), fParam(4)); ScaleToCover(R); }
else if( sName=="scaletofit" ) { RectF R(fParam(1), fParam(2), fParam(3), fParam(4)); ScaleToFitInside(R); }
// Commands that take effect immediately (ignoring the tweening queue):
else if( sName=="animate" ) EnableAnimation( bParam(1) );
else if( sName=="setstate" ) SetState( iParam(1) );
+3 -4
View File
@@ -198,11 +198,10 @@ public:
enum StretchType { fit_inside, cover };
void ScaleToCover( const RectI &rect ) { ScaleTo( rect, cover ); }
void ScaleToFitInside( const RectI &rect ) { ScaleTo( rect, fit_inside); };
void ScaleTo( const RectI &rect, StretchType st );
void ScaleToCover( const RectF &rect ) { ScaleTo( rect, cover ); }
void ScaleToFitInside( const RectF &rect ) { ScaleTo( rect, fit_inside); };
void ScaleTo( const RectF &rect, StretchType st );
void StretchTo( const RectI &rect );
void StretchTo( const RectF &rect );
+2 -2
View File
@@ -131,7 +131,7 @@ public:
void DrawStrip( float fRightEdgePercent )
{
RectI rect;
RectF rect;
const float fChamberWidthInPercent = 1.0f/NUM_CHAMBERS;
const float fStripWidthInPercent = 1.0f/NUM_STRIPS;
@@ -177,7 +177,7 @@ public:
void DrawMask( float fPercent )
{
RectI rect;
RectF rect;
int iChamber;
float fChamberOverflowPercent;
+1 -4
View File
@@ -781,10 +781,7 @@ void Sprite::ScaleToClipped( float fWidth, float fHeight )
Sprite::StopUsingCustomCoords();
// first find the correct zoom
Sprite::ScaleToCover( RectI(0, 0,
(int)fWidth,
(int)fHeight )
);
Sprite::ScaleToCover( RectF(0,0,fWidth,fHeight) );
// find which dimension is larger
bool bXDimNeedsToBeCropped = GetZoomedWidth() > fWidth+0.01;