[Scummvm-cvs-logs] SF.net SVN: scummvm:[35587] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sun Dec 28 10:28:44 CET 2008


Revision: 35587
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35587&view=rev
Author:   drmccoy
Date:     2008-12-28 09:28:43 +0000 (Sun, 28 Dec 2008)

Log Message:
-----------
/That's/ the blit24

Modified Paths:
--------------
    scummvm/trunk/engines/gob/coktelvideo.cpp
    scummvm/trunk/engines/gob/coktelvideo.h

Modified: scummvm/trunk/engines/gob/coktelvideo.cpp
===================================================================
--- scummvm/trunk/engines/gob/coktelvideo.cpp	2008-12-28 08:02:57 UTC (rev 35586)
+++ scummvm/trunk/engines/gob/coktelvideo.cpp	2008-12-28 09:28:43 UTC (rev 35587)
@@ -962,16 +962,20 @@
 		_blitMode = 0;
 	else if (_bytesPerPixel == 1)
 		_blitMode = 0;
-	else if (_bytesPerPixel == 2) {
-		_blitMode = 1;
-		_preScaleX = 2;
-		_postScaleX = 1;
-		_bytesPerPixel = 2;
-	} else if (_bytesPerPixel == 3) {
-		_blitMode = 2;
-		_preScaleX = 1;
-		_postScaleX = 2;
-		_bytesPerPixel = 2;
+	else if ((_bytesPerPixel == 2) || (_bytesPerPixel == 3)) {
+		int n = (_flags & 0x80) ? 2 : 3;
+
+		_blitMode = n - 1;
+
+		if (_bytesPerPixel == 2) {
+			_preScaleX = n;
+			_postScaleX = 1;
+		} else if (_bytesPerPixel == 3) {
+			_preScaleX = 1;
+			_postScaleX = n;
+		}
+
+		_bytesPerPixel = n;
 	}
 
 	_scaleExternalX = 1;
@@ -1129,10 +1133,7 @@
 }
 
 int16 Vmd::getWidth() const {
-	if (_blitMode == 1)
-		return _width >> 1;
-
-	return _width;
+	return preScaleX(_width);
 }
 
 void Vmd::setXY(int16 x, int16 y) {
@@ -1547,11 +1548,11 @@
 	return 1;
 }
 
-inline int32 Vmd::preScaleX(int32 x) {
+inline int32 Vmd::preScaleX(int32 x) const {
 	return x / _preScaleX;
 }
 
-inline int32 Vmd::postScaleX(int32 x) {
+inline int32 Vmd::postScaleX(int32 x) const {
 	return x * _postScaleX;
 }
 
@@ -1559,14 +1560,13 @@
 	if (_blitMode == 0)
 		return;
 
-	if ((_blitMode == 1) || (_blitMode == 2))
-		blit16(dest, (uint16 *) src, width, height);
+	if (_blitMode == 1)
+		blit16(dest, src, preScaleX(_width), preScaleX(width), height);
+	else if (_blitMode == 2)
+		blit24(dest, src, preScaleX(_width), preScaleX(width), height);
 }
 
-void Vmd::blit16(byte *dest, uint16 *src, int16 width, int16 height) {
-	int16 vWidth = preScaleX(_width);
-	width = preScaleX(width);
-
+void Vmd::blit16(byte *dest, byte *src, int16 srcPitch, int16 width, int16 height) {
 	assert(_palLUT);
 
 	Graphics::SierraLight *dither =
@@ -1574,9 +1574,9 @@
 
 	for (int i = 0; i < height; i++) {
 		byte *d = dest;
-		uint16 *s = src;
+		byte *s = src;
 
-		for (int j = 0; j < width; j++, s++) {
+		for (int j = 0; j < width; j++, s += 2) {
 			uint16 data = READ_LE_UINT16(s);
 			byte r = ((data & 0x7C00) >> 10);
 			byte g = ((data & 0x03E0) >>  5);
@@ -1595,12 +1595,46 @@
 
 		dither->nextLine();
 		dest += _vidMemWidth;
-		src += vWidth;
+		src += 2 * srcPitch;
 	}
 
 	delete dither;
 }
 
+void Vmd::blit24(byte *dest, byte *src, int16 srcPitch, int16 width, int16 height) {
+	assert(_palLUT);
+
+	Graphics::SierraLight *dither =
+		new Graphics::SierraLight(width, _palLUT);
+
+	for (int i = 0; i < height; i++) {
+		byte *d = dest;
+		byte *s = src;
+
+		for (int j = 0; j < width; j++, s += 3) {
+			byte r = s[2];
+			byte g = s[1];
+			byte b = s[0];
+			byte dY, dU, dV;
+
+			Graphics::PaletteLUT::RGB2YUV(r, g, b, dY, dU, dV);
+
+			byte p = dither->dither(dY, dU, dV, j);
+
+			if ((dY == 0) || ((r == 0) && (g == 0) && (b == 0)))
+				*d++ = 0;
+			else
+				*d++ = p;
+		}
+
+		dither->nextLine();
+		dest += _vidMemWidth;
+		src += 3 * srcPitch;
+	}
+
+	delete dither;
+}
+
 void Vmd::emptySoundSlice(uint32 size) {
 	if (!_audioStream)
 		return;

Modified: scummvm/trunk/engines/gob/coktelvideo.h
===================================================================
--- scummvm/trunk/engines/gob/coktelvideo.h	2008-12-28 08:02:57 UTC (rev 35586)
+++ scummvm/trunk/engines/gob/coktelvideo.h	2008-12-28 09:28:43 UTC (rev 35587)
@@ -386,11 +386,12 @@
 
 	void deRLE(byte *&srcPtr, byte *&destPtr, int16 len);
 
-	inline int32 preScaleX(int32 x);
-	inline int32 postScaleX(int32 x);
+	inline int32 preScaleX(int32 x) const;
+	inline int32 postScaleX(int32 x) const;
 
 	void blit(byte *dest, byte *src, int16 width, int16 height);
-	void blit16(byte *dest, uint16 *src, int16 width, int16 height);
+	void blit16(byte *dest, byte *src, int16 srcPitch, int16 width, int16 height);
+	void blit24(byte *dest, byte *src, int16 srcPitch, int16 width, int16 height);
 
 	void emptySoundSlice(uint32 size);
 	void soundSlice8bit(uint32 size);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list