You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by ga...@apache.org on 2012/05/02 17:33:16 UTC

svn commit: r1333076 - in /xmlgraphics/commons/trunk: ./ lib/build/ src/java/org/apache/xmlgraphics/java2d/ps/ test/java/org/apache/xmlgraphics/java2d/ps/

Author: gadams
Date: Wed May  2 15:33:15 2012
New Revision: 1333076

URL: http://svn.apache.org/viewvc?rev=1333076&view=rev
Log:
Bugzilla #53177: Fix for XGC when rendering PostScript using SVG being drawn upside down when using a custom affine transform. Submitted by rmeyer@hotmail.co.uk.

Added:
    xmlgraphics/commons/trunk/lib/build/
    xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.LICENCE.txt
    xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.NOTICE.txt
    xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.jar
    xmlgraphics/commons/trunk/lib/build/objenesis-1.0.0.LICENSE.txt
    xmlgraphics/commons/trunk/lib/build/objenesis-1.0.0.jar
    xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/java2d/ps/
    xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2DTestCase.java
Modified:
    xmlgraphics/commons/trunk/build.xml
    xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java

Modified: xmlgraphics/commons/trunk/build.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/build.xml?rev=1333076&r1=1333075&r2=1333076&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/build.xml (original)
+++ xmlgraphics/commons/trunk/build.xml Wed May  2 15:33:15 2012
@@ -71,6 +71,12 @@
     </fileset>
   </path>
 
+  <path id="libs-tools-build-classpath">
+    <fileset dir="${lib.dir}/build">
+      <include name="*.jar"/>
+    </fileset>
+  </path>
+
   <path id="libs-run-classpath">
     <fileset dir="${lib.dir}">
       <include name="*.jar"/>
@@ -294,6 +300,7 @@
       <patternset refid="compile-pattern"/>
       <classpath>
         <path refid="libs-build-classpath"/>
+        <path refid="libs-tools-build-classpath"/>
         <fileset dir="${build.dir}">
           <include name="${name}-${version}.jar"/>
         </fileset>
@@ -319,6 +326,7 @@
       <classpath>
         <pathelement location="${build.dir}/test-classes"/>
         <path refid="libs-build-classpath"/>
+        <path refid="libs-tools-build-classpath"/>
         <fileset dir="build">
           <include name="${name}-${version}.jar"/>
         </fileset>

Added: xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.LICENCE.txt
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.LICENCE.txt?rev=1333076&view=auto
==============================================================================
--- xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.LICENCE.txt (added)
+++ xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.LICENCE.txt Wed May  2 15:33:15 2012
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2007 Mockito contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
\ No newline at end of file

Added: xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.NOTICE.txt
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.NOTICE.txt?rev=1333076&view=auto
==============================================================================
--- xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.NOTICE.txt (added)
+++ xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.NOTICE.txt Wed May  2 15:33:15 2012
@@ -0,0 +1,11 @@
+Mockito license - MIT.
+
+Libraries used:
+
+Cglib - Apache License 2.0
+ASM - BSD license
+
+Mockito all distribution:
+
+Objenesis - MIT license
+Hamcrest - BSD license
\ No newline at end of file

Added: xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.jar
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.jar?rev=1333076&view=auto
==============================================================================
Files xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.jar (added) and xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.jar Wed May  2 15:33:15 2012 differ

Added: xmlgraphics/commons/trunk/lib/build/objenesis-1.0.0.LICENSE.txt
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/lib/build/objenesis-1.0.0.LICENSE.txt?rev=1333076&view=auto
==============================================================================
--- xmlgraphics/commons/trunk/lib/build/objenesis-1.0.0.LICENSE.txt (added)
+++ xmlgraphics/commons/trunk/lib/build/objenesis-1.0.0.LICENSE.txt Wed May  2 15:33:15 2012
@@ -0,0 +1,18 @@
+Copyright (c) 2003-2008, Objenesis Team and all contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of 
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file

Added: xmlgraphics/commons/trunk/lib/build/objenesis-1.0.0.jar
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/lib/build/objenesis-1.0.0.jar?rev=1333076&view=auto
==============================================================================
Files xmlgraphics/commons/trunk/lib/build/objenesis-1.0.0.jar (added) and xmlgraphics/commons/trunk/lib/build/objenesis-1.0.0.jar Wed May  2 15:33:15 2012 differ

Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java?rev=1333076&r1=1333075&r2=1333076&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java Wed May  2 15:33:15 2012
@@ -456,8 +456,7 @@ public class PSGraphics2D extends Abstra
             gen.saveGraphicsState();
 
             AffineTransform trans = getTransform();
-            boolean newTransform = gen.getCurrentState().checkTransform(trans)
-                    && !trans.isIdentity();
+            boolean newTransform = !trans.isIdentity();
 
             if (newTransform) {
                 gen.concatMatrix(trans);
@@ -756,8 +755,7 @@ public class PSGraphics2D extends Abstra
             gen.saveGraphicsState();
 
             AffineTransform trans = getTransform();
-            boolean newTransform = gen.getCurrentState().checkTransform(trans)
-                    && !trans.isIdentity();
+            boolean newTransform = !trans.isIdentity();
 
             if (newTransform) {
                 gen.concatMatrix(trans);

Added: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2DTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2DTestCase.java?rev=1333076&view=auto
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2DTestCase.java (added)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2DTestCase.java Wed May  2 15:33:15 2012
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.xmlgraphics.java2d.ps;
+
+import java.awt.Rectangle;
+import java.awt.geom.AffineTransform;
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.xmlgraphics.java2d.GraphicContext;
+import org.apache.xmlgraphics.ps.PSGenerator;
+import org.apache.xmlgraphics.ps.PSState;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class PSGraphics2DTestCase {
+
+    private PSGenerator gen;
+    private PSGraphics2D gfx2d;
+    private final AffineTransform TRANSFORM = new AffineTransform(1, 0, 0, -1, 0, 792);
+
+    @Before
+    public void setup() {
+        gen = mock(PSGenerator.class);
+        createGraphics2D();
+        PSState pState = new PSState();
+        when(gen.getCurrentState()).thenReturn(pState);
+    }
+
+    private void createGraphics2D() {
+        gfx2d = new PSGraphics2D(false, gen);
+        gfx2d.setGraphicContext(new GraphicContext());
+        gfx2d.setTransform(TRANSFORM);
+    }
+
+    @Test
+    public void draw() throws IOException {
+        assertEquals(gfx2d.getTransform(), TRANSFORM);
+        gfx2d.draw(new Rectangle(10, 10, 100, 100));
+        verify(gen, times(1)).concatMatrix(TRANSFORM);
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org