made 'checkBounds()' non-virtual and protected, using uInt32

This commit is contained in:
thrust26 2019-04-06 15:42:57 +02:00
parent 83c8b74800
commit 372ecf0608
2 changed files with 14 additions and 14 deletions

View File

@ -200,8 +200,8 @@ void FBSurface::drawChar(const GUI::Font& font, uInt8 chr,
bby = desc.bbx[chr].y;
}
int cx = tx + bbx;
int cy = ty + desc.ascent - bby - bbh;
uInt32 cx = tx + bbx;
uInt32 cy = ty + desc.ascent - bby - bbh;
if(!checkBounds(cx , cy) || !checkBounds(cx + bbw - 1, cy + bbh - 1))
return;
@ -361,9 +361,9 @@ void FBSurface::drawString(const GUI::Font& font, const string& s,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FBSurface::checkBounds(const int x, const int y) const
bool FBSurface::checkBounds(const uInt32 x, const uInt32 y) const
{
if (x >= 0 && x <= (int)width() && y >= 0 && y <= (int)height())
if (x <= width() && y <= height())
return true;
cerr << "FBSurface::checkBounds() failed: "

View File

@ -219,16 +219,6 @@ class FBSurface
ColorId color, TextAlign align = TextAlign::Left,
int deltax = 0, bool useEllipsis = true, ColorId shadowColor = kNone);
/**
This method should be called to check if the given coordinates are in
bounds of the surface.
@param x The x coordinate to check
@param y The y coordinate to check
@return True if coordinates are in bounds
*/
virtual bool checkBounds(const int x, const int y) const;
//////////////////////////////////////////////////////////////////////////
// Note: The following methods are FBSurface-specific, and must be
// implemented in child classes.
@ -342,6 +332,16 @@ class FBSurface
*/
virtual void setDirty() = 0;
/**
This method should be called to check if the given coordinates
are in bounds of the surface.
@param x The x coordinate to check
@param y The y coordinate to check
@return True if coordinates are in bounds
*/
bool checkBounds(const uInt32 x, const uInt32 y) const;
protected:
static const uInt32* myPalette;
uInt32* myPixels;