aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support/video_surface.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-10-02 15:39:45 -0400
committerPaul Gilbert2016-10-02 15:39:45 -0400
commitdd2ee74cc099e1cf7b6a179886581188b5dfbca3 (patch)
treeabeeb76f6170cc3b597e1463edaecc3f62426a49 /engines/titanic/support/video_surface.cpp
parent3d25e260f783586c9a1a53dfa5bd0216d5277360 (diff)
downloadscummvm-rg350-dd2ee74cc099e1cf7b6a179886581188b5dfbca3.tar.gz
scummvm-rg350-dd2ee74cc099e1cf7b6a179886581188b5dfbca3.tar.bz2
scummvm-rg350-dd2ee74cc099e1cf7b6a179886581188b5dfbca3.zip
TITANIC: Change mouse cursor to use transparency
Diffstat (limited to 'engines/titanic/support/video_surface.cpp')
-rw-r--r--engines/titanic/support/video_surface.cpp45
1 files changed, 15 insertions, 30 deletions
diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp
index fa87e6df0c..8e2fb40a27 100644
--- a/engines/titanic/support/video_surface.cpp
+++ b/engines/titanic/support/video_surface.cpp
@@ -22,8 +22,8 @@
#include "titanic/support/video_surface.h"
#include "titanic/support/image_decoders.h"
-#include "titanic/support/raw_surface.h"
#include "titanic/support/screen_manager.h"
+#include "titanic/support/transparency_surface.h"
#include "titanic/titanic.h"
namespace Titanic {
@@ -198,40 +198,28 @@ void CVideoSurface::transBlitRect(const Rect &srcRect, const Rect &destRect, CVi
bool isAlpha = src->_transparencyMode == TRANS_ALPHA0 ||
src->_transparencyMode == TRANS_ALPHA255;
- CRawSurface rawSurface(src->getTransparencySurface(), src->_transparencyMode);
+ CTransparencySurface transSurface(src->getTransparencySurface(), src->_transparencyMode);
if (flipFlag)
- rawSurface.setRow(srcRect.top);
+ transSurface.setRow(srcRect.top);
else
- rawSurface.setRow(src->getHeight() - srcRect.bottom);
+ transSurface.setRow(src->getHeight() - srcRect.bottom);
for (int srcY = srcRect.top; srcY < srcRect.bottom; ++srcY) {
// Prepare for copying the line
const uint16 *lineSrcP = srcPtr;
uint16 *lineDestP = destPtr;
- rawSurface.resetPitch();
- rawSurface.setCol(srcRect.left);
+ transSurface.setRow(srcY);
+ transSurface.setCol(srcRect.left);
int srcWidth = srcRect.width();
while (srcWidth > 0) {
- int move = rawSurface.moveX(0);
+ int move = transSurface.moveX();
if (move <= 1) {
- if (!rawSurface.isPixelTransparent2()) {
- copyPixel(lineDestP, lineSrcP, rawSurface.getPixel() >> 3,
+ if (!transSurface.isPixelTransparent2()) {
+ copyPixel(lineDestP, lineSrcP, transSurface.getPixel() >> 3,
is16Bit, isAlpha);
}
- } else {
- if (move > srcWidth)
- move = srcWidth;
-
- if (rawSurface.isPixelTransparent1()) {
- Common::copy(lineSrcP, lineSrcP + move, lineDestP);
- } else if (!rawSurface.isPixelTransparent2()) {
- byte transVal = rawSurface.getPixel() >> 3;
- for (int idx = 0; idx < move; ++idx) {
- copyPixel(lineDestP + idx, lineSrcP + idx, transVal, is16Bit, isAlpha);
- }
- }
}
lineSrcP += move;
@@ -240,7 +228,6 @@ void CVideoSurface::transBlitRect(const Rect &srcRect, const Rect &destRect, CVi
}
// Move to next line
- rawSurface.skipPitch();
srcPtr = flipFlag ? srcPtr + getWidth() : srcPtr - getWidth();
destPtr -= destArea.w;
}
@@ -487,13 +474,11 @@ uint16 OSVideoSurface::getPixel(const Common::Point &pt) {
if (pt.x >= 0 && pt.y >= 0 && pt.x < getWidth() && pt.y < getHeight()) {
if (_transparencySurface) {
- CRawSurface rawSurface(&_transparencySurface->rawSurface(), _transparencyMode);
- rawSurface.setRow(_transBlitFlag ? pt.y : getHeight() - pt.y - 1);
- rawSurface.resetPitch();
- rawSurface.setCol(pt.x);
- rawSurface.moveX(0);
+ CTransparencySurface transSurface(&_transparencySurface->rawSurface(), _transparencyMode);
+ transSurface.setRow(_transBlitFlag ? pt.y : getHeight() - pt.y - 1);
+ transSurface.setCol(pt.x);
- if (rawSurface.isPixelTransparent2())
+ if (transSurface.isPixelTransparent2())
return getTransparencyColor();
}
@@ -637,8 +622,8 @@ void OSVideoSurface::transPixelate() {
unlock();
}
-Graphics::ManagedSurface *OSVideoSurface::dupMovieFrame() const {
- return _movie ? _movie->duplicateFrame() : nullptr;
+Graphics::ManagedSurface *OSVideoSurface::dupMovieTransparency() const {
+ return _movie ? _movie->duplicateTransparency() : nullptr;
}
int OSVideoSurface::freeSurface() {