mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 07:53:36 +00:00
Center the surface of a GraphicsWidget in case it is smaller than the widget's size.
svn-id: r50639
This commit is contained in:
parent
10e7581fe1
commit
acecfcaf69
@ -596,7 +596,7 @@ void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) {
|
|||||||
_gfx.free();
|
_gfx.free();
|
||||||
_gfx.create(w, h, sizeof(OverlayColor));
|
_gfx.create(w, h, sizeof(OverlayColor));
|
||||||
|
|
||||||
OverlayColor *dst = (OverlayColor*)_gfx.pixels;
|
OverlayColor *dst = (OverlayColor *)_gfx.pixels;
|
||||||
Graphics::PixelFormat overlayFormat = g_system->getOverlayFormat();
|
Graphics::PixelFormat overlayFormat = g_system->getOverlayFormat();
|
||||||
OverlayColor fillCol = overlayFormat.RGBToColor(r, g, b);
|
OverlayColor fillCol = overlayFormat.RGBToColor(r, g, b);
|
||||||
while (h--) {
|
while (h--) {
|
||||||
@ -607,8 +607,12 @@ void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsWidget::drawWidget() {
|
void GraphicsWidget::drawWidget() {
|
||||||
if (sizeof(OverlayColor) == _gfx.bytesPerPixel && _gfx.pixels)
|
if (sizeof(OverlayColor) == _gfx.bytesPerPixel && _gfx.pixels) {
|
||||||
g_gui.theme()->drawSurface(Common::Rect(_x, _y, _x+_w, _y+_h), _gfx, _state, _alpha, _transparency);
|
const int x = _x + (_w - _gfx.w) / 2;
|
||||||
|
const int y = _y + (_h - _gfx.h) / 2;
|
||||||
|
|
||||||
|
g_gui.theme()->drawSurface(Common::Rect(x, y, x + _gfx.w, y + _gfx.h), _gfx, _state, _alpha, _transparency);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
Loading…
x
Reference in New Issue
Block a user