Skip to content

Commit

Permalink
Fixed the transcoding of nested transformations (Fix #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebourg committed Jul 5, 2016
1 parent 3ba1ea0 commit 7a8fe43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ private void transcodeGraphicsNode(GraphicsNode node, String comment) throws Uns

AffineTransform transform = node.getTransform();
if (transform != null && !transform.isIdentity()) {
printWriter.println("transformations.offer(g.getTransform());");
printWriter.println("transformations.push(g.getTransform());");
printWriter.println("g.transform(" + AffineTransformTranscoder.INSTANCE.transcode(transform) + ");");
}

Expand All @@ -388,7 +388,7 @@ private void transcodeGraphicsNode(GraphicsNode node, String comment) throws Uns
} finally {
if (transform != null && !transform.isIdentity()) {
printWriter.println("");
printWriter.println("g.setTransform(transformations.poll()); // " + comment);
printWriter.println("g.setTransform(transformations.pop()); // " + comment);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/java/transcoded/edit_copy.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static void paint(Graphics2D g) {

// _0_0
g.setComposite(AlphaComposite.getInstance(3, 0.49999997f * origAlpha));
transformations.offer(g.getTransform());
transformations.push(g.getTransform());
g.transform(new AffineTransform(1.001508f, 0, 0, 1.000616f, -0.05002205f, -0.06304895f));

// _0_0_0
Expand Down Expand Up @@ -88,7 +88,7 @@ public static void paint(Graphics2D g) {
shape = new Rectangle2D.Double(7.016119003295898, 26.03341293334961, 13, 2);
g.fill(shape);

g.setTransform(transformations.poll()); // _0_0_0
g.setTransform(transformations.pop()); // _0_0_0
g.setComposite(AlphaComposite.getInstance(3, 1 * origAlpha));

// _0_0_1
Expand Down

0 comments on commit 7a8fe43

Please sign in to comment.