diff options
author | Neeraj Kumar | 2010-06-21 21:26:07 +0000 |
---|---|---|
committer | Neeraj Kumar | 2010-06-21 21:26:07 +0000 |
commit | e86f732a7b67b6df6d78000d0f34ca8013b93b46 (patch) | |
tree | 72df84399c652658fd010e4d0ab427e697fe56c3 /engines | |
parent | 6110f16b295e90e50042c7142a26115ef5b3a291 (diff) | |
download | scummvm-rg350-e86f732a7b67b6df6d78000d0f34ca8013b93b46.tar.gz scummvm-rg350-e86f732a7b67b6df6d78000d0f34ca8013b93b46.tar.bz2 scummvm-rg350-e86f732a7b67b6df6d78000d0f34ca8013b93b46.zip |
crash with 3x sacling with cursors of odd dimmensions
svn-id: r50123
Diffstat (limited to 'engines')
-rw-r--r-- | engines/testbed/graphics.cpp | 71 |
1 files changed, 47 insertions, 24 deletions
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp index 66a48837dc..41d22fc47a 100644 --- a/engines/testbed/graphics.cpp +++ b/engines/testbed/graphics.cpp @@ -24,24 +24,24 @@ GFXTestSuite::GFXTestSuite() { // Add tests here // Blitting buffer on screen - addTest("BlitBitmaps", &GFXtests::copyRectToScreen); + // addTest("BlitBitmaps", &GFXtests::copyRectToScreen); // GFX Transcations - addTest("FullScreenMode", &GFXtests::fullScreenMode); - addTest("AspectRatio", &GFXtests::aspectRatio); - addTest("IconifyingWindow", &GFXtests::iconifyWindow); + // addTest("FullScreenMode", &GFXtests::fullScreenMode); + // addTest("AspectRatio", &GFXtests::aspectRatio); + // addTest("IconifyingWindow", &GFXtests::iconifyWindow); // Mouse Layer tests (Palettes and movements) - addTest("PalettizedCursors", &GFXtests::palettizedCursors); + // addTest("PalettizedCursors", &GFXtests::palettizedCursors); // FIXME: need to fix it addTest("ScaledCursors", &GFXtests::scaledCursors); // Effects - addTest("shakingEffect", &GFXtests::shakingEffect); - addTest("focusRectangle", &GFXtests::focusRectangle); + // addTest("shakingEffect", &GFXtests::shakingEffect); + // addTest("focusRectangle", &GFXtests::focusRectangle); // TODO: unable to notice any change, make it noticable - addTest("Overlays", &GFXtests::overlayGraphics); + // addTest("Overlays", &GFXtests::overlayGraphics); } const char *GFXTestSuite::getName() const { @@ -71,17 +71,26 @@ void GFXtests::initMousePalette() { void GFXtests::drawCursor(bool cursorPaletteDisabled, const char *gfxModeName, int cursorTargetScale) { - // Paint the mouse with yellow - byte buffer[11][11]; - memset(&buffer[0][0], 2, sizeof(buffer)); + // Buffer initialized with yellow color + byte buffer[500]; + memset(buffer, 2, sizeof(buffer)); - // Mark the hotspot with black - for (int i = 0; i < 11; i++) { - buffer[i][i] = 0; - // buffer[10 - i][i] = 0; - } + /* Disable HotSpot highlighting as of now - CursorMan.replaceCursor(&buffer[0][0], 11, 11, 0, 0, 255, cursorTargetScale); + // Paint the cursor with yellow, except the hotspot + for (int i = 0; i < 16; i++) { + for (int j = 0; j < 16; j++) { + if (i != j && i != 15 - j) { + buffer[i * 16 + j] = 2; + } + } + } + + */ + + // Uncommenting the next line and commenting the line after that would reproduce the crash + // CursorMan.replaceCursor(buffer, 11, 11, 0, 0, 255, cursorTargetScale); + CursorMan.replaceCursor(buffer, 12, 12, 0, 0, 255, cursorTargetScale); CursorMan.showMouse(true); if (cursorPaletteDisabled) { @@ -486,7 +495,6 @@ bool GFXtests::iconifyWindow() { bool GFXtests::scaledCursors() { - // TODO : Understand and fix the problem relating scaled cursors Testsuite::displayMessage("Testing : Scaled cursors\n" "Here every graphics mode is tried with a cursorTargetScale of 1,2 and 3" "This may take time, You may skip the later scalers and just examine the first three i.e 1x,2x and 3x"); @@ -495,19 +503,22 @@ bool GFXtests::scaledCursors() { if (!Testsuite::handleInteractiveInput("Do you want to restrict scalers to 1x, 2x and 3x only?", "Yes", "No", kOptionRight)) { maxLimit = 3; } - + + const int currGFXMode = g_system->getGraphicsMode(); const OSystem::GraphicsMode *gfxMode = g_system->getSupportedGraphicsModes(); while (gfxMode->name && maxLimit > 0) { // for every graphics mode display cursors for cursorTargetScale 1, 2 and 3 // Switch Graphics mode - // FIXME: Doesn't works: + // FIXME: Crashes with "3x" mode now.: g_system->beginGFXTransaction(); - bool isGFXModeSet = g_system->setGraphicsMode("2x"); + + bool isGFXModeSet = g_system->setGraphicsMode(gfxMode->id); g_system->initSize(320, 200); - g_system->endGFXTransaction(); + + OSystem::TransactionError gfxError = g_system->endGFXTransaction(); - if (isGFXModeSet) { + if (gfxError == OSystem::kTransactionSuccess && isGFXModeSet) { setupMouseLoop(false, gfxMode->name, 1); Testsuite::clearScreen(); @@ -519,12 +530,24 @@ bool GFXtests::scaledCursors() { Testsuite::clearScreen(); } else { - printf("Switching to graphics mode %s failed\n", gfxMode->name); + printf("LOG: Switching to graphics mode %s failed\n", gfxMode->name); + return false; } gfxMode++; maxLimit--; } + // Restore Original State + g_system->beginGFXTransaction(); + bool isGFXModeSet = g_system->setGraphicsMode(currGFXMode); + g_system->initSize(320, 200); + OSystem::TransactionError gfxError = g_system->endGFXTransaction(); + + if (gfxError != OSystem::kTransactionSuccess || !isGFXModeSet) { + printf("LOG: Switcing to initial state failed\n"); + return false; + } + return true; } |