[Scummvm-cvs-logs] scummvm master -> 60657f9fd22154d6e554a8e5516a489547c70a84

wjp wjp at usecode.org
Thu Dec 24 16:54:57 CET 2015


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d98d39c315 LAB: Move dispBitMap to Anim
60657f9fd2 LAB: Simplify Anim output to buffer


Commit: d98d39c315bce9577093770c8b39d83bc0aa34ba
    https://github.com/scummvm/scummvm/commit/d98d39c315bce9577093770c8b39d83bc0aa34ba
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2015-12-24T16:51:02+01:00

Commit Message:
LAB: Move dispBitMap to Anim

Changed paths:
    engines/lab/anim.cpp
    engines/lab/anim.h
    engines/lab/dispman.cpp
    engines/lab/dispman.h



diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp
index 7f7e488..6e9b04f 100644
--- a/engines/lab/anim.cpp
+++ b/engines/lab/anim.cpp
@@ -67,6 +67,10 @@ Anim::Anim(LabEngine *vm) : _vm(vm) {
 
 	for (int i = 0; i < 3 * 256; i++)
 		_diffPalette[i] = 0;
+
+	_dispBitMap._bytesPerRow  = _vm->_graphics->_screenWidth;
+	_dispBitMap._drawOnScreen = true;
+	_dispBitMap._buffer = nullptr;
 }
 
 Anim::~Anim() {
@@ -74,15 +78,21 @@ Anim::~Anim() {
 	_vm->_anim->_scrollScreenBuffer = nullptr;
 }
 
+void Anim::setOutputBuffer(byte *memoryBuffer) {
+	_dispBitMap._bytesPerRow  = _vm->_graphics->_screenWidth;
+	_dispBitMap._drawOnScreen = (memoryBuffer == nullptr);
+	_dispBitMap._buffer       = memoryBuffer;
+}
+
+
 void Anim::diffNextFrame(bool onlyDiffData) {
 	if (_lastBlockHeader == 65535)
 		// Already done.
 		return;
 
-	BitMap *disp = _vm->_graphics->_dispBitMap;
-	bool drawOnScreen = disp->_drawOnScreen;
-	byte *startOfBuf = disp->_buffer;
-	int bufPitch = disp->_bytesPerRow;
+	bool drawOnScreen = _dispBitMap._drawOnScreen;
+	byte *startOfBuf = _dispBitMap._buffer;
+	int bufPitch = _dispBitMap._bytesPerRow;
 
 	if (drawOnScreen) {
 		startOfBuf = _vm->_graphics->getCurrentDrawingBuffer();
diff --git a/engines/lab/anim.h b/engines/lab/anim.h
index de14035..f9f72bb 100644
--- a/engines/lab/anim.h
+++ b/engines/lab/anim.h
@@ -71,6 +71,8 @@ private:
 	uint32 _diffWidth;
 	uint32 _diffHeight;
 
+	BitMap _dispBitMap;
+
 public:
 	Anim(LabEngine *vm);
 	virtual ~Anim();
@@ -85,7 +87,8 @@ public:
 	/**
 	 * Reads in a DIFF file.
 	 */
-	void readDiff(Common::File *diffFile, bool playOnce, bool onlyDiffData = false);
+	void setOutputBuffer(byte *memoryBuffer); // nullptr for output to screen
+	void readDiff(Common::File *diffFile, bool playOnce, bool onlyDiffData);
 	void diffNextFrame(bool onlyDiffData = false);
 
 	/**
diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp
index 7f581e7..5a9d525 100644
--- a/engines/lab/dispman.cpp
+++ b/engines/lab/dispman.cpp
@@ -58,13 +58,10 @@ DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) {
 
 	for (int i = 0; i < 256 * 3; i++)
 		_curvgapal[i] = 0;
-
-	_dispBitMap = new BitMap;
 }
 
 DisplayMan::~DisplayMan() {
 	freePict();
-	delete _dispBitMap;
 	delete[] _displayBuffer;
 }
 
@@ -95,10 +92,7 @@ void DisplayMan::readPict(const Common::String filename, bool playOnce, bool onl
 	if (!_vm->_music->_loopSoundEffect)
 		_vm->_music->stopSoundEffect();
 
-	_dispBitMap->_bytesPerRow  = _screenWidth;
-	_dispBitMap->_drawOnScreen = (memoryBuffer == nullptr);
-	_dispBitMap->_buffer       = memoryBuffer;
-
+	_vm->_anim->setOutputBuffer(memoryBuffer);
 	_vm->_anim->readDiff(_curBitmap, playOnce, onlyDiffData);
 }
 
diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h
index 3b41505..5778952 100644
--- a/engines/lab/dispman.h
+++ b/engines/lab/dispman.h
@@ -33,7 +33,6 @@
 
 namespace Lab {
 
-struct BitMap;
 class LabEngine;
 class Image;
 
@@ -272,7 +271,6 @@ public:
 	byte *_displayBuffer;
 	byte *_currentDisplayBuffer;
 	uint16 *_fadePalette;
-	BitMap *_dispBitMap;
 };
 
 } // End of namespace Lab


Commit: 60657f9fd22154d6e554a8e5516a489547c70a84
    https://github.com/scummvm/scummvm/commit/60657f9fd22154d6e554a8e5516a489547c70a84
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2015-12-24T16:53:32+01:00

Commit Message:
LAB: Simplify Anim output to buffer

Changed paths:
    engines/lab/anim.cpp
    engines/lab/anim.h



diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp
index 6e9b04f..eb825fb 100644
--- a/engines/lab/anim.cpp
+++ b/engines/lab/anim.cpp
@@ -68,9 +68,7 @@ Anim::Anim(LabEngine *vm) : _vm(vm) {
 	for (int i = 0; i < 3 * 256; i++)
 		_diffPalette[i] = 0;
 
-	_dispBitMap._bytesPerRow  = _vm->_graphics->_screenWidth;
-	_dispBitMap._drawOnScreen = true;
-	_dispBitMap._buffer = nullptr;
+	_outputBuffer = nullptr; // output to screen
 }
 
 Anim::~Anim() {
@@ -79,9 +77,7 @@ Anim::~Anim() {
 }
 
 void Anim::setOutputBuffer(byte *memoryBuffer) {
-	_dispBitMap._bytesPerRow  = _vm->_graphics->_screenWidth;
-	_dispBitMap._drawOnScreen = (memoryBuffer == nullptr);
-	_dispBitMap._buffer       = memoryBuffer;
+	_outputBuffer = memoryBuffer;
 }
 
 
@@ -90,15 +86,13 @@ void Anim::diffNextFrame(bool onlyDiffData) {
 		// Already done.
 		return;
 
-	bool drawOnScreen = _dispBitMap._drawOnScreen;
-	byte *startOfBuf = _dispBitMap._buffer;
-	int bufPitch = _dispBitMap._bytesPerRow;
+	bool drawOnScreen = false;
+	byte *startOfBuf = _outputBuffer;
+	int bufPitch = _vm->_graphics->_screenWidth;
 
-	if (drawOnScreen) {
+	if (!_outputBuffer) {
 		startOfBuf = _vm->_graphics->getCurrentDrawingBuffer();
-		bufPitch = _vm->_graphics->_screenWidth;
-	} else {
-		assert(startOfBuf);
+		drawOnScreen = true;
 	}
 	byte *endOfBuf = startOfBuf + (int)_diffWidth * _diffHeight;
 
diff --git a/engines/lab/anim.h b/engines/lab/anim.h
index f9f72bb..1979aa5 100644
--- a/engines/lab/anim.h
+++ b/engines/lab/anim.h
@@ -43,12 +43,6 @@ struct DIFFHeader {
 	uint32 _flags;
 };
 
-struct BitMap {
-	uint16 _bytesPerRow;
-	bool _drawOnScreen;
-	byte *_buffer;
-};
-
 class Anim {
 private:
 	LabEngine *_vm;
@@ -71,7 +65,7 @@ private:
 	uint32 _diffWidth;
 	uint32 _diffHeight;
 
-	BitMap _dispBitMap;
+	byte *_outputBuffer;
 
 public:
 	Anim(LabEngine *vm);






More information about the Scummvm-git-logs mailing list