aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2007-03-14 21:53:34 +0000
committerNicola Mettifogo2007-03-14 21:53:34 +0000
commitdcfd64cdbcc2c1c7c459aac27a1eb6dc1e4281e9 (patch)
tree4636baa35decd746bbe2f6491bd9af0dc3fe2c02
parent5dae85ad110ca6cc3ecc10c3283bc81e0131053b (diff)
downloadscummvm-rg350-dcfd64cdbcc2c1c7c459aac27a1eb6dc1e4281e9.tar.gz
scummvm-rg350-dcfd64cdbcc2c1c7c459aac27a1eb6dc1e4281e9.tar.bz2
scummvm-rg350-dcfd64cdbcc2c1c7c459aac27a1eb6dc1e4281e9.zip
some slight refactoring
svn-id: r26139
-rw-r--r--engines/parallaction/graphics.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index da448ff9a4..0802685042 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -337,17 +337,30 @@ void Gfx::floodFill(Gfx::Buffers buffer, const Common::Rect& r, byte color) {
return;
}
-void Gfx::flatBlit(const Common::Rect& r, byte *data, Gfx::Buffers buffer) {
+void screenClip(Common::Rect& r, Common::Point& p) {
+
+ int32 x = r.left;
+ int32 y = r.top;
Common::Rect screen(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- Common::Rect q(r);
- q.clip(screen);
+ r.clip(screen);
+
+ if (!r.isValidRect()) return;
+
+ p.x = r.left;
+ p.y = r.top;
+
+ r.translate(screen.left - x, screen.top - y);
+
+}
+
+void Gfx::flatBlit(const Common::Rect& r, byte *data, Gfx::Buffers buffer) {
- if (!q.isValidRect()) return;
+ Common::Point dp;
+ Common::Rect q(r);
- Common::Point dp(q.left, q.top);
- q.translate(screen.left - r.left, screen.top - r.top);
+ screenClip(q, dp);
byte *s = data + q.left + q.top * r.width();
byte *d = _buffers[buffer] + dp.x + dp.y * SCREEN_WIDTH;
@@ -371,15 +384,10 @@ void Gfx::flatBlit(const Common::Rect& r, byte *data, Gfx::Buffers buffer) {
void Gfx::blit(const Common::Rect& r, uint16 z, byte *data, Gfx::Buffers buffer, Gfx::Buffers mask) {
- Common::Rect screen(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ Common::Point dp;
Common::Rect q(r);
- q.clip(screen);
-
- if (!q.isValidRect()) return;
-
- Common::Point dp(q.left, q.top);
- q.translate(screen.left - r.left, screen.top - r.top);
+ screenClip(q, dp);
byte *s = data + q.left + q.top * r.width();
byte *d = _buffers[buffer] + dp.x + dp.y * SCREEN_WIDTH;