diff options
author | yinsimei | 2017-05-29 10:27:23 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2017-07-13 18:27:45 +0200 |
commit | 6e5dec313788be6ac3083e9d3ca30a9b66243894 (patch) | |
tree | 5d2e850b46faeb045690ed3f25566cec9a3c7b20 /engines | |
parent | ca2ee02496f232a53ed6c96bd296e0941da636f6 (diff) | |
download | scummvm-rg350-6e5dec313788be6ac3083e9d3ca30a9b66243894.tar.gz scummvm-rg350-6e5dec313788be6ac3083e9d3ca30a9b66243894.tar.bz2 scummvm-rg350-6e5dec313788be6ac3083e9d3ca30a9b66243894.zip |
SLUDGE: Fix png displaying
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sludge/backdrop.cpp | 12 | ||||
-rw-r--r-- | engines/sludge/main_loop.cpp | 3 |
2 files changed, 12 insertions, 3 deletions
diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp index 7fecf573d6..ff24e1ba78 100644 --- a/engines/sludge/backdrop.cpp +++ b/engines/sludge/backdrop.cpp @@ -58,6 +58,7 @@ #include "common/debug.h" #include "image/png.h" #include "graphics/surface.h" +#include "graphics/palette.h" #include "sludge.h" namespace Sludge { @@ -81,6 +82,7 @@ GLuint snapshotTextureName = 0; Graphics::Surface backdropSurface; + float snapTexW = 1.0; float snapTexH = 1.0; @@ -1017,6 +1019,8 @@ bool loadPng(int &picWidth, int &picHeight, int &realPicWidth, return false; } backdropSurface.copyFrom(*(png.getSurface())); + const byte *palette = png.getPalette(); + g_system->getPaletteManager()->setPalette(palette, 0, 256); picWidth = realPicWidth = backdropSurface.w; picHeight = realPicHeight = backdropSurface.h; return true; @@ -1137,11 +1141,12 @@ bool loadByteArray(int &picWidth, int &picHeight, int &realPicWidth, bool loadImage(int &picWidth, int &picHeight, int &realPicWidth, int &realPicHeight, Common::SeekableReadStream *stream, int x, int y, bool reserve) { - debug(kSludgeDebugGraphics, "Loading back drop image."); + debug(kSludgeDebugGraphics, "Loading back drop image at file position: %i", stream->pos()); if (!loadPng(picWidth, picHeight, realPicWidth, realPicHeight, stream, reserve)) { if (!loadByteArray(picWidth, picHeight, realPicWidth, realPicHeight, stream, reserve)) { + debug(kSludgeDebugGraphics, "Back drop loading failed"); return false; } } @@ -1151,9 +1156,10 @@ bool loadImage(int &picWidth, int &picHeight, int &realPicWidth, if (y == IN_THE_CENTRE) y = (sceneHeight - realPicHeight) >> 1; if (x < 0 || x + realPicWidth > sceneWidth || y < 0 - || y + realPicHeight > sceneHeight) + || y + realPicHeight > sceneHeight) { + debug(kSludgeDebugGraphics, "Illegal back drop size"); return false; - + } return true; } diff --git a/engines/sludge/main_loop.cpp b/engines/sludge/main_loop.cpp index 8496a9b041..5e9a0f11ae 100644 --- a/engines/sludge/main_loop.cpp +++ b/engines/sludge/main_loop.cpp @@ -74,6 +74,7 @@ #include "graphics.h" #include "helpers.h" #include "graphics/surface.h" +#include "common/debug.h" namespace Sludge { @@ -480,7 +481,9 @@ int main_loop(char *filename) g_system->copyRectToScreen(backdropSurface.getPixels(), backdropSurface.pitch, 0, 0, backdropSurface.w, backdropSurface.h); + //g_system->getPaletteManager()->setPalette(_image->getPalette(), 0, 256); g_system->updateScreen(); + g_system->delayMillis(100); #if 0 Wait_Frame(); #endif |