Some updates to dialog positioning in preparation for HiDPI.

- note that these are fixes that are needed with or without HiDPI; testing HiDPI just exposed them as bugs
 - also fixed some minor warnings and formatting
This commit is contained in:
Stephen Anthony 2017-12-18 15:15:57 -03:30
parent 481c85c0c3
commit dd5a46880e
3 changed files with 16 additions and 15 deletions

View File

@ -122,8 +122,8 @@ void FBSurfaceSDL2::setVisible(bool visible)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceSDL2::translateCoords(Int32& x, Int32& y) const
{
x -= myDstR.x;
y -= myDstR.y;
x -= myDstR.x; x /= myDstR.w / mySrcR.w;
y -= myDstR.y; y /= myDstR.h / mySrcR.h;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -210,9 +210,10 @@ void FBSurfaceSDL2::createSurface(uInt32 width, uInt32 height,
// We start out with the src and dst rectangles containing the same
// dimensions, indicating no scaling or re-positioning
mySrcR.x = mySrcR.y = myDstR.x = myDstR.y = 0;
mySrcR.w = myDstR.w = width;
mySrcR.h = myDstR.h = height;
setSrcPos(0, 0);
setDstPos(0, 0);
setSrcSize(width, height);
setDstSize(width, height);
////////////////////////////////////////////////////
// These *must* be set for the parent class

View File

@ -85,9 +85,9 @@ class FBSurface
This method should be called to draw a line.
@param x The first x coordinate
@param y The y coordinate
@param y The first y coordinate
@param x2 The second x coordinate
@param xy The second y coordinate
@param y2 The second y coordinate
@param color The color of the line
*/
virtual void line(uInt32 x, uInt32 y, uInt32 x2, uInt32 y2, uInt32 color);
@ -149,14 +149,14 @@ class FBSurface
uInt32 h = 8);
/**
This method should be called to draw the bitmap image.
This method should be called to draw the bitmap image.
@param bitmap The data to draw
@param x The x coordinate
@param y The y coordinate
@param color The color of the bitmap
@param w The width of the data image
@param h The height of the data image
@param bitmap The data to draw
@param x The x coordinate
@param y The y coordinate
@param color The color of the bitmap
@param w The width of the data image
@param h The height of the data image
*/
virtual void drawBitmap(uInt32* bitmap, uInt32 x, uInt32 y, uInt32 color,
uInt32 w, uInt32 h);

View File

@ -116,7 +116,7 @@ void DialogContainer::draw(bool full)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DialogContainer::addDialog(Dialog* d)
{
GUI::Rect r = myOSystem.frameBuffer().imageRect();
const GUI::Rect& r = myOSystem.frameBuffer().imageRect();
if(uInt32(d->getWidth()) > r.width() || uInt32(d->getHeight()) > r.height())
myOSystem.frameBuffer().showMessage(
"Unable to show dialog box; resize current window");