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

lordhoto lordhoto at gmail.com
Wed Feb 29 19:07:03 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:
aad85d957c IPHONE: Fall back to CLUT8 in case a non-supported screen mode is set up.


Commit: aad85d957c86ec77f7974e983dbbdb40a4aa4f4c
    https://github.com/scummvm/scummvm/commit/aad85d957c86ec77f7974e983dbbdb40a4aa4f4c
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-29T10:05:43-08:00

Commit Message:
IPHONE: Fall back to CLUT8 in case a non-supported screen mode is set up.

This makes the iPhone backend conform with the 16bpp API and thus no longer
causes assertions to fail in case the client code tries to set up an
unsupported game screen format.

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 f3e0d97..9a33cd8 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -60,7 +60,7 @@ OSystem_IPHONE::OSystem_IPHONE() :
 	_screenOrientation(kScreenOrientationFlippedLandscape), _mouseClickAndDragEnabled(false),
 	_gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false), _fullScreenOverlayIsDirty(false),
 	_mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0),
-	_mouseCursorPaletteEnabled(false) {
+	_mouseCursorPaletteEnabled(false), _gfxTransactionError(kTransactionSuccess) {
 	_queuedInputEvent.type = Common::EVENT_INVALID;
 	_touchpadModeEnabled = !iPhone_isHighResDevice();
 	_fsFactory = new POSIXFilesystemFactory();
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index 5d0f60c..b443e22 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -65,6 +65,9 @@ protected:
 
 	Graphics::Surface _framebuffer;
 
+	// For signaling that screen format set up might have failed.
+	TransactionError _gfxTransactionError;
+
 	// For use with the game texture
 	uint16  _gamePalette[256];
 	// For use with the mouse texture
diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm
index 2b5e78b..6f80a6c 100644
--- a/backends/platform/iphone/osys_video.mm
+++ b/backends/platform/iphone/osys_video.mm
@@ -84,6 +84,13 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm
 	// to the texture buffer to avoid an additional copy step.
 	[g_iPhoneViewInstance performSelectorOnMainThread:@selector(createScreenTexture) withObject:nil waitUntilDone: YES];
 
+	// In case the client code tries to set up a non supported mode, we will
+	// fall back to CLUT8 and set the transaction error accordingly.
+	if (format && format->bytesPerPixel != 1 && *format != _videoContext->screenTexture.format) {
+		format = 0;
+		_gfxTransactionError = kTransactionFormatNotSupported;
+	}
+
 	if (!format || format->bytesPerPixel == 1) {
 		_framebuffer.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
 	} else {
@@ -92,7 +99,6 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm
 		       format->rLoss, format->gLoss, format->bLoss, format->aLoss,
 		       format->rShift, format->gShift, format->bShift, format->aShift);
 #endif
-		assert(_videoContext->screenTexture.format == *format);
 		// We directly draw on the screen texture in hi-color mode. Thus
 		// we copy over its settings here and just replace the width and
 		// height to avoid any problems.
@@ -107,6 +113,7 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm
 }
 
 void OSystem_IPHONE::beginGFXTransaction() {
+	_gfxTransactionError = kTransactionSuccess;
 }
 
 OSystem::TransactionError OSystem_IPHONE::endGFXTransaction() {
@@ -114,8 +121,7 @@ OSystem::TransactionError OSystem_IPHONE::endGFXTransaction() {
 	updateOutputSurface();
 	[g_iPhoneViewInstance performSelectorOnMainThread:@selector(setGraphicsMode) withObject:nil waitUntilDone: YES];
 
-	// TODO: Can we return better error codes?
-	return kTransactionSuccess;
+	return _gfxTransactionError;
 }
 
 void OSystem_IPHONE::updateOutputSurface() {






More information about the Scummvm-git-logs mailing list