aboutsummaryrefslogtreecommitdiff
path: root/engines/cryomni3d
diff options
context:
space:
mode:
authorLe Philousophe2019-05-03 00:00:12 +0200
committerEugene Sandulenko2019-06-01 22:43:48 +0200
commit349201ba153bd80597a0c4154afea4d9499166c6 (patch)
treeba222b1abda0f5c02707365e95a5d9766e2f1ad2 /engines/cryomni3d
parent5a0d511ebd249d21b5390d26add991e2c2d1bda2 (diff)
downloadscummvm-rg350-349201ba153bd80597a0c4154afea4d9499166c6.tar.gz
scummvm-rg350-349201ba153bd80597a0c4154afea4d9499166c6.tar.bz2
scummvm-rg350-349201ba153bd80597a0c4154afea4d9499166c6.zip
CRYOMNI3D: Let callback modify displayed fixed image
Diffstat (limited to 'engines/cryomni3d')
-rw-r--r--engines/cryomni3d/fixed_image.cpp16
-rw-r--r--engines/cryomni3d/fixed_image.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/engines/cryomni3d/fixed_image.cpp b/engines/cryomni3d/fixed_image.cpp
index 660190a09f..08bc78e595 100644
--- a/engines/cryomni3d/fixed_image.cpp
+++ b/engines/cryomni3d/fixed_image.cpp
@@ -60,6 +60,9 @@ void ZonFixedImage::run(const CallbackFunctor *callback) {
delete _callback;
_callback = nullptr;
+
+ // Don't use the current _imageSurface, we may not own it anymore
+ _imageSurface = nullptr;
}
void ZonFixedImage::load(const Common::String &image) {
@@ -294,4 +297,17 @@ void ZonFixedImage::handleMouseZones(const Common::Array<Zone>::const_iterator &
}
}
+void ZonFixedImage::updateSurface(const Graphics::Surface *newSurface) {
+ if (newSurface->w != _imageSurface->w ||
+ newSurface->h != _imageSurface->h ||
+ newSurface->format != _imageSurface->format) {
+ error("New surface has invalid attributes");
+ }
+
+ // Be careful the surface must be destroyed after the fixed image has finished with it
+ _imageSurface = newSurface;
+
+ display();
+}
+
} // End of namespace CryOmni3D
diff --git a/engines/cryomni3d/fixed_image.h b/engines/cryomni3d/fixed_image.h
index 7f2b1e07de..3cabfa3077 100644
--- a/engines/cryomni3d/fixed_image.h
+++ b/engines/cryomni3d/fixed_image.h
@@ -71,6 +71,7 @@ public:
/* These functions and attributes are used in image handler */
void load(const Common::String &image);
void manage();
+ void updateSurface(const Graphics::Surface *newSurface);
const Graphics::Surface *surface() const { return _imageSurface; }
void changeCallback(CallbackFunctor *callback) { delete _callback; _callback = callback; }
Common::Point getZoneCenter(unsigned int zoneId) const;