aboutsummaryrefslogtreecommitdiff
path: root/engines/pegasus
diff options
context:
space:
mode:
authorMatthew Hoops2012-03-20 14:18:57 -0400
committerMatthew Hoops2012-03-20 14:49:16 -0400
commit71756bdf4eae5ba9cc3f329b85e894f04640aaef (patch)
tree40d464262da107ab5eed82f198685209161ebac1 /engines/pegasus
parent03eba05b09e5c9e5a351f8111185934b92a3fed3 (diff)
parent3c3576a224b92c703b4e8ea20008ac8a069980dd (diff)
downloadscummvm-rg350-71756bdf4eae5ba9cc3f329b85e894f04640aaef.tar.gz
scummvm-rg350-71756bdf4eae5ba9cc3f329b85e894f04640aaef.tar.bz2
scummvm-rg350-71756bdf4eae5ba9cc3f329b85e894f04640aaef.zip
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'engines/pegasus')
-rwxr-xr-xengines/pegasus/cursor.cpp4
-rw-r--r--engines/pegasus/elements.h2
-rw-r--r--engines/pegasus/graphics.h1
-rwxr-xr-xengines/pegasus/surface.cpp35
4 files changed, 9 insertions, 33 deletions
diff --git a/engines/pegasus/cursor.cpp b/engines/pegasus/cursor.cpp
index 430b319e33..ea5fc74501 100755
--- a/engines/pegasus/cursor.cpp
+++ b/engines/pegasus/cursor.cpp
@@ -27,8 +27,8 @@
#include "common/stream.h"
#include "common/system.h"
#include "graphics/cursorman.h"
-#include "graphics/pict.h"
#include "graphics/surface.h"
+#include "graphics/decoders/pict.h"
#include "pegasus/cursor.h"
#include "pegasus/graphics.h"
@@ -143,7 +143,7 @@ void Cursor::loadCursorImage(CursorInfo &cursorInfo) {
error("Failed to find color icon %d", cursorInfo.tag);
// PixMap section
- Graphics::PictDecoder::PixMap pixMap = Graphics::PictDecoder::readPixMap(cicnStream);
+ Graphics::PICTDecoder::PixMap pixMap = Graphics::PICTDecoder::readPixMap(*cicnStream);
// Mask section
cicnStream->readUint32BE(); // mask baseAddr
diff --git a/engines/pegasus/elements.h b/engines/pegasus/elements.h
index 6a465d1602..d96d2173b1 100644
--- a/engines/pegasus/elements.h
+++ b/engines/pegasus/elements.h
@@ -26,10 +26,10 @@
#ifndef PEGASUS_ELEMENTS_H
#define PEGASUS_ELEMENTS_H
+#include "common/array.h"
#include "common/rect.h"
#include "common/str.h"
#include "common/system.h"
-#include "graphics/pict.h"
#include "graphics/surface.h"
#include "pegasus/timers.h"
diff --git a/engines/pegasus/graphics.h b/engines/pegasus/graphics.h
index 7c5bd69a69..502304409a 100644
--- a/engines/pegasus/graphics.h
+++ b/engines/pegasus/graphics.h
@@ -29,7 +29,6 @@
#include "common/rect.h"
#include "common/str.h"
#include "common/system.h"
-#include "graphics/pict.h"
#include "graphics/surface.h"
#include "pegasus/constants.h"
diff --git a/engines/pegasus/surface.cpp b/engines/pegasus/surface.cpp
index f0c97d60ea..897305f2a3 100755
--- a/engines/pegasus/surface.cpp
+++ b/engines/pegasus/surface.cpp
@@ -27,8 +27,8 @@
#include "common/macresman.h"
#include "common/stream.h"
#include "common/system.h"
-#include "graphics/pict.h"
#include "graphics/surface.h"
+#include "graphics/decoders/pict.h"
#include "video/video_decoder.h"
#include "pegasus/pegasus.h"
@@ -98,35 +98,12 @@ void Surface::getImageFromPICTResource(Common::MacResManager *resFork, uint16 id
}
void Surface::getImageFromPICTStream(Common::SeekableReadStream *stream) {
- Graphics::PictDecoder pict(g_system->getScreenFormat());
- byte pal[256 * 3];
-
- Graphics::Surface *surface = pict.decodeImage(stream, pal);
-
- // Create the surface if not present
- if (!_surface)
- _surface = new Graphics::Surface();
-
- // Update
- if (surface->format.bytesPerPixel == 1) {
- // Convert to true color
- _surface->create(surface->w, surface->h, g_system->getScreenFormat());
-
- for (int y = 0; y < surface->h; y++) {
- for (int x = 0; x < surface->w; x++) {
- byte index = *((byte *)surface->getBasePtr(x, y));
- uint32 color = _surface->format.RGBToColor(pal[index * 3], pal[index * 3 + 1], pal[index * 3 + 2]);
- if (_surface->format.bytesPerPixel == 2)
- *((uint16 *)_surface->getBasePtr(x, y)) = color;
- else
- *((uint32 *)_surface->getBasePtr(x, y)) = color;
- }
- }
- } else {
- // Just a copy
- _surface->copyFrom(*surface);
- }
+ Graphics::PICTDecoder pict;
+
+ if (!pict.loadStream(*stream))
+ error("Failed to load PICT image");
+ _surface = pict.getSurface()->convertTo(g_system->getScreenFormat(), pict.getPalette());
_ownsSurface = true;
_bounds = Common::Rect(0, 0, _surface->w, _surface->h);
}