aboutsummaryrefslogtreecommitdiff
path: root/gui/widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/widget.cpp')
-rw-r--r--gui/widget.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 61f4a0e249..d3c8d3402d 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -22,10 +22,12 @@
* $Id$
*/
-#include "common/util.h"
-#include "graphics/fontman.h"
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "common/rect.h"
+#include "common/textconsole.h"
+#include "graphics/pixelformat.h"
#include "gui/widget.h"
-#include "gui/dialog.h"
#include "gui/gui-manager.h"
#include "gui/ThemeEval.h"
@@ -345,7 +347,7 @@ void PicButtonWidget::setGfx(const Graphics::Surface *gfx) {
void PicButtonWidget::drawWidget() {
g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), "", _state, getFlags());
- if (sizeof(OverlayColor) == _gfx.bytesPerPixel && _gfx.pixels) {
+ if (sizeof(OverlayColor) == _gfx.format.bytesPerPixel && _gfx.pixels) {
const int x = _x + (_w - _gfx.w) / 2;
const int y = _y + (_h - _gfx.h) / 2;
@@ -573,11 +575,12 @@ void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) {
if (h == -1)
h = _h;
+ Graphics::PixelFormat overlayFormat = g_system->getOverlayFormat();
+
_gfx.free();
- _gfx.create(w, h, sizeof(OverlayColor));
+ _gfx.create(w, h, overlayFormat);
OverlayColor *dst = (OverlayColor *)_gfx.pixels;
- Graphics::PixelFormat overlayFormat = g_system->getOverlayFormat();
OverlayColor fillCol = overlayFormat.RGBToColor(r, g, b);
while (h--) {
for (int i = 0; i < w; ++i) {
@@ -587,7 +590,7 @@ void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) {
}
void GraphicsWidget::drawWidget() {
- if (sizeof(OverlayColor) == _gfx.bytesPerPixel && _gfx.pixels) {
+ if (sizeof(OverlayColor) == _gfx.format.bytesPerPixel && _gfx.pixels) {
const int x = _x + (_w - _gfx.w) / 2;
const int y = _y + (_h - _gfx.h) / 2;