From 1256fb6b666a36fbbd8f3223d2c776bca9a3ca83 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 29 Dec 2013 09:54:40 +1100 Subject: VOYEUR: Add support for creating a PictureResource from a Graphics::Surface --- engines/voyeur/files.cpp | 21 ++++++++++++++++++--- engines/voyeur/files.h | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'engines/voyeur') 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(); }; -- cgit v1.2.3