From 3f12927b77735c17eedfbe14f36607ddc6580c83 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 3 Jul 2016 14:22:33 -0400 Subject: TITANIC: Added CVideoSurface transPixelate --- engines/titanic/support/video_surface.cpp | 28 ++++++++++++++++++++++++++++ engines/titanic/support/video_surface.h | 12 ++++++++++++ 2 files changed, 40 insertions(+) (limited to 'engines/titanic/support') 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(); /** @@ -423,6 +429,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 */ -- cgit v1.2.3