aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2013-08-14 02:37:19 +0200
committerJohannes Schickel2013-08-16 05:34:44 +0200
commit764a34edf74813d703f81c48778bd4494079f49f (patch)
treed572abc38cab8fb19c85040a6d3150eee268915e
parent67137434416df22f5e75cd29d94c8a9fa195ed66 (diff)
downloadscummvm-rg350-764a34edf74813d703f81c48778bd4494079f49f.tar.gz
scummvm-rg350-764a34edf74813d703f81c48778bd4494079f49f.tar.bz2
scummvm-rg350-764a34edf74813d703f81c48778bd4494079f49f.zip
TESTBED: Make code agonstic to OverlayColor.
-rw-r--r--engines/testbed/graphics.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index 590e6c6d81..26e073d407 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -927,17 +927,29 @@ TestExitStatus GFXtests::overlayGraphics() {
Graphics::PixelFormat pf = g_system->getOverlayFormat();
- OverlayColor buffer[50 * 100];
- OverlayColor value = pf.RGBToColor(0, 255, 0);
+ byte *buffer = new byte[50 * 100 * pf.bytesPerPixel];
+ const uint32 value = pf.RGBToColor(0, 255, 0);
- for (int i = 0; i < 50 * 100; i++) {
- buffer[i] = value;
+ if (pf.bytesPerPixel == 2) {
+ uint16 *dst = (uint16 *)buffer;
+ for (int i = 50 * 100; i > 0; --i) {
+ *dst++ = value;
+ }
+ } else if (pf.bytesPerPixel == 4) {
+ uint32 *dst = (uint32 *)buffer;
+ for (int i = 50 * 100; i > 0; --i) {
+ *dst++ = value;
+ }
+ } else {
+ error("GFXtests::overlayGraphics: Unsupported color depth: %d", pf.bytesPerPixel);
}
g_system->showOverlay();
- g_system->copyRectToOverlay(buffer, 200, 270, 175, 100, 50);
+ g_system->copyRectToOverlay(buffer, 100 * pf.bytesPerPixel, 270, 175, 100, 50);
g_system->updateScreen();
+ delete[] buffer;
+
g_system->delayMillis(1000);
g_system->hideOverlay();