[Scummvm-cvs-logs] SF.net SVN: scummvm:[47092] scummvm/trunk/engines/teenagent
megath at users.sourceforge.net
megath at users.sourceforge.net
Wed Jan 6 21:25:07 CET 2010
Revision: 47092
http://scummvm.svn.sourceforge.net/scummvm/?rev=47092&view=rev
Author: megath
Date: 2010-01-06 20:25:07 +0000 (Wed, 06 Jan 2010)
Log Message:
-----------
implemented clipping for mark
Modified Paths:
--------------
scummvm/trunk/engines/teenagent/actor.cpp
scummvm/trunk/engines/teenagent/surface.cpp
Modified: scummvm/trunk/engines/teenagent/actor.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/actor.cpp 2010-01-06 20:24:56 UTC (rev 47091)
+++ scummvm/trunk/engines/teenagent/actor.cpp 2010-01-06 20:25:07 UTC (rev 47092)
@@ -55,16 +55,6 @@
///\todo remove copy-paste here and below
int xp = position.x - s->w * zoom / 512 - s->x, yp = position.y - s->h * zoom / 256 - s->y;
- if (xp < 0)
- xp = 0;
- if (xp + s->w > 320)
- xp = 320 - s->w;
-
- if (yp < 0)
- yp = 0;
- if (yp + s->h > 200)
- yp = 200 - s->h;
-
return s->render(surface, xp, yp, mirror, Common::Rect(), zoom);
}
@@ -156,16 +146,6 @@
clip.top = head->h;
int xp = position.x - s->w * zoom / 512 - s->x, yp = position.y - s->h * zoom / 256 - s->y;
- if (xp < 0)
- xp = 0;
- if (xp + s->w > 320)
- xp = 320 - s->w;
-
- if (yp < 0)
- yp = 0;
- if (yp + clip.top + clip.height() > 200)
- yp = 200 - clip.top - clip.height();
-
dirty = s->render(surface, xp, yp + clip.top * zoom / 256, mirror, clip, zoom);
if (head != NULL)
Modified: scummvm/trunk/engines/teenagent/surface.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/surface.cpp 2010-01-06 20:24:56 UTC (rev 47091)
+++ scummvm/trunk/engines/teenagent/surface.cpp 2010-01-06 20:25:07 UTC (rev 47092)
@@ -65,11 +65,22 @@
Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mirror, Common::Rect src_rect, uint zoom) const {
if (src_rect.isEmpty()) {
src_rect = Common::Rect(0, 0, w, h);
- } else if (src_rect.right > w)
- src_rect.right = w;
- else if (src_rect.bottom > h)
- src_rect.bottom = h;
-
+ }
+ {
+ int left = x + dx, right = left + src_rect.width();
+ int top = y + dy, bottom = top + src_rect.height();
+ if (left < 0)
+ src_rect.left -= left;
+ if (right > surface->w)
+ src_rect.right -= right - surface->w;
+ if (top < 0)
+ src_rect.top -= top;
+ if (bottom > surface->h)
+ src_rect.bottom -= bottom - surface->h;
+ if (src_rect.isEmpty())
+ return Common::Rect();
+ }
+
if (zoom == 256) {
assert(x + dx + src_rect.width() <= surface->w);
assert(y + dy + src_rect.height() <= surface->h);
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