aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/iphone
diff options
context:
space:
mode:
authorJohannes Schickel2013-08-07 12:24:59 -0700
committerJohannes Schickel2013-08-07 12:24:59 -0700
commit7f8308e0eb50c4e13ec0684619b5474983a93a66 (patch)
tree0a057f01385a11d99add1e294f70891a8e8bf6c9 /backends/platform/iphone
parent6e9390feb8166d5f9d6c6fdfe00a336b4f71de4c (diff)
parente5f0c42a65f38611272542a144228753e0496493 (diff)
downloadscummvm-rg350-7f8308e0eb50c4e13ec0684619b5474983a93a66.tar.gz
scummvm-rg350-7f8308e0eb50c4e13ec0684619b5474983a93a66.tar.bz2
scummvm-rg350-7f8308e0eb50c4e13ec0684619b5474983a93a66.zip
Merge pull request #365 from lordhoto/protected-pixels
Make Graphics::Surface::pixels protected.
Diffstat (limited to 'backends/platform/iphone')
-rw-r--r--backends/platform/iphone/iphone_video.mm6
-rw-r--r--backends/platform/iphone/osys_main.cpp2
-rw-r--r--backends/platform/iphone/osys_video.mm22
3 files changed, 15 insertions, 15 deletions
diff --git a/backends/platform/iphone/iphone_video.mm b/backends/platform/iphone/iphone_video.mm
index 0bfae30fc7..f2c1527658 100644
--- a/backends/platform/iphone/iphone_video.mm
+++ b/backends/platform/iphone/iphone_video.mm
@@ -365,7 +365,7 @@ const char *iPhone_getDocumentsDir() {
_mouseTexCoords[5] = _mouseTexCoords[7] = _videoContext.mouseHeight / (GLfloat)_videoContext.mouseTexture.h;
glBindTexture(GL_TEXTURE_2D, _mouseCursorTexture); printOpenGLError();
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _videoContext.mouseTexture.w, _videoContext.mouseTexture.h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _videoContext.mouseTexture.pixels); printOpenGLError();
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _videoContext.mouseTexture.w, _videoContext.mouseTexture.h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _videoContext.mouseTexture.getPixels()); printOpenGLError();
}
- (void)updateMainSurface {
@@ -377,7 +377,7 @@ const char *iPhone_getDocumentsDir() {
// Unfortunately we have to update the whole texture every frame, since glTexSubImage2D is actually slower in all cases
// due to the iPhone internals having to convert the whole texture back from its internal format when used.
// In the future we could use several tiled textures instead.
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _videoContext.screenTexture.w, _videoContext.screenTexture.h, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _videoContext.screenTexture.pixels); printOpenGLError();
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _videoContext.screenTexture.w, _videoContext.screenTexture.h, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _videoContext.screenTexture.getPixels()); printOpenGLError();
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
}
@@ -386,7 +386,7 @@ const char *iPhone_getDocumentsDir() {
glTexCoordPointer(2, GL_FLOAT, 0, _overlayTexCoords); printOpenGLError();
glBindTexture(GL_TEXTURE_2D, _overlayTexture); printOpenGLError();
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _videoContext.overlayTexture.w, _videoContext.overlayTexture.h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _videoContext.overlayTexture.pixels); printOpenGLError();
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _videoContext.overlayTexture.w, _videoContext.overlayTexture.h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _videoContext.overlayTexture.getPixels()); printOpenGLError();
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
}
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index 460d3fd2ac..ea566c3da0 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -78,7 +78,7 @@ OSystem_IPHONE::~OSystem_IPHONE() {
// Prevent accidental freeing of the screen texture here. This needs to be
// checked since we might use the screen texture as framebuffer in the case
// of hi-color games for example.
- if (_framebuffer.pixels == _videoContext->screenTexture.pixels)
+ if (_framebuffer.getPixels() == _videoContext->screenTexture.getPixels())
_framebuffer.free();
_mouseBuffer.free();
}
diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm
index a11bf32c54..ce7f94f5bd 100644
--- a/backends/platform/iphone/osys_video.mm
+++ b/backends/platform/iphone/osys_video.mm
@@ -76,8 +76,8 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm
// In case we use the screen texture as frame buffer we reset the pixels
// pointer here to avoid freeing the screen texture.
- if (_framebuffer.pixels == _videoContext->screenTexture.pixels)
- _framebuffer.pixels = 0;
+ if (_framebuffer.getPixels() == _videoContext->screenTexture.getPixels())
+ _framebuffer.setPixels(0);
// Create the screen texture right here. We need to do this here, since
// when a game requests hi-color mode, we actually set the framebuffer
@@ -310,7 +310,7 @@ void OSystem_IPHONE::hideOverlay() {
void OSystem_IPHONE::clearOverlay() {
//printf("clearOverlay()\n");
- bzero(_videoContext->overlayTexture.getBasePtr(0, 0), _videoContext->overlayTexture.h * _videoContext->overlayTexture.pitch);
+ bzero(_videoContext->overlayTexture.getPixels(), _videoContext->overlayTexture.h * _videoContext->overlayTexture.pitch);
dirtyFullOverlayScreen();
}
@@ -319,7 +319,7 @@ void OSystem_IPHONE::grabOverlay(void *buf, int pitch) {
int h = _videoContext->overlayHeight;
byte *dst = (byte *)buf;
- const byte *src = (const byte *)_videoContext->overlayTexture.getBasePtr(0, 0);
+ const byte *src = (const byte *)_videoContext->overlayTexture.getPixels();
do {
memcpy(dst, src, _videoContext->overlayWidth * sizeof(uint16));
src += _videoContext->overlayTexture.pitch;
@@ -417,7 +417,7 @@ void OSystem_IPHONE::setMouseCursor(const void *buf, uint w, uint h, int hotspot
#endif
assert(pixelFormat.bytesPerPixel == 1 || pixelFormat.bytesPerPixel == 2);
- if (_mouseBuffer.w != w || _mouseBuffer.h != h || _mouseBuffer.format != pixelFormat || !_mouseBuffer.pixels)
+ if (_mouseBuffer.w != w || _mouseBuffer.h != h || _mouseBuffer.format != pixelFormat || !_mouseBuffer.getPixels())
_mouseBuffer.create(w, h, pixelFormat);
_videoContext->mouseWidth = w;
@@ -428,7 +428,7 @@ void OSystem_IPHONE::setMouseCursor(const void *buf, uint w, uint h, int hotspot
_mouseKeyColor = keycolor;
- memcpy(_mouseBuffer.getBasePtr(0, 0), buf, h * _mouseBuffer.pitch);
+ memcpy(_mouseBuffer.getPixels(), buf, h * _mouseBuffer.pitch);
_mouseDirty = true;
_mouseNeedTextureUpdate = true;
@@ -464,7 +464,7 @@ void OSystem_IPHONE::updateMouseTexture() {
else
palette = _gamePaletteRGBA5551;
- uint16 *mouseBuf = (uint16 *)mouseTexture.getBasePtr(0, 0);
+ uint16 *mouseBuf = (uint16 *)mouseTexture.getPixels();
for (uint x = 0; x < _videoContext->mouseWidth; ++x) {
for (uint y = 0; y < _videoContext->mouseHeight; ++y) {
const byte color = *(const byte *)_mouseBuffer.getBasePtr(x, y);
@@ -475,12 +475,12 @@ void OSystem_IPHONE::updateMouseTexture() {
}
}
} else {
- if (crossBlit((byte *)mouseTexture.getBasePtr(0, 0), (const byte *)_mouseBuffer.getBasePtr(0, 0), mouseTexture.pitch,
+ if (crossBlit((byte *)mouseTexture.getPixels(), (const byte *)_mouseBuffer.getPixels(), mouseTexture.pitch,
_mouseBuffer.pitch, _mouseBuffer.w, _mouseBuffer.h, mouseTexture.format, _mouseBuffer.format)) {
if (!_mouseBuffer.format.aBits()) {
// Apply color keying since the original cursor had no alpha channel.
- const uint16 *src = (const uint16 *)_mouseBuffer.getBasePtr(0, 0);
- uint8 *dstRaw = (uint8 *)mouseTexture.getBasePtr(0, 0);
+ const uint16 *src = (const uint16 *)_mouseBuffer.getPixels();
+ uint8 *dstRaw = (uint8 *)mouseTexture.getPixels();
for (uint y = 0; y < _mouseBuffer.h; ++y, dstRaw += mouseTexture.pitch) {
uint16 *dst = (uint16 *)dstRaw;
@@ -495,7 +495,7 @@ void OSystem_IPHONE::updateMouseTexture() {
} else {
// TODO: Log this!
// Make the cursor all transparent... we really need a better fallback ;-).
- memset(mouseTexture.getBasePtr(0, 0), 0, mouseTexture.h * mouseTexture.pitch);
+ memset(mouseTexture.getPixels(), 0, mouseTexture.h * mouseTexture.pitch);
}
}