diff options
author | Paul Gilbert | 2016-07-03 14:22:33 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:27:09 -0400 |
commit | 3f12927b77735c17eedfbe14f36607ddc6580c83 (patch) | |
tree | b559ab9fedc3a70ff8e3bad864dff01fa75ac4bd /engines/titanic/support | |
parent | 5ab33f117a0bc3451a1d30024208c45a2a548a4b (diff) | |
download | scummvm-rg350-3f12927b77735c17eedfbe14f36607ddc6580c83.tar.gz scummvm-rg350-3f12927b77735c17eedfbe14f36607ddc6580c83.tar.bz2 scummvm-rg350-3f12927b77735c17eedfbe14f36607ddc6580c83.zip |
TITANIC: Added CVideoSurface transPixelate
Diffstat (limited to 'engines/titanic/support')
-rw-r--r-- | engines/titanic/support/video_surface.cpp | 28 | ||||
-rw-r--r-- | engines/titanic/support/video_surface.h | 12 |
2 files changed, 40 insertions, 0 deletions
diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index e71b25184b..85a1aa1c58 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -476,6 +476,34 @@ bool OSVideoSurface::loadIfReady() { } } +void OSVideoSurface::transPixelate() { + if (!loadIfReady()) + return; + + lock(); + Graphics::ManagedSurface *surface = _rawSurface; + uint transColor = getTransparencyColor(); + // TODO: Check whether color is correct + uint pixelColor = surface->format.RGBToColor(0x50, 0, 0); + + for (int yp = 0; yp < surface->h; ++yp) { + uint16 *pixelsP = (uint16 *)surface->getBasePtr(0, yp); + bool bitFlag = (yp % 2) == 0; + int replaceCtr = yp & 3; + + for (int xp = 0; xp < surface->w; ++xp, ++pixelsP) { + if (bitFlag && *pixelsP == transColor && replaceCtr == 0) + *pixelsP = pixelColor; + + bitFlag = !bitFlag; + replaceCtr = (replaceCtr + 1) & 3; + } + } + + surface->markAllDirty(); + unlock(); +} + int OSVideoSurface::freeSurface() { if (!_ddSurface) return 0; diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 9b7e0fbaec..45c6182fe6 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -224,6 +224,12 @@ public: */ virtual bool load() = 0; + /** + * Does a replacement of transparent pixels on certain lines at regular + * intervals. This is totally weird + */ + virtual void transPixelate() = 0; + virtual bool proc45(); /** @@ -424,6 +430,12 @@ public: virtual bool load(); /** + * Does a replacement of transparent pixels on certain lines at regular + * intervals. This is totally weird + */ + virtual void transPixelate(); + + /** * Frees the underlying surface */ virtual int freeSurface(); |