[Scummvm-cvs-logs] scummvm master -> 3f37842580ee0fe2456f301354d0366024cf3f2e

lordhoto lordhoto at gmail.com
Thu Feb 23 21:54:27 CET 2012


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:
3f37842580 IPHONE: Directly use the game screen's texture buffer.


Commit: 3f37842580ee0fe2456f301354d0366024cf3f2e
    https://github.com/scummvm/scummvm/commit/3f37842580ee0fe2456f301354d0366024cf3f2e
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-23T12:52:44-08:00

Commit Message:
IPHONE: Directly use the game screen's texture buffer.

This gets rid of another intermediate buffer.

Changed paths:
    backends/platform/iphone/osys_main.cpp
    backends/platform/iphone/osys_main.h
    backends/platform/iphone/osys_video.mm



diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index e2de6ca..dabf73b 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -55,7 +55,7 @@ SoundProc OSystem_IPHONE::s_soundCallback = NULL;
 void *OSystem_IPHONE::s_soundParam = NULL;
 
 OSystem_IPHONE::OSystem_IPHONE() :
-	_mixer(NULL), _gameScreenRaw(NULL), _gameScreenConverted(NULL),
+	_mixer(NULL), _gameScreenRaw(NULL),
 	_mouseBuf(NULL), _lastMouseTap(0), _queuedEventTime(0),
 	_mouseNeedTextureUpdate(false), _secondaryTapped(false), _lastSecondaryTap(0),
 	_screenOrientation(kScreenOrientationFlippedLandscape), _mouseClickAndDragEnabled(false),
@@ -73,7 +73,6 @@ OSystem_IPHONE::~OSystem_IPHONE() {
 
 	delete _mixer;
 	free(_gameScreenRaw);
-	free(_gameScreenConverted);
 }
 
 int OSystem_IPHONE::timerHandler(int t) {
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index 8b1365a..180d3e9 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -66,8 +66,6 @@ protected:
 	Graphics::Surface _framebuffer;
 	byte *_gameScreenRaw;
 
-	uint16 *_gameScreenConverted;
-
 	// For use with the game texture
 	uint16  _gamePalette[256];
 	// For use with the mouse texture
@@ -190,7 +188,6 @@ protected:
 	void dirtyFullOverlayScreen();
 	void suspendLoop();
 	void drawDirtyRect(const Common::Rect &dirtyRect);
-	void updateHardwareSurfaceForRect(const Common::Rect &updatedRect);
 	void updateMouseTexture();
 	static void AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB);
 	static int timerHandler(int t);
diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm
index 8fc9535..7e2b1ee 100644
--- a/backends/platform/iphone/osys_video.mm
+++ b/backends/platform/iphone/osys_video.mm
@@ -68,13 +68,6 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm
 	_gameScreenRaw = (byte *)malloc(width * height);
 	bzero(_gameScreenRaw, width * height);
 
-	int fullSize = _videoContext->screenWidth * _videoContext->screenHeight * sizeof(OverlayColor);
-
-	free(_gameScreenConverted);
-
-	_gameScreenConverted = (uint16 *)malloc(fullSize);
-	bzero(_gameScreenConverted, fullSize);
-
 	updateOutputSurface();
 
 	clearOverlay();
@@ -191,7 +184,8 @@ void OSystem_IPHONE::internUpdateScreen() {
 
 		//printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
 		drawDirtyRect(dirtyRect);
-		updateHardwareSurfaceForRect(dirtyRect);
+		// TODO: Implement dirty rect code
+		//updateHardwareSurfaceForRect(dirtyRect);
 	}
 
 	if (_videoContext->overlayVisible) {
@@ -210,27 +204,18 @@ void OSystem_IPHONE::drawDirtyRect(const Common::Rect &dirtyRect) {
 	int h = dirtyRect.bottom - dirtyRect.top;
 	int w = dirtyRect.right - dirtyRect.left;
 
-	byte  *src = &_gameScreenRaw[dirtyRect.top * _videoContext->screenWidth + dirtyRect.left];
-	uint16 *dst = &_gameScreenConverted[dirtyRect.top * _videoContext->screenWidth + dirtyRect.left];
+	byte *src = &_gameScreenRaw[dirtyRect.top * _videoContext->screenWidth + dirtyRect.left];
+	byte *dstRaw = (byte *)_videoContext->screenTexture.getBasePtr(dirtyRect.left, dirtyRect.top);
 	for (int y = h; y > 0; y--) {
+		uint16 *dst = (uint16 *)dstRaw;
 		for (int x = w; x > 0; x--)
 			*dst++ = _gamePalette[*src++];
 
-		dst += _videoContext->screenWidth - w;
+		dstRaw += _videoContext->screenTexture.pitch;
 		src += _videoContext->screenWidth - w;
 	}
 }
 
-void OSystem_IPHONE::updateHardwareSurfaceForRect(const Common::Rect &updatedRect) {
-	const int x1 = updatedRect.left;
-	const int y1 = updatedRect.top;
-	const int x2 = updatedRect.right;
-	const int y2 = updatedRect.bottom;
-
-	for (int y = y1; y < y2; ++y)
-		memcpy(_videoContext->screenTexture.getBasePtr(x1, y), &_gameScreenConverted[y * _videoContext->screenWidth + x1], (x2 - x1) * 2);
-}
-
 Graphics::Surface *OSystem_IPHONE::lockScreen() {
 	//printf("lockScreen()\n");
 






More information about the Scummvm-git-logs mailing list