mirror of https://github.com/stella-emu/stella.git
When obtaining FBSurface bounding rects, use references instead of constantly
creating new instances of GUI::Rect. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2887 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
3a60412706
commit
e31274c753
|
@ -131,15 +131,17 @@ void FBSurfaceSDL2::setInterpolationAndBlending(
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
GUI::Rect FBSurfaceSDL2::srcRect()
|
||||
const GUI::Rect& FBSurfaceSDL2::srcRect()
|
||||
{
|
||||
return GUI::Rect(mySrcR.x, mySrcR.y, mySrcR.x+mySrcR.w, mySrcR.y+mySrcR.h);
|
||||
mySrcGUIR.setBounds(mySrcR.x, mySrcR.y, mySrcR.x+mySrcR.w, mySrcR.y+mySrcR.h);
|
||||
return mySrcGUIR;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
GUI::Rect FBSurfaceSDL2::dstRect()
|
||||
const GUI::Rect& FBSurfaceSDL2::dstRect()
|
||||
{
|
||||
return GUI::Rect(myDstR.x, myDstR.y, myDstR.x+myDstR.w, myDstR.y+myDstR.h);
|
||||
myDstGUIR.setBounds(myDstR.x, myDstR.y, myDstR.x+myDstR.w, myDstR.y+myDstR.h);
|
||||
return myDstGUIR;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -47,8 +47,8 @@ class FBSurfaceSDL2 : public FBSurface
|
|||
void setInterpolationAndBlending(bool smoothScale, bool useBlend,
|
||||
uInt32 blendAlpha);
|
||||
|
||||
GUI::Rect srcRect();
|
||||
GUI::Rect dstRect();
|
||||
const GUI::Rect& srcRect();
|
||||
const GUI::Rect& dstRect();
|
||||
void setSrcPos(uInt32 x, uInt32 y);
|
||||
void setSrcSize(uInt32 w, uInt32 h);
|
||||
void setDstPos(uInt32 x, uInt32 y);
|
||||
|
@ -76,6 +76,8 @@ class FBSurfaceSDL2 : public FBSurface
|
|||
|
||||
uInt32* myStaticData; // The data to use when the buffer contents are static
|
||||
uInt32 myStaticPitch; // The number of bytes in a row of static data
|
||||
|
||||
GUI::Rect mySrcGUIR, myDstGUIR;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -52,8 +52,8 @@ class FBSurfaceTIA : public FBSurface
|
|||
void setInterpolationAndBlending(bool smoothScale, bool useBlend,
|
||||
uInt32 blendAlpha) { }
|
||||
|
||||
GUI::Rect srcRect() { return GUI::Rect(); }
|
||||
GUI::Rect dstRect() { return GUI::Rect(); }
|
||||
const GUI::Rect& srcRect() { return GUI::Rect(); }
|
||||
const GUI::Rect& dstRect() { return GUI::Rect(); }
|
||||
///////////////////////////////////////////////////////
|
||||
void getPos(uInt32& x, uInt32& y) const;
|
||||
uInt32 getWidth() const { return myDstR.w; }
|
||||
|
|
|
@ -225,8 +225,8 @@ class FBSurface
|
|||
/**
|
||||
These methods answer the current dimensions of the specified surface.
|
||||
*/
|
||||
virtual GUI::Rect srcRect() = 0;
|
||||
virtual GUI::Rect dstRect() = 0;
|
||||
virtual const GUI::Rect& srcRect() = 0;
|
||||
virtual const GUI::Rect& dstRect() = 0;
|
||||
|
||||
/**
|
||||
These methods set the origin point and width/height for the
|
||||
|
|
|
@ -126,6 +126,13 @@ struct Rect
|
|||
void setHeight(int aHeight) { bottom = top + aHeight; }
|
||||
void setSize(const Size& size) { setWidth(size.w); setHeight(size.h); }
|
||||
|
||||
void setBounds(int x1, int y1, int x2, int y2) {
|
||||
top = y1;
|
||||
left = x1;
|
||||
bottom = y2;
|
||||
right = x2;
|
||||
}
|
||||
|
||||
/*
|
||||
@param x the horizontal position to check
|
||||
@param y the vertical position to check
|
||||
|
@ -206,7 +213,7 @@ struct Rect
|
|||
left = x;
|
||||
}
|
||||
|
||||
void moveTo(const Point & p) {
|
||||
void moveTo(const Point& p) {
|
||||
moveTo(p.x, p.y);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue