[Scummvm-cvs-logs] SF.net SVN: scummvm:[50639] scummvm/trunk/gui/widget.cpp
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sun Jul 4 03:11:18 CEST 2010
Revision: 50639
http://scummvm.svn.sourceforge.net/scummvm/?rev=50639&view=rev
Author: lordhoto
Date: 2010-07-04 01:11:18 +0000 (Sun, 04 Jul 2010)
Log Message:
-----------
Center the surface of a GraphicsWidget in case it is smaller than the widget's size.
Modified Paths:
--------------
scummvm/trunk/gui/widget.cpp
Modified: scummvm/trunk/gui/widget.cpp
===================================================================
--- scummvm/trunk/gui/widget.cpp 2010-07-04 00:38:16 UTC (rev 50638)
+++ scummvm/trunk/gui/widget.cpp 2010-07-04 01:11:18 UTC (rev 50639)
@@ -596,7 +596,7 @@
_gfx.free();
_gfx.create(w, h, sizeof(OverlayColor));
- OverlayColor *dst = (OverlayColor*)_gfx.pixels;
+ OverlayColor *dst = (OverlayColor *)_gfx.pixels;
Graphics::PixelFormat overlayFormat = g_system->getOverlayFormat();
OverlayColor fillCol = overlayFormat.RGBToColor(r, g, b);
while (h--) {
@@ -607,8 +607,12 @@
}
void GraphicsWidget::drawWidget() {
- if (sizeof(OverlayColor) == _gfx.bytesPerPixel && _gfx.pixels)
- g_gui.theme()->drawSurface(Common::Rect(_x, _y, _x+_w, _y+_h), _gfx, _state, _alpha, _transparency);
+ if (sizeof(OverlayColor) == _gfx.bytesPerPixel && _gfx.pixels) {
+ 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 -
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list