Skip to content

Commit

Permalink
PEGASUS: Add picture class
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Hoops committed Sep 21, 2011
1 parent de23530 commit 335a043
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
16 changes: 16 additions & 0 deletions engines/pegasus/surface.cpp
Expand Up @@ -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
9 changes: 9 additions & 0 deletions engines/pegasus/surface.h
Expand Up @@ -29,6 +29,7 @@
#include "common/rect.h"
#include "common/str.h"

#include "pegasus/elements.h"
#include "pegasus/types.h"

namespace Common {
Expand Down Expand Up @@ -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

0 comments on commit 335a043

Please sign in to comment.