aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support
diff options
context:
space:
mode:
authorPaul Gilbert2016-10-04 19:33:46 -0400
committerPaul Gilbert2016-10-04 19:33:46 -0400
commit209ea3427f2ca4dd47b09df57026db3f43b8182e (patch)
tree7395f4cd82a74e5cc1ac9ac4888f639d9d32f93d /engines/titanic/support
parent42c518238def133be776b7b857572bb54bc235ed (diff)
downloadscummvm-rg350-209ea3427f2ca4dd47b09df57026db3f43b8182e.tar.gz
scummvm-rg350-209ea3427f2ca4dd47b09df57026db3f43b8182e.tar.bz2
scummvm-rg350-209ea3427f2ca4dd47b09df57026db3f43b8182e.zip
TITANIC: Clarify code for vertically flipped blitting
Diffstat (limited to 'engines/titanic/support')
-rw-r--r--engines/titanic/support/avi_surface.cpp4
-rw-r--r--engines/titanic/support/video_surface.cpp18
-rw-r--r--engines/titanic/support/video_surface.h14
3 files changed, 22 insertions, 14 deletions
diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp
index 5b11c7799e..a45d586695 100644
--- a/engines/titanic/support/avi_surface.cpp
+++ b/engines/titanic/support/avi_surface.cpp
@@ -58,7 +58,7 @@ AVISurface::AVISurface(const CResourceKey &key) {
AVISurface::~AVISurface() {
if (_videoSurface)
- _videoSurface->_transBlitFlag = false;
+ _videoSurface->_flipVertically = false;
delete _framePixels;
delete _movieFrameSurface[0];
delete _movieFrameSurface[1];
@@ -248,7 +248,7 @@ void AVISurface::setupDecompressor() {
_framePixels = new Graphics::ManagedSurface(_decoder->getWidth(), _decoder->getHeight(),
_decoder->getVideoTrack(0).getPixelFormat());
} else if (idx == 0) {
- _videoSurface->_transBlitFlag = true;
+ _videoSurface->_flipVertically = true;
}
}
}
diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp
index bcaaad4492..7b5a96fb9f 100644
--- a/engines/titanic/support/video_surface.cpp
+++ b/engines/titanic/support/video_surface.cpp
@@ -34,7 +34,7 @@ byte CVideoSurface::_palette2[32][32];
CVideoSurface::CVideoSurface(CScreenManager *screenManager) :
_screenManager(screenManager), _rawSurface(nullptr), _movie(nullptr),
- _pendingLoad(false), _transBlitFlag(false), _fastBlitFlag(false),
+ _pendingLoad(false), _flipVertically(false), _fastBlitFlag(false),
_transparencySurface(nullptr), _transparencyMode(TRANS_DEFAULT),
_freeTransparencySurface(DisposeAfterUse::NO), _hasFrame(true), _lockCount(0) {
_videoSurfaceNum = _videoSurfaceCounter++;
@@ -77,10 +77,10 @@ void CVideoSurface::blitFrom(const Point &destPos, CVideoSurface *src, const Rec
Rect srcBounds, destBounds;
clipBounds(srcBounds, destBounds, src, srcRect, &destPos);
- if (src->_transBlitFlag)
- blitRect2(srcBounds, destBounds, src);
+ if (src->_flipVertically)
+ flippedBlitRect(srcBounds, destBounds, src);
else
- blitRect1(srcBounds, destBounds, src);
+ blitRect(srcBounds, destBounds, src);
}
}
@@ -153,7 +153,7 @@ void CVideoSurface::clipBounds(Rect &srcRect, Rect &destRect,
error("Invalid rect");
}
-void CVideoSurface::blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) {
+void CVideoSurface::blitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) {
src->lock();
lock();
@@ -169,7 +169,7 @@ void CVideoSurface::blitRect1(const Rect &srcRect, const Rect &destRect, CVideoS
unlock();
}
-void CVideoSurface::blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) {
+void CVideoSurface::flippedBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) {
if (src->getTransparencySurface()) {
transBlitRect(srcRect, destRect, src, true);
} else {
@@ -469,7 +469,7 @@ uint16 OSVideoSurface::getPixel(const Common::Point &pt) {
if (pt.x >= 0 && pt.y >= 0 && pt.x < getWidth() && pt.y < getHeight()) {
if (_transparencySurface) {
CTransparencySurface transSurface(&_transparencySurface->rawSurface(), _transparencyMode);
- transSurface.setRow(_transBlitFlag ? pt.y : getHeight() - pt.y - 1);
+ transSurface.setRow(_flipVertically ? pt.y : getHeight() - pt.y - 1);
transSurface.setCol(pt.x);
if (transSurface.isPixelTransparent2())
@@ -550,7 +550,7 @@ const CMovieRangeInfoList *OSVideoSurface::getMovieRangeInfo() const {
}
void OSVideoSurface::flipVertically(bool needsLock) {
- if (!loadIfReady() || !_transBlitFlag)
+ if (!loadIfReady() || !_flipVertically)
return;
if (needsLock)
@@ -569,7 +569,7 @@ void OSVideoSurface::flipVertically(bool needsLock) {
Common::copy(lineBuffer, lineBuffer + pitch, line1P);
}
- _transBlitFlag = false;
+ _flipVertically = false;
if (needsLock)
unlock();
}
diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h
index 3625a3555c..4a4ce1861a 100644
--- a/engines/titanic/support/video_surface.h
+++ b/engines/titanic/support/video_surface.h
@@ -67,8 +67,16 @@ private:
void clipBounds(Rect &srcRect, Rect &destRect, CVideoSurface *srcSurface,
const Rect *subRect = nullptr, const Point *destPos = nullptr);
- void blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src);
- void blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src);
+ /**
+ * Copies a rect from a given source surface
+ */
+ void blitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src);
+
+ /**
+ * Copies a rect from a given source surface and draws it vertically flipped
+ */
+ void flippedBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src);
+
void transBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src, bool flipFlag);
protected:
static int _videoSurfaceCounter;
@@ -85,7 +93,7 @@ public:
CMovie *_movie;
DirectDrawSurface *_ddSurface;
bool _fastBlitFlag;
- bool _transBlitFlag;
+ bool _flipVertically;
CResourceKey _resourceKey;
TransparencyMode _transparencyMode;
public: