aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2012-02-23 21:34:12 +0100
committerJohannes Schickel2012-02-23 21:34:12 +0100
commit8edcedf3b65965df6ade9899a7a07855cf51195c (patch)
tree0605312a069e9021883d115478c85b589405b518
parent2ab5958c93c19a0ea23b76c2360ca8ef4d905b94 (diff)
downloadscummvm-rg350-8edcedf3b65965df6ade9899a7a07855cf51195c.tar.gz
scummvm-rg350-8edcedf3b65965df6ade9899a7a07855cf51195c.tar.bz2
scummvm-rg350-8edcedf3b65965df6ade9899a7a07855cf51195c.zip
IPHONE: Directly use the overlay's texture buffer instead of another intermediate buffer.
-rw-r--r--backends/platform/iphone/osys_main.cpp2
-rw-r--r--backends/platform/iphone/osys_main.h2
-rw-r--r--backends/platform/iphone/osys_video.mm46
3 files changed, 14 insertions, 36 deletions
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index 368434c476..e2de6ca478 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -61,7 +61,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),
- _overlayBuffer(0), _mouseCursorPaletteEnabled(false) {
+ _mouseCursorPaletteEnabled(false) {
_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 39395ac99a..8b1365af30 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -65,7 +65,6 @@ protected:
Graphics::Surface _framebuffer;
byte *_gameScreenRaw;
- OverlayColor *_overlayBuffer;
uint16 *_gameScreenConverted;
@@ -191,7 +190,6 @@ protected:
void dirtyFullOverlayScreen();
void suspendLoop();
void drawDirtyRect(const Common::Rect &dirtyRect);
- void drawDirtyOverlayRect(const Common::Rect &dirtyRect);
void updateHardwareSurfaceForRect(const Common::Rect &updatedRect);
void updateMouseTexture();
static void AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB);
diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm
index 45f62377d4..8fc9535717 100644
--- a/backends/platform/iphone/osys_video.mm
+++ b/backends/platform/iphone/osys_video.mm
@@ -68,10 +68,7 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm
_gameScreenRaw = (byte *)malloc(width * height);
bzero(_gameScreenRaw, width * height);
- //free(_overlayBuffer);
-
int fullSize = _videoContext->screenWidth * _videoContext->screenHeight * sizeof(OverlayColor);
- //_overlayBuffer = (OverlayColor *)malloc(fullSize);
free(_gameScreenConverted);
@@ -80,11 +77,6 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm
updateOutputSurface();
- if (_overlayBuffer == NULL) {
- printf("Overlay: (%u x %u)\n", _videoContext->overlayWidth, _videoContext->overlayHeight);
- _overlayBuffer = new OverlayColor[_videoContext->overlayHeight * _videoContext->overlayWidth];
- }
-
clearOverlay();
_fullScreenIsDirty = false;
@@ -203,12 +195,14 @@ void OSystem_IPHONE::internUpdateScreen() {
}
if (_videoContext->overlayVisible) {
- while (_dirtyOverlayRects.size()) {
+ // TODO: Implement dirty rect code
+ _dirtyOverlayRects.clear();
+ /*while (_dirtyOverlayRects.size()) {
Common::Rect dirtyRect = _dirtyOverlayRects.remove_at(_dirtyOverlayRects.size() - 1);
//printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
drawDirtyOverlayRect(dirtyRect);
- }
+ }*/
}
}
@@ -227,16 +221,6 @@ void OSystem_IPHONE::drawDirtyRect(const Common::Rect &dirtyRect) {
}
}
-void OSystem_IPHONE::drawDirtyOverlayRect(const Common::Rect &dirtyRect) {
- const int x1 = dirtyRect.left;
- const int y1 = dirtyRect.top;
- const int x2 = dirtyRect.right;
- const int y2 = dirtyRect.bottom;
-
- for (int y = y1; y < y2; ++y)
- memcpy(_videoContext->overlayTexture.getBasePtr(x1, y), &_overlayBuffer[y * _videoContext->overlayWidth + x1], (x2 - x1) * 2);
-}
-
void OSystem_IPHONE::updateHardwareSurfaceForRect(const Common::Rect &updatedRect) {
const int x1 = updatedRect.left;
const int y1 = updatedRect.top;
@@ -290,18 +274,18 @@ void OSystem_IPHONE::hideOverlay() {
void OSystem_IPHONE::clearOverlay() {
//printf("clearOverlay()\n");
- bzero(_overlayBuffer, _videoContext->overlayWidth * _videoContext->overlayHeight * sizeof(OverlayColor));
+ bzero(_videoContext->overlayTexture.getBasePtr(0, 0), _videoContext->overlayTexture.h * _videoContext->overlayTexture.pitch);
dirtyFullOverlayScreen();
}
void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) {
//printf("grabOverlay()\n");
int h = _videoContext->overlayHeight;
- OverlayColor *src = _overlayBuffer;
+ const byte *src = (const byte *)_videoContext->overlayTexture.getBasePtr(0, 0);
do {
memcpy(buf, src, _videoContext->overlayWidth * sizeof(OverlayColor));
- src += _videoContext->overlayWidth;
+ src += _videoContext->overlayTexture.pitch;
buf += pitch;
} while (--h);
}
@@ -335,16 +319,12 @@ void OSystem_IPHONE::copyRectToOverlay(const OverlayColor *buf, int pitch, int x
_dirtyOverlayRects.push_back(Common::Rect(x, y, x + w, y + h));
}
- OverlayColor *dst = _overlayBuffer + (y * _videoContext->overlayWidth + x);
- if ((int)_videoContext->overlayWidth == pitch && pitch == w)
- memcpy(dst, buf, h * w * sizeof(OverlayColor));
- else {
- do {
- memcpy(dst, buf, w * sizeof(OverlayColor));
- buf += pitch;
- dst += _videoContext->overlayWidth;
- } while (--h);
- }
+ byte *dst = (byte *)_videoContext->overlayTexture.getBasePtr(x, y);
+ do {
+ memcpy(dst, buf, w * sizeof(OverlayColor));
+ buf += pitch;
+ dst += _videoContext->overlayTexture.pitch;
+ } while (--h);
}
int16 OSystem_IPHONE::getOverlayHeight() {