[Scummvm-git-logs] scummvm master -> 3990eb22771da74ce0e65d1fbe40fb69dda0bb64
dreammaster
dreammaster at scummvm.org
Wed Nov 2 01:07:36 CET 2016
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
3990eb2277 TITANIC: Fix transparency handling for PET glyph selection
Commit: 3990eb22771da74ce0e65d1fbe40fb69dda0bb64
https://github.com/scummvm/scummvm/commit/3990eb22771da74ce0e65d1fbe40fb69dda0bb64
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-11-01T20:07:27-04:00
Commit Message:
TITANIC: Fix transparency handling for PET glyph selection
Changed paths:
engines/titanic/support/mouse_cursor.cpp
engines/titanic/support/transparency_surface.cpp
engines/titanic/support/transparency_surface.h
engines/titanic/support/video_surface.cpp
diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp
index e9381dd..6300f65 100644
--- a/engines/titanic/support/mouse_cursor.cpp
+++ b/engines/titanic/support/mouse_cursor.cpp
@@ -136,7 +136,7 @@ void CMouseCursor::setCursor(CursorId cursorId) {
Graphics::ManagedSurface surface(CURSOR_SIZE, CURSOR_SIZE, g_system->getScreenFormat());
const uint16 *srcP = srcSurface.getPixels();
- CTransparencySurface transSurface(&ce._transSurface->rawSurface(), TRANS_DEFAULT);
+ CTransparencySurface transSurface(&ce._transSurface->rawSurface(), TRANS_ALPHA0);
uint16 *destP = (uint16 *)surface.getPixels();
for (int y = 0; y < CURSOR_SIZE; ++y) {
diff --git a/engines/titanic/support/transparency_surface.cpp b/engines/titanic/support/transparency_surface.cpp
index eb3fc28..8b5cbec 100644
--- a/engines/titanic/support/transparency_surface.cpp
+++ b/engines/titanic/support/transparency_surface.cpp
@@ -66,8 +66,17 @@ int CTransparencySurface::moveX() {
}
uint CTransparencySurface::getPixel() const {
- const byte *pixelP = (const byte *)_surface->getBasePtr(_pos.x, _pos.y);
- return *pixelP;
+ byte pixel = *(const byte *)_surface->getBasePtr(_pos.x, _pos.y);
+ return pixel;
+}
+
+uint CTransparencySurface::getAlpha() const {
+ byte pixel = getPixel();
+ return _flag1 ? 0xFF - pixel : pixel;
+}
+
+bool CTransparencySurface::isPixelTransparent() {
+ return getAlpha() == 0xff;
}
} // End of namespace Titanic
diff --git a/engines/titanic/support/transparency_surface.h b/engines/titanic/support/transparency_surface.h
index 0391b6d..1b4587a 100644
--- a/engines/titanic/support/transparency_surface.h
+++ b/engines/titanic/support/transparency_surface.h
@@ -42,6 +42,11 @@ private:
bool _flag;
bool _flag1;
bool _flag2;
+private:
+ /**
+ * Returns a a pixel from the transparency surface
+ */
+ uint getPixel() const;
public:
/**
* Constructor
@@ -64,19 +69,14 @@ public:
int moveX();
/**
- * Returns a byte from the transparency surface
- */
- uint getPixel() const;
-
- /**
* Returns the alpha value for the pixel (0-31)
*/
- uint getAlpha() const { return 31 - (getPixel() >> 3); }
+ uint getAlpha() const;
/**
* Returns true if the pixel is completely transparent
*/
- bool isPixelTransparent() const { return getAlpha() == 31; }
+ bool isPixelTransparent();
};
} // End of namespace Titanic
diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp
index 2932328..5261037 100644
--- a/engines/titanic/support/video_surface.cpp
+++ b/engines/titanic/support/video_surface.cpp
@@ -246,9 +246,7 @@ void CVideoSurface::transBlitRect(const Rect &srcRect, const Rect &destRect, CVi
transSurface.setCol(srcRect.left);
for (int srcX = srcRect.left; srcX < srcRect.right; ++srcX) {
- if (!transSurface.isPixelTransparent()) {
- copyPixel(lineDestP, lineSrcP, transSurface.getAlpha(), srcSurface->format, isAlpha);
- }
+ copyPixel(lineDestP, lineSrcP, transSurface.getAlpha() >> 3, srcSurface->format, isAlpha);
++lineSrcP;
++lineDestP;
More information about the Scummvm-git-logs
mailing list