From 335a043bd06ab269c8c263fb86a2bc48f5ba9f7b Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 20 Sep 2011 21:45:39 -0400 Subject: [PATCH] PEGASUS: Add picture class --- engines/pegasus/surface.cpp | 16 ++++++++++++++++ engines/pegasus/surface.h | 9 +++++++++ 2 files changed, 25 insertions(+) diff --git a/engines/pegasus/surface.cpp b/engines/pegasus/surface.cpp index 7da5cd1124db..48f9fa3cb23c 100755 --- a/engines/pegasus/surface.cpp +++ b/engines/pegasus/surface.cpp @@ -218,4 +218,20 @@ void Frame::initFromPICTResource(Common::MacResManager *resFork, uint16 id, bool _transparent = transparent; } +void Picture::draw(const Common::Rect &r) { + Common::Rect surfaceBounds; + getSurfaceBounds(surfaceBounds); + Common::Rect r1 = r; + + Common::Rect bounds; + getBounds(bounds); + surfaceBounds.moveTo(bounds.left, bounds.top); + r1 = r1.findIntersectingRect(surfaceBounds); + getSurfaceBounds(surfaceBounds); + + Common::Rect r2 = r1; + r2.translate(surfaceBounds.left - bounds.left, surfaceBounds.top - bounds.top); + drawImage(r2, r1); +} + } // End of namespace Pegasus diff --git a/engines/pegasus/surface.h b/engines/pegasus/surface.h index 1b63702960fa..9493323af651 100755 --- a/engines/pegasus/surface.h +++ b/engines/pegasus/surface.h @@ -29,6 +29,7 @@ #include "common/rect.h" #include "common/str.h" +#include "pegasus/elements.h" #include "pegasus/types.h" namespace Common { @@ -114,6 +115,14 @@ friend class Sprite; uint32 _referenceCount; }; +class Picture : public DisplayElement, public Frame { +public: + Picture(const tDisplayElementID id) : DisplayElement(id) {} + virtual ~Picture() {} + + virtual void draw(const Common::Rect &); +}; + } // End of namespace Pegasus #endif