From 1d3be279fce1f9af7e4db3ec1e8b3b9e18acb419 Mon Sep 17 00:00:00 2001 From: Oystein Eftevaag Date: Sat, 4 Jun 2011 23:34:12 -0400 Subject: IPHONE: Fixed a COMI crash and some minor gfx glitches --- backends/platform/iphone/iphone_video.h | 1 + backends/platform/iphone/iphone_video.m | 18 ++++++++++++------ backends/platform/iphone/osys_video.cpp | 3 ++- 3 files changed, 15 insertions(+), 7 deletions(-) (limited to 'backends/platform/iphone') diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h index 8e0ffc19cb..223f025978 100644 --- a/backends/platform/iphone/iphone_video.h +++ b/backends/platform/iphone/iphone_video.h @@ -67,6 +67,7 @@ - (void)updateMainSurface; - (void)updateOverlaySurface; - (void)updateMouseSurface; +- (void)clearColorBuffer; -(void)updateMouseCursor; diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m index 006603df64..04d25cebf8 100644 --- a/backends/platform/iphone/iphone_video.m +++ b/backends/platform/iphone/iphone_video.m @@ -85,6 +85,8 @@ void iPhone_setMouseCursor(short* buffer, int width, int height) { void iPhone_enableOverlay(int state) { _overlayIsEnabled = state; + + [sharedInstance performSelectorOnMainThread:@selector(clearColorBuffer) withObject:nil waitUntilDone: YES]; } int iPhone_getScreenHeight() { @@ -478,12 +480,7 @@ bool getLocalMouseCoords(CGPoint *point) { glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError(); - // The color buffer is triple-buffered, so we clear it multiple times right away to avid doing any glClears later. - int clearCount = 5; - while (clearCount-- > 0) { - glClear(GL_COLOR_BUFFER_BIT); printOpenGLError(); - [_context presentRenderbuffer:GL_RENDERBUFFER_OES]; - } + [self clearColorBuffer]; if (_keyboardView != nil) { [_keyboardView removeFromSuperview]; @@ -535,6 +532,15 @@ bool getLocalMouseCoords(CGPoint *point) { } } +- (void)clearColorBuffer { + // The color buffer is triple-buffered, so we clear it multiple times right away to avid doing any glClears later. + int clearCount = 5; + while (clearCount-- > 0) { + glClear(GL_COLOR_BUFFER_BIT); printOpenGLError(); + [_context presentRenderbuffer:GL_RENDERBUFFER_OES]; + } +} + - (id)getEvent { if (_events == nil || [_events count] == 0) { return nil; diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp index 263cbd2bcc..fa425b108a 100644 --- a/backends/platform/iphone/osys_video.cpp +++ b/backends/platform/iphone/osys_video.cpp @@ -349,6 +349,7 @@ void OSystem_IPHONE::showOverlay() { //printf("showOverlay()\n"); _overlayVisible = true; dirtyFullOverlayScreen(); + updateScreen(); iPhone_enableOverlay(true); } @@ -368,7 +369,7 @@ void OSystem_IPHONE::clearOverlay() { void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) { //printf("grabOverlay()\n"); - int h = _screenHeight; + int h = _overlayHeight; OverlayColor *src = _overlayBuffer; do { -- cgit v1.2.3