From 2329a00873e2cea79dae2ffe1839501e05b39fe4 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 17 Apr 2011 16:34:58 +0200 Subject: GUI: Prefer Surface::create taking a PixelFormat over the one taking a byte depth. --- gui/widget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gui/widget.cpp') diff --git a/gui/widget.cpp b/gui/widget.cpp index 61f4a0e249..7a694860d6 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -573,11 +573,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) { -- cgit v1.2.3 From 41586398abb45c6e0551da729471c4215299d131 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 17 Apr 2011 17:30:29 +0200 Subject: GUI: Do not access Surface::bytesPerPixel anymore. --- gui/widget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gui/widget.cpp') diff --git a/gui/widget.cpp b/gui/widget.cpp index 7a694860d6..b7a10b17d7 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -345,7 +345,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; @@ -588,7 +588,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; -- cgit v1.2.3 From 9414d7a6e287ff8abfb5746b564e92c8f0e6de58 Mon Sep 17 00:00:00 2001 From: Ori Avtalion Date: Sun, 24 Apr 2011 11:34:27 +0300 Subject: JANITORIAL: Reduce header dependencies in shared code Some backends may break as I only compiled SDL --- gui/widget.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gui/widget.cpp') diff --git a/gui/widget.cpp b/gui/widget.cpp index 61f4a0e249..f0e91718eb 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" -- cgit v1.2.3