diff options
Diffstat (limited to 'engines/cryomni3d')
-rw-r--r-- | engines/cryomni3d/fixed_image.cpp | 16 | ||||
-rw-r--r-- | engines/cryomni3d/fixed_image.h | 1 |
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; |