[Scummvm-git-logs] scummvm master -> 209ea3427f2ca4dd47b09df57026db3f43b8182e

dreammaster dreammaster at scummvm.org
Wed Oct 5 01:33:57 CEST 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:
209ea3427f TITANIC: Clarify code for vertically flipped blitting


Commit: 209ea3427f2ca4dd47b09df57026db3f43b8182e
    https://github.com/scummvm/scummvm/commit/209ea3427f2ca4dd47b09df57026db3f43b8182e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-10-04T19:33:46-04:00

Commit Message:
TITANIC: Clarify code for vertically flipped blitting

Changed paths:
    engines/titanic/core/game_object.cpp
    engines/titanic/support/avi_surface.cpp
    engines/titanic/support/video_surface.cpp
    engines/titanic/support/video_surface.h



diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 56c8389..302696a 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -281,7 +281,7 @@ bool CGameObject::checkPoint(const Point &pt, bool ignore40, bool visibleOnly) {
 	}
 
 	Common::Point pixelPos = pt - _bounds;
-	if (_surface->_transBlitFlag) {
+	if (_surface->_flipVertically) {
 		pixelPos.y = ((_bounds.height() - _bounds.top) / 2) * 2 - pixelPos.y;
 	}
 
diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp
index 5b11c77..a45d586 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 bcaaad4..7b5a96f 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 3625a35..4a4ce18 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:





More information about the Scummvm-git-logs mailing list