aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2013-12-29 09:54:40 +1100
committerPaul Gilbert2013-12-29 09:54:40 +1100
commit1256fb6b666a36fbbd8f3223d2c776bca9a3ca83 (patch)
treef17da7f89e9d6c394659f290412610e7ccff4beb
parent2c0a94d174e38ec13b52622e0a79cd9566ac6e35 (diff)
downloadscummvm-rg350-1256fb6b666a36fbbd8f3223d2c776bca9a3ca83.tar.gz
scummvm-rg350-1256fb6b666a36fbbd8f3223d2c776bca9a3ca83.tar.bz2
scummvm-rg350-1256fb6b666a36fbbd8f3223d2c776bca9a3ca83.zip
VOYEUR: Add support for creating a PictureResource from a Graphics::Surface
-rw-r--r--engines/voyeur/files.cpp21
-rw-r--r--engines/voyeur/files.h1
2 files changed, 19 insertions, 3 deletions
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 2602ace735..9d86c66c2e 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -697,10 +697,12 @@ bool BoltEntry::hasResource() const {
/*------------------------------------------------------------------------*/
RectResource::RectResource(const byte *src, int size) {
- int count = 1;
- if (size != 8) {
+ int count;
+ if ((size % 8) == 2) {
count = READ_LE_UINT16(src);
src += 2;
+ } else {
+ count = size / 8;
}
for (int i = 0; i < count; ++i, src += 8) {
@@ -815,6 +817,19 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
}
}
+PictureResource::PictureResource(Graphics::Surface *surface) {
+ _flags = 0;
+ _select = 0;
+ _pick = 0;
+ _onOff = 0;
+ _depth = 0;
+ _maskData = 0;
+ _planeSize = 0;
+
+ _bounds = Common::Rect(0, 0, surface->w, surface->h);
+ _imgData = (byte *)surface->getPixels();
+}
+
PictureResource::PictureResource() {
_flags = 0;
_select = 0;
@@ -967,7 +982,7 @@ void ViewPortResource::setupViewPort(PictureResource *page, Common::Rect *clipRe
if (yDiff > 0)
r.setHeight(yDiff <= r.height() ? r.height() - yDiff : 0);
}
-// clip = (0x20, 0x14, width: 0x140, height: 0C8h
+
_activePage = page;
_field18 = 0;
_clipRect = r;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 8ccfab8a20..832e157b7b 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -274,6 +274,7 @@ public:
PictureResource(BoltFilesState &state, const byte *src);
PictureResource(int flags, int select, int pick, int onOff, int depth,
const Common::Rect &bounds, int maskData, byte *imgData, int planeSize);
+ PictureResource::PictureResource(Graphics::Surface *surface);
PictureResource();
virtual ~PictureResource();
};