[Scummvm-cvs-logs] SF.net SVN: scummvm: [26139] scummvm/trunk/engines/parallaction/graphics. cpp

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Wed Mar 14 22:53:35 CET 2007


Revision: 26139
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26139&view=rev
Author:   peres001
Date:     2007-03-14 14:53:34 -0700 (Wed, 14 Mar 2007)

Log Message:
-----------
some slight refactoring

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/graphics.cpp

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-03-14 21:11:04 UTC (rev 26138)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-03-14 21:53:34 UTC (rev 26139)
@@ -337,18 +337,31 @@
 	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 (!q.isValidRect()) return;
+	if (!r.isValidRect()) return;
 
-	Common::Point dp(q.left, q.top);
-	q.translate(screen.left - r.left, screen.top - r.top);
+	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) {
+
+	Common::Point dp;
+	Common::Rect q(r);
+
+	screenClip(q, dp);
+
 	byte *s = data + q.left + q.top * r.width();
 	byte *d = _buffers[buffer] + dp.x + dp.y * SCREEN_WIDTH;
 
@@ -371,16 +384,11 @@
 
 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);
+	screenClip(q, dp);
 
-	if (!q.isValidRect()) return;
-
-	Common::Point dp(q.left, q.top);
-	q.translate(screen.left - r.left, screen.top - r.top);
-
 	byte *s = data + q.left + q.top * r.width();
 	byte *d = _buffers[buffer] + dp.x + dp.y * SCREEN_WIDTH;
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list