aboutsummaryrefslogtreecommitdiff
path: root/gui/ThemeNew.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2006-05-29 14:55:43 +0000
committerJohannes Schickel2006-05-29 14:55:43 +0000
commit1d72b954c7dd6e15a201ee680d8a5e895626dcd4 (patch)
treea179572a6eb5fe9c07755392bc74e2e9dfca908f /gui/ThemeNew.cpp
parentcba9ef32c21a8b40dbd638fd10796024bb7b6d87 (diff)
downloadscummvm-rg350-1d72b954c7dd6e15a201ee680d8a5e895626dcd4.tar.gz
scummvm-rg350-1d72b954c7dd6e15a201ee680d8a5e895626dcd4.tar.bz2
scummvm-rg350-1d72b954c7dd6e15a201ee680d8a5e895626dcd4.zip
Introduces special switch for GraphicsWidget for use of theme transparency again.
svn-id: r22746
Diffstat (limited to 'gui/ThemeNew.cpp')
-rw-r--r--gui/ThemeNew.cpp30
1 files changed, 27 insertions, 3 deletions
diff --git a/gui/ThemeNew.cpp b/gui/ThemeNew.cpp
index 724711ad26..bb05e477a7 100644
--- a/gui/ThemeNew.cpp
+++ b/gui/ThemeNew.cpp
@@ -43,7 +43,7 @@
#define kShadowTr4 128
#define kShadowTr5 192
-#define THEME_VERSION 13
+#define THEME_VERSION 14
using Graphics::Surface;
@@ -624,7 +624,7 @@ void ThemeNew::drawButton(const Common::Rect &r, const Common::String &str, kSta
addDirtyRect(r2);
}
-void ThemeNew::drawSurface(const Common::Rect &r, const Graphics::Surface &surface, kState state, int alpha) {
+void ThemeNew::drawSurface(const Common::Rect &r, const Graphics::Surface &surface, kState state, int alpha, bool themeTrans) {
if (!_initOk)
return;
@@ -639,7 +639,31 @@ void ThemeNew::drawSurface(const Common::Rect &r, const Graphics::Surface &surfa
if (alpha != 256)
restoreBackground(rect);
- drawSurface(rect, &surface, false, false, alpha);
+ if (themeTrans)
+ drawSurface(rect, &surface, false, false, alpha);
+ else {
+ OverlayColor *dst = (OverlayColor*)_screen.getBasePtr(rect.left, rect.top);
+ const OverlayColor *src = (OverlayColor*)surface.pixels;
+
+ int h = rect.height();
+ if (alpha == 256) {
+ while (h--) {
+ memcpy(dst, src, surface.pitch);
+ dst += _screen.w;
+ src += surface.w;
+ }
+ } else {
+ int w = rect.width();
+ while (h--) {
+ for (int i = 0; i < w; ++i) {
+ *dst = getColorAlpha(*src, *dst, alpha);
+ }
+ dst += _screen.w;
+ src += surface.w;
+ }
+ }
+ }
+
addDirtyRect(rect);
}