IPHONE: Directly use the overlay's texture buffer instead of another intermediate buffer.
This commit is contained in:
parent
2ab5958c93
commit
8edcedf3b6
3 changed files with 14 additions and 36 deletions
|
@ -61,7 +61,7 @@ OSystem_IPHONE::OSystem_IPHONE() :
|
||||||
_screenOrientation(kScreenOrientationFlippedLandscape), _mouseClickAndDragEnabled(false),
|
_screenOrientation(kScreenOrientationFlippedLandscape), _mouseClickAndDragEnabled(false),
|
||||||
_gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false), _fullScreenOverlayIsDirty(false),
|
_gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false), _fullScreenOverlayIsDirty(false),
|
||||||
_mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0),
|
_mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0),
|
||||||
_overlayBuffer(0), _mouseCursorPaletteEnabled(false) {
|
_mouseCursorPaletteEnabled(false) {
|
||||||
_queuedInputEvent.type = Common::EVENT_INVALID;
|
_queuedInputEvent.type = Common::EVENT_INVALID;
|
||||||
_touchpadModeEnabled = !iPhone_isHighResDevice();
|
_touchpadModeEnabled = !iPhone_isHighResDevice();
|
||||||
_fsFactory = new POSIXFilesystemFactory();
|
_fsFactory = new POSIXFilesystemFactory();
|
||||||
|
|
|
@ -65,7 +65,6 @@ protected:
|
||||||
|
|
||||||
Graphics::Surface _framebuffer;
|
Graphics::Surface _framebuffer;
|
||||||
byte *_gameScreenRaw;
|
byte *_gameScreenRaw;
|
||||||
OverlayColor *_overlayBuffer;
|
|
||||||
|
|
||||||
uint16 *_gameScreenConverted;
|
uint16 *_gameScreenConverted;
|
||||||
|
|
||||||
|
@ -191,7 +190,6 @@ protected:
|
||||||
void dirtyFullOverlayScreen();
|
void dirtyFullOverlayScreen();
|
||||||
void suspendLoop();
|
void suspendLoop();
|
||||||
void drawDirtyRect(const Common::Rect &dirtyRect);
|
void drawDirtyRect(const Common::Rect &dirtyRect);
|
||||||
void drawDirtyOverlayRect(const Common::Rect &dirtyRect);
|
|
||||||
void updateHardwareSurfaceForRect(const Common::Rect &updatedRect);
|
void updateHardwareSurfaceForRect(const Common::Rect &updatedRect);
|
||||||
void updateMouseTexture();
|
void updateMouseTexture();
|
||||||
static void AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB);
|
static void AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB);
|
||||||
|
|
|
@ -68,10 +68,7 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm
|
||||||
_gameScreenRaw = (byte *)malloc(width * height);
|
_gameScreenRaw = (byte *)malloc(width * height);
|
||||||
bzero(_gameScreenRaw, width * height);
|
bzero(_gameScreenRaw, width * height);
|
||||||
|
|
||||||
//free(_overlayBuffer);
|
|
||||||
|
|
||||||
int fullSize = _videoContext->screenWidth * _videoContext->screenHeight * sizeof(OverlayColor);
|
int fullSize = _videoContext->screenWidth * _videoContext->screenHeight * sizeof(OverlayColor);
|
||||||
//_overlayBuffer = (OverlayColor *)malloc(fullSize);
|
|
||||||
|
|
||||||
free(_gameScreenConverted);
|
free(_gameScreenConverted);
|
||||||
|
|
||||||
|
@ -80,11 +77,6 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm
|
||||||
|
|
||||||
updateOutputSurface();
|
updateOutputSurface();
|
||||||
|
|
||||||
if (_overlayBuffer == NULL) {
|
|
||||||
printf("Overlay: (%u x %u)\n", _videoContext->overlayWidth, _videoContext->overlayHeight);
|
|
||||||
_overlayBuffer = new OverlayColor[_videoContext->overlayHeight * _videoContext->overlayWidth];
|
|
||||||
}
|
|
||||||
|
|
||||||
clearOverlay();
|
clearOverlay();
|
||||||
|
|
||||||
_fullScreenIsDirty = false;
|
_fullScreenIsDirty = false;
|
||||||
|
@ -203,12 +195,14 @@ void OSystem_IPHONE::internUpdateScreen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_videoContext->overlayVisible) {
|
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);
|
Common::Rect dirtyRect = _dirtyOverlayRects.remove_at(_dirtyOverlayRects.size() - 1);
|
||||||
|
|
||||||
//printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
|
//printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
|
||||||
drawDirtyOverlayRect(dirtyRect);
|
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) {
|
void OSystem_IPHONE::updateHardwareSurfaceForRect(const Common::Rect &updatedRect) {
|
||||||
const int x1 = updatedRect.left;
|
const int x1 = updatedRect.left;
|
||||||
const int y1 = updatedRect.top;
|
const int y1 = updatedRect.top;
|
||||||
|
@ -290,18 +274,18 @@ void OSystem_IPHONE::hideOverlay() {
|
||||||
|
|
||||||
void OSystem_IPHONE::clearOverlay() {
|
void OSystem_IPHONE::clearOverlay() {
|
||||||
//printf("clearOverlay()\n");
|
//printf("clearOverlay()\n");
|
||||||
bzero(_overlayBuffer, _videoContext->overlayWidth * _videoContext->overlayHeight * sizeof(OverlayColor));
|
bzero(_videoContext->overlayTexture.getBasePtr(0, 0), _videoContext->overlayTexture.h * _videoContext->overlayTexture.pitch);
|
||||||
dirtyFullOverlayScreen();
|
dirtyFullOverlayScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) {
|
void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) {
|
||||||
//printf("grabOverlay()\n");
|
//printf("grabOverlay()\n");
|
||||||
int h = _videoContext->overlayHeight;
|
int h = _videoContext->overlayHeight;
|
||||||
OverlayColor *src = _overlayBuffer;
|
|
||||||
|
|
||||||
|
const byte *src = (const byte *)_videoContext->overlayTexture.getBasePtr(0, 0);
|
||||||
do {
|
do {
|
||||||
memcpy(buf, src, _videoContext->overlayWidth * sizeof(OverlayColor));
|
memcpy(buf, src, _videoContext->overlayWidth * sizeof(OverlayColor));
|
||||||
src += _videoContext->overlayWidth;
|
src += _videoContext->overlayTexture.pitch;
|
||||||
buf += pitch;
|
buf += pitch;
|
||||||
} while (--h);
|
} 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));
|
_dirtyOverlayRects.push_back(Common::Rect(x, y, x + w, y + h));
|
||||||
}
|
}
|
||||||
|
|
||||||
OverlayColor *dst = _overlayBuffer + (y * _videoContext->overlayWidth + x);
|
byte *dst = (byte *)_videoContext->overlayTexture.getBasePtr(x, y);
|
||||||
if ((int)_videoContext->overlayWidth == pitch && pitch == w)
|
|
||||||
memcpy(dst, buf, h * w * sizeof(OverlayColor));
|
|
||||||
else {
|
|
||||||
do {
|
do {
|
||||||
memcpy(dst, buf, w * sizeof(OverlayColor));
|
memcpy(dst, buf, w * sizeof(OverlayColor));
|
||||||
buf += pitch;
|
buf += pitch;
|
||||||
dst += _videoContext->overlayWidth;
|
dst += _videoContext->overlayTexture.pitch;
|
||||||
} while (--h);
|
} while (--h);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 OSystem_IPHONE::getOverlayHeight() {
|
int16 OSystem_IPHONE::getOverlayHeight() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue