Skip to content

Commit

Permalink
IPHONE: Implement very basic GFX transaction support.
Browse files Browse the repository at this point in the history
This allows for AR ratio correction changes to take place, even when the AR
setting is set after initSize for example.
  • Loading branch information
Johannes Schickel committed Feb 25, 2012
1 parent 273df3c commit 97e486d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions backends/platform/iphone/osys_main.h
Expand Up @@ -121,6 +121,10 @@ class OSystem_IPHONE : public EventsBaseBackend, public PaletteManager {
virtual bool setGraphicsMode(int mode);
virtual int getGraphicsMode() const;
virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format);

virtual void beginGFXTransaction();
virtual TransactionError endGFXTransaction();

virtual int16 getHeight();
virtual int16 getWidth();

Expand Down
17 changes: 10 additions & 7 deletions backends/platform/iphone/osys_video.mm
Expand Up @@ -44,7 +44,6 @@
case kGraphicsModeNone:
case kGraphicsModeLinear:
_videoContext->graphicsMode = (GraphicsModes)mode;
[g_iPhoneViewInstance performSelectorOnMainThread:@selector(setGraphicsMode) withObject:nil waitUntilDone: YES];
return true;

default:
Expand All @@ -68,17 +67,21 @@
_gameScreenRaw = (byte *)malloc(width * height);
bzero(_gameScreenRaw, width * height);

updateOutputSurface();

clearOverlay();

_fullScreenIsDirty = false;
dirtyFullScreen();
_videoContext->mouseIsVisible = false;
_mouseCursorPaletteEnabled = false;
}

void OSystem_IPHONE::beginGFXTransaction() {
}

OSystem::TransactionError OSystem_IPHONE::endGFXTransaction() {
_screenChangeCount++;
updateOutputSurface();
[g_iPhoneViewInstance performSelectorOnMainThread:@selector(setGraphicsMode) withObject:nil waitUntilDone: YES];

updateScreen();
// TODO: Can we return better error codes?
return kTransactionSuccess;
}

void OSystem_IPHONE::updateOutputSurface() {
Expand Down

0 comments on commit 97e486d

Please sign in to comment.