diff options
-rw-r--r-- | engines/parallaction/graphics.cpp | 34 |
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; |