[Scummvm-cvs-logs] CVS: scummvm/common scaler.cpp,1.2,1.3 system.h,1.4,1.5

Max Horn fingolfin at users.sourceforge.net
Thu Sep 19 09:07:09 CEST 2002


Update of /cvsroot/scummvm/scummvm/common
In directory usw-pr-cvs1:/tmp/cvs-serv18083/common

Modified Files:
	scaler.cpp system.h 
Log Message:
Added overlay to OSystem interface; implemented overlay in SDL backend (all other backends, including SDL_gl, still need to implement this!); changed NewGUI to make use of the overlay; added Cmd-Q as a shortcut for Quit on MacOS X

Index: scaler.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/scaler.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- scaler.cpp	8 Sep 2002 01:08:11 -0000	1.2
+++ scaler.cpp	19 Sep 2002 16:06:49 -0000	1.3
@@ -747,16 +747,15 @@
 }
 
 
-/* Beware! Contrary to the other functions in this file, this blits from 8 to 8 bit! */
 void Normal1x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch,
 							int width, int height)
 {
-	uint8 *r;
+	uint16 *r;
 
 	while (height--) {
-		r = dstPtr;
+		r = (uint16 *)dstPtr;
 		for (int i = 0; i < width; ++i, ++r) {
-			uint8 color = *(srcPtr + i);
+			uint16 color = *(((uint16 *)srcPtr) + i);
 
 			*r = color;
 		}
@@ -765,7 +764,6 @@
 	}
 }
 
-/* Beware! Contrary to the other functions in this file, this blits from 8 to 8 bit! */
 void Normal2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch,
 							int width, int height)
 {
@@ -773,42 +771,42 @@
 
 	while (height--) {
 		r = dstPtr;
-		for (int i = 0; i < width; ++i, r += 2) {
-			uint8 color = *(srcPtr + i);
+		for (int i = 0; i < width; ++i, r += 4) {
+			uint16 color = *(((uint16 *)srcPtr) + i);
 
-			*(r) = color;
-			*(r + 1) = color;
-			*(r + dstPitch) = color;
-			*(r + dstPitch + 1) = color;
+			*(uint16 *)(r + 0) = color;
+			*(uint16 *)(r + 2) = color;
+			*(uint16 *)(r + 0 + dstPitch) = color;
+			*(uint16 *)(r + 2 + dstPitch) = color;
 		}
 		srcPtr += srcPitch;
 		dstPtr += dstPitch << 1;
 	}
 }
 
-/* Beware! Contrary to the other functions in this file, this blits from 8 to 8 bit! */
 void Normal3x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch,
 							int width, int height)
 {
 	uint8 *r;
-	uint32 dstPitch2 = dstPitch << 1;
+	uint32 dstPitch2 = dstPitch * 2;
+	uint32 dstPitch3 = dstPitch * 3;
 
 	while (height--) {
 		r = dstPtr;
-		for (int i = 0; i < width; ++i, r += 3) {
-			uint8 color = *(srcPtr + i);
+		for (int i = 0; i < width; ++i, r += 6) {
+			uint16 color = *(((uint16 *)srcPtr) + i);
 
-			*(r + 0) = color;
-			*(r + 1) = color;
-			*(r + 2) = color;
-			*(r + 0 + dstPitch) = color;
-			*(r + 1 + dstPitch) = color;
-			*(r + 2 + dstPitch) = color;
-			*(r + 0 + dstPitch2) = color;
-			*(r + 1 + dstPitch2) = color;
-			*(r + 2 + dstPitch2) = color;
+			*(uint16 *)(r + 0) = color;
+			*(uint16 *)(r + 2) = color;
+			*(uint16 *)(r + 4) = color;
+			*(uint16 *)(r + 0 + dstPitch) = color;
+			*(uint16 *)(r + 2 + dstPitch) = color;
+			*(uint16 *)(r + 4 + dstPitch) = color;
+			*(uint16 *)(r + 0 + dstPitch2) = color;
+			*(uint16 *)(r + 2 + dstPitch2) = color;
+			*(uint16 *)(r + 4 + dstPitch2) = color;
 		}
 		srcPtr += srcPitch;
-		dstPtr += dstPitch * 3;
+		dstPtr += dstPitch3;
 	}
 }

Index: system.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/system.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- system.h	18 Sep 2002 10:22:35 -0000	1.4
+++ system.h	19 Sep 2002 16:06:49 -0000	1.5
@@ -158,6 +158,13 @@
 
 	// Quit
 	virtual void quit() = 0;
+	
+	// Overlay
+	virtual void show_overlay() = 0;
+	virtual void hide_overlay() = 0;
+	virtual void clear_overlay() = 0;
+	virtual void grab_overlay(int16 *buf, int pitch) = 0;
+	virtual void copy_rect_overlay(const int16 *buf, int pitch, int x, int y, int w, int h) = 0;
 };
 
 





More information about the Scummvm-git-logs mailing list