[Scummvm-cvs-logs] scummvm master -> 23732c7179ffe0e0a1d3ee3cdcefa5cee83e7518

lordhoto lordhoto at gmail.com
Sat Feb 25 20:23:08 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:
23732c7179 IPHONE: Get rid of _gameScreenRaw, instead use _framebuffer internally.


Commit: 23732c7179ffe0e0a1d3ee3cdcefa5cee83e7518
    https://github.com/scummvm/scummvm/commit/23732c7179ffe0e0a1d3ee3cdcefa5cee83e7518
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-25T11:22:23-08:00

Commit Message:
IPHONE: Get rid of _gameScreenRaw, instead use _framebuffer internally.

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 dd34e95..790e192 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),
+	_mixer(NULL),
 	_mouseBuf(NULL), _lastMouseTap(0), _queuedEventTime(0),
 	_mouseNeedTextureUpdate(false), _secondaryTapped(false), _lastSecondaryTap(0),
 	_screenOrientation(kScreenOrientationFlippedLandscape), _mouseClickAndDragEnabled(false),
@@ -72,7 +72,7 @@ OSystem_IPHONE::~OSystem_IPHONE() {
 	AudioQueueDispose(s_AudioQueue.queue, true);
 
 	delete _mixer;
-	free(_gameScreenRaw);
+	_framebuffer.free();
 }
 
 int OSystem_IPHONE::timerHandler(int t) {
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index 84c460a..675fc96 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -64,7 +64,6 @@ protected:
 	VideoContext *_videoContext;
 
 	Graphics::Surface _framebuffer;
-	byte *_gameScreenRaw;
 
 	// For use with the game texture
 	uint16  _gamePalette[256];
diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm
index 265a36f..080b476 100644
--- a/backends/platform/iphone/osys_video.mm
+++ b/backends/platform/iphone/osys_video.mm
@@ -62,10 +62,7 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm
 	_videoContext->screenHeight = height;
 	_videoContext->shakeOffsetY = 0;
 
-	free(_gameScreenRaw);
-
-	_gameScreenRaw = (byte *)malloc(width * height);
-	bzero(_gameScreenRaw, width * height);
+	_framebuffer.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
 
 	_fullScreenIsDirty = false;
 	dirtyFullScreen();
@@ -134,12 +131,12 @@ void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y,
 		y = 0;
 	}
 
-	if (w > (int)_videoContext->screenWidth - x) {
-		w = _videoContext->screenWidth - x;
+	if (w > (int)_framebuffer.w - x) {
+		w = _framebuffer.w - x;
 	}
 
-	if (h > (int)_videoContext->screenHeight - y) {
-		h = _videoContext->screenHeight - y;
+	if (h > (int)_framebuffer.h - y) {
+		h = _framebuffer.h - y;
 	}
 
 	if (w <= 0 || h <= 0)
@@ -150,14 +147,14 @@ void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y,
 	}
 
 
-	byte *dst = _gameScreenRaw + y * _videoContext->screenWidth + x;
-	if ((int)_videoContext->screenWidth == pitch && pitch == w)
+	byte *dst = (byte *)_framebuffer.getBasePtr(x, y);
+	if (_framebuffer.pitch == pitch && pitch == w)
 		memcpy(dst, buf, h * w);
 	else {
 		do {
 			memcpy(dst, buf, w);
 			buf += pitch;
-			dst += _videoContext->screenWidth;
+			dst += _framebuffer.pitch;
 		} while (--h);
 	}
 }
@@ -207,7 +204,7 @@ 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];
+	const byte *src = (const byte *)_framebuffer.getBasePtr(dirtyRect.left, dirtyRect.top);
 	byte *dstRaw = (byte *)_videoContext->screenTexture.getBasePtr(dirtyRect.left, dirtyRect.top);
 	for (int y = h; y > 0; y--) {
 		uint16 *dst = (uint16 *)dstRaw;
@@ -215,19 +212,12 @@ void OSystem_IPHONE::drawDirtyRect(const Common::Rect &dirtyRect) {
 			*dst++ = _gamePalette[*src++];
 
 		dstRaw += _videoContext->screenTexture.pitch;
-		src += _videoContext->screenWidth - w;
+		src += _framebuffer.pitch - w;
 	}
 }
 
 Graphics::Surface *OSystem_IPHONE::lockScreen() {
 	//printf("lockScreen()\n");
-
-	_framebuffer.pixels = _gameScreenRaw;
-	_framebuffer.w = _videoContext->screenWidth;
-	_framebuffer.h = _videoContext->screenHeight;
-	_framebuffer.pitch = _videoContext->screenWidth;
-	_framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
-
 	return &_framebuffer;
 }
 






More information about the Scummvm-git-logs mailing list