[Scummvm-cvs-logs] scummvm master -> f41267311d291ce71b5499f1e118f699cd4b817b

Strangerke Strangerke at scummvm.org
Sat Dec 26 16:04:49 CET 2015


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:
f41267311d LAB: Some renaming in blitBitmap and readScreenImage


Commit: f41267311d291ce71b5499f1e118f699cd4b817b
    https://github.com/scummvm/scummvm/commit/f41267311d291ce71b5499f1e118f699cd4b817b
Author: Strangerke (strangerke at scummvm.org)
Date: 2015-12-26T15:24:32+01:00

Commit Message:
LAB: Some renaming in blitBitmap and readScreenImage

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



diff --git a/engines/lab/image.cpp b/engines/lab/image.cpp
index ce0d543..4c058a2 100644
--- a/engines/lab/image.cpp
+++ b/engines/lab/image.cpp
@@ -54,47 +54,47 @@ Image::~Image() {
 	delete[] _imageData;
 }
 
-void Image::blitBitmap(uint16 xs, uint16 ys, Image *imDest,
-	uint16 xd, uint16 yd, uint16 width, uint16 height, byte masked) {
-	int w = width;
-	int h = height;
-	int destWidth = (imDest) ? imDest->_width : _vm->_graphics->_screenWidth;
-	int destHeight = (imDest) ? imDest->_height : _vm->_graphics->_screenHeight;
-	byte *destBuffer = (imDest) ? imDest->_imageData : _vm->_graphics->getCurrentDrawingBuffer();
+void Image::blitBitmap(uint16 srcX, uint16 srcY, Image *imgDest,
+	uint16 destX, uint16 destY, uint16 width, uint16 height, byte masked) {
+	int clipWidth = width;
+	int clipHeight = height;
+	int destWidth = (imgDest) ? imgDest->_width : _vm->_graphics->_screenWidth;
+	int destHeight = (imgDest) ? imgDest->_height : _vm->_graphics->_screenHeight;
+	byte *destBuffer = (imgDest) ? imgDest->_imageData : _vm->_graphics->getCurrentDrawingBuffer();
 
-	if (xd + w > destWidth)
-		w = destWidth - xd;
+	if (destX + clipWidth > destWidth)
+		clipWidth = destWidth - destX;
 
-	if (yd + h > destHeight)
-		h = destHeight - yd;
+	if (destY + clipHeight > destHeight)
+		clipHeight = destHeight - destY;
 
-	if ((w > 0) && (h > 0)) {
-		byte *s = _imageData + ys * _width + xs;
-		byte *d = destBuffer + yd * destWidth + xd;
+	if ((clipWidth > 0) && (clipHeight > 0)) {
+		byte *img = _imageData + srcY * _width + srcX;
+		byte *dest = destBuffer + destY * destWidth + destX;
 
 		if (!masked) {
-			while (h-- > 0) {
-				memcpy(d, s, w);
-				s += _width;
-				d += destWidth;
+			while (clipHeight-- > 0) {
+				memcpy(dest, img, clipWidth);
+				img += _width;
+				dest += destWidth;
 			}
 		} else {
-			while (h-- > 0) {
-				byte *ss = s;
-				byte *dd = d;
-				int ww = w;
+			while (clipHeight-- > 0) {
+				byte *maskedImg = img;
+				byte *maskedDest = dest;
+				int maskedWidth = clipWidth;
 
-				while (ww-- > 0) {
-					byte c = *ss++;
+				while (maskedWidth-- > 0) {
+					byte c = *maskedImg++;
 
 					if (c)
-						*dd++ = c - 1;
+						*maskedDest++ = c - 1;
 					else
-						dd++;
+						maskedDest++;
 				}
 
-				s += _width;
-				d += destWidth;
+				img += _width;
+				dest += destWidth;
 			}
 		}
 	}
@@ -109,23 +109,23 @@ void Image::drawMaskImage(uint16 x, uint16 y) {
 }
 
 void Image::readScreenImage(uint16 x, uint16 y) {
-	int w = _width;
-	int h = _height;
+	int clipWidth = _width;
+	int clipHeight = _height;
 
-	if (x + w > _vm->_graphics->_screenWidth)
-		w = _vm->_graphics->_screenWidth - x;
+	if (x + clipWidth > _vm->_graphics->_screenWidth)
+		clipWidth = _vm->_graphics->_screenWidth - x;
 
-	if (y + h > _vm->_graphics->_screenHeight)
-		h = _vm->_graphics->_screenHeight - y;
+	if (y + clipHeight > _vm->_graphics->_screenHeight)
+		clipHeight = _vm->_graphics->_screenHeight - y;
 
-	if ((w > 0) && (h > 0)) {
-		byte *s = _imageData;
-		byte *d = _vm->_graphics->getCurrentDrawingBuffer() + y * _vm->_graphics->_screenWidth + x;
+	if ((clipWidth > 0) && (clipHeight > 0)) {
+		byte *img = _imageData;
+		byte *screen = _vm->_graphics->getCurrentDrawingBuffer() + y * _vm->_graphics->_screenWidth + x;
 
-		while (h-- > 0) {
-			memcpy(s, d, w);
-			s += _width;
-			d += _vm->_graphics->_screenWidth;
+		while (clipHeight-- > 0) {
+			memcpy(img, screen, clipWidth);
+			img += _width;
+			screen += _vm->_graphics->_screenWidth;
 		}
 	}
 }
diff --git a/engines/lab/image.h b/engines/lab/image.h
index bac32cd..8c28f63 100644
--- a/engines/lab/image.h
+++ b/engines/lab/image.h
@@ -70,7 +70,7 @@ public:
 	/**
 	 * Blits a piece of one image to another.
 	 */
-	void blitBitmap(uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height, byte masked);
+	void blitBitmap(uint16 srcX, uint16 srcY, Image *imgDest, uint16 destX, uint16 destY, uint16 width, uint16 height, byte masked);
 };
 
 } // End of namespace Lab






More information about the Scummvm-git-logs mailing list