aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/iphone/osys_video.mm
diff options
context:
space:
mode:
authorJohannes Schickel2012-02-23 21:34:12 +0100
committerJohannes Schickel2012-02-23 21:34:12 +0100
commit8edcedf3b65965df6ade9899a7a07855cf51195c (patch)
tree0605312a069e9021883d115478c85b589405b518 /backends/platform/iphone/osys_video.mm
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.
Diffstat (limited to 'backends/platform/iphone/osys_video.mm')
-rw-r--r--backends/platform/iphone/osys_video.mm46
1 files changed, 13 insertions, 33 deletions
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() {