TESTBED: Make code agonstic to OverlayColor.
This commit is contained in:
parent
6713743441
commit
764a34edf7
1 changed files with 17 additions and 5 deletions
|
@ -927,17 +927,29 @@ TestExitStatus GFXtests::overlayGraphics() {
|
||||||
|
|
||||||
Graphics::PixelFormat pf = g_system->getOverlayFormat();
|
Graphics::PixelFormat pf = g_system->getOverlayFormat();
|
||||||
|
|
||||||
OverlayColor buffer[50 * 100];
|
byte *buffer = new byte[50 * 100 * pf.bytesPerPixel];
|
||||||
OverlayColor value = pf.RGBToColor(0, 255, 0);
|
const uint32 value = pf.RGBToColor(0, 255, 0);
|
||||||
|
|
||||||
for (int i = 0; i < 50 * 100; i++) {
|
if (pf.bytesPerPixel == 2) {
|
||||||
buffer[i] = value;
|
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->showOverlay();
|
||||||
g_system->copyRectToOverlay(buffer, 200, 270, 175, 100, 50);
|
g_system->copyRectToOverlay(buffer, 100 * pf.bytesPerPixel, 270, 175, 100, 50);
|
||||||
g_system->updateScreen();
|
g_system->updateScreen();
|
||||||
|
|
||||||
|
delete[] buffer;
|
||||||
|
|
||||||
g_system->delayMillis(1000);
|
g_system->delayMillis(1000);
|
||||||
|
|
||||||
g_system->hideOverlay();
|
g_system->hideOverlay();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue