aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/opengl
diff options
context:
space:
mode:
authorJohannes Schickel2012-06-16 04:17:14 +0200
committerJohannes Schickel2012-06-16 04:17:14 +0200
commitaec9b9e22a9bff54ae3c39bb796bae0f4b4c2d95 (patch)
tree94d1ddb5cf823bb08d86161f9e5415c54011a0ea /backends/graphics/opengl
parent99229fc7ab3a15da8b964443cb58bc00caa5f0a4 (diff)
downloadscummvm-rg350-aec9b9e22a9bff54ae3c39bb796bae0f4b4c2d95.tar.gz
scummvm-rg350-aec9b9e22a9bff54ae3c39bb796bae0f4b4c2d95.tar.bz2
scummvm-rg350-aec9b9e22a9bff54ae3c39bb796bae0f4b4c2d95.zip
ALL: Let overlay related methods in OSystem take a void * and use a proper pitch values.
This is a first step to get rid of OverlayColor, which is a requirement for proper 4Bpp overlay support.
Diffstat (limited to 'backends/graphics/opengl')
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp19
-rw-r--r--backends/graphics/opengl/opengl-graphics.h4
2 files changed, 12 insertions, 11 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index ed63916551..dce902d894 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -467,33 +467,35 @@ void OpenGLGraphicsManager::clearOverlay() {
_overlayNeedsRedraw = true;
}
-void OpenGLGraphicsManager::grabOverlay(OverlayColor *buf, int pitch) {
- assert(_overlayData.format.bytesPerPixel == sizeof(buf[0]));
+void OpenGLGraphicsManager::grabOverlay(void *buf, int pitch) {
const byte *src = (byte *)_overlayData.pixels;
+ byte *dst = (byte *)buf;
for (int i = 0; i < _overlayData.h; i++) {
// Copy overlay data to buffer
- memcpy(buf, src, _overlayData.pitch);
- buf += pitch;
+ memcpy(dst, src, _overlayData.pitch);
+ dst += pitch;
src += _overlayData.pitch;
}
}
-void OpenGLGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+void OpenGLGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
assert(_transactionMode == kTransactionNone);
if (_overlayTexture == NULL)
return;
+ const byte *src = (const byte *)buf;
+
// Clip the coordinates
if (x < 0) {
w += x;
- buf -= x;
+ src -= x * 2;
x = 0;
}
if (y < 0) {
h += y;
- buf -= y * pitch;
+ src -= y * pitch;
y = 0;
}
@@ -507,11 +509,10 @@ void OpenGLGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch
return;
// Copy buffer data to internal overlay surface
- const byte *src = (const byte *)buf;
byte *dst = (byte *)_overlayData.pixels + y * _overlayData.pitch;
for (int i = 0; i < h; i++) {
memcpy(dst + x * _overlayData.format.bytesPerPixel, src, w * _overlayData.format.bytesPerPixel);
- src += pitch * sizeof(buf[0]);
+ src += pitch;
dst += _overlayData.pitch;
}
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index b2f78187dc..9d8d418d11 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -97,8 +97,8 @@ public:
virtual void hideOverlay();
virtual Graphics::PixelFormat getOverlayFormat() const;
virtual void clearOverlay();
- virtual void grabOverlay(OverlayColor *buf, int pitch);
- virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
+ virtual void grabOverlay(void *buf, int pitch);
+ virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
virtual int16 getOverlayHeight();
virtual int16 getOverlayWidth();