aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/picture.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2018-11-23 15:35:13 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit6f508124937df1b0cda5a2732039a82c4ec16b85 (patch)
tree568b8d485e76866b829ecbea1e4f97da11fa3f06 /engines/glk/picture.cpp
parent3e8ed4eafcfe3fd8198c65b0838022c1dd32eea8 (diff)
downloadscummvm-rg350-6f508124937df1b0cda5a2732039a82c4ec16b85.tar.gz
scummvm-rg350-6f508124937df1b0cda5a2732039a82c4ec16b85.tar.bz2
scummvm-rg350-6f508124937df1b0cda5a2732039a82c4ec16b85.zip
GLK: Added RawDecoder class for new raw picture data format
Diffstat (limited to 'engines/glk/picture.cpp')
-rw-r--r--engines/glk/picture.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/engines/glk/picture.cpp b/engines/glk/picture.cpp
index 122d9c3f30..7770bb892b 100644
--- a/engines/glk/picture.cpp
+++ b/engines/glk/picture.cpp
@@ -22,6 +22,7 @@
#include "glk/picture.h"
#include "glk/glk.h"
+#include "glk/raw_decoder.h"
#include "glk/screen.h"
#include "common/file.h"
#include "image/jpeg.h"
@@ -102,7 +103,9 @@ Picture *Pictures::retrieve(uint id, bool scaled) {
Picture *Pictures::load(uint32 id) {
::Image::PNGDecoder png;
::Image::JPEGDecoder jpg;
+ RawDecoder raw;
const Graphics::Surface *img;
+ const byte *palette = nullptr;
Picture *pic;
// Check if the picture is already in the store
@@ -114,15 +117,25 @@ Picture *Pictures::load(uint32 id) {
if (f.open(Common::String::format("PIC%lu.png", id))) {
png.loadStream(f);
img = png.getSurface();
+ palette = png.getPalette();
} else if (f.open(Common::String::format("PIC%lu.jpg", id))) {
jpg.loadStream(f);
img = jpg.getSurface();
+ } else if (f.open(Common::String::format("PIC%lu.raw", id))) {
+ raw.loadStream(f);
+ img = raw.getSurface();
+ palette = raw.getPalette();
}
pic = new Picture();
pic->_refCount = 1;
pic->_id = id;
pic->_scaled = false;
+ pic->create(img->w, img->h, g_system->getScreenFormat());
+ pic->blitFrom(*img);
+
+ if (palette)
+ pic->convertToInPlace(g_system->getScreenFormat(), palette);
store(pic);
return pic;