Preconcatenate the translation into the transform so that we have

that in there for hitTest().

(Note: a lot of what's going on in this class is untested beyond what
I need right now).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3737 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2005-10-19 18:46:49 +00:00
parent 4848a3e2ca
commit 8ca6e7a17c
@@ -47,13 +47,15 @@ public class TransformedMirage
// clone the transform so that it doesn't get changed on us. // clone the transform so that it doesn't get changed on us.
_transform = (AffineTransform) transform.clone(); _transform = (AffineTransform) transform.clone();
computeTransformedBounds(); computeTransformedBounds();
_transform.preConcatenate(
AffineTransform.getTranslateInstance(-_bounds.x, -_bounds.y));
} }
// documentation inherited from interface Mirage // documentation inherited from interface Mirage
public void paint (Graphics2D gfx, int x, int y) public void paint (Graphics2D gfx, int x, int y)
{ {
AffineTransform otrans = gfx.getTransform(); AffineTransform otrans = gfx.getTransform();
gfx.translate(x - _bounds.x, y - _bounds.y); gfx.translate(x, y);
gfx.transform(_transform); gfx.transform(_transform);
_base.paint(gfx, 0, 0); _base.paint(gfx, 0, 0);
gfx.setTransform(otrans); gfx.setTransform(otrans);
@@ -94,7 +96,6 @@ public class TransformedMirage
baseSnap.getType()); baseSnap.getType());
Graphics2D gfx = (Graphics2D) img.getGraphics(); Graphics2D gfx = (Graphics2D) img.getGraphics();
try { try {
gfx.translate(-_bounds.x, -_bounds.y);
gfx.transform(_transform); gfx.transform(_transform);
gfx.drawImage(baseSnap, 0, 0, null); gfx.drawImage(baseSnap, 0, 0, null);
} finally { } finally {