History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: FVG-136
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Mark Donszelmann
Reporter: Anonymous
Votes: 0
Watchers: 0
Operations

Clone this issue
Create sub-task
If you were logged in you would be able to see more operations.
FreeHEP Vector Graphics

AbstractVectorGraphicsIO.setTranform(AffineTransform) is incorrectly doing "pass by reference".

Created: 23/Aug/05 09:22 PM   Updated: 10/Feb/06 06:53 AM
Component/s: GraphicsIO
Affects Version/s: 1.2.2
Fix Version/s: 2.0

Issue Links:
See also
 

Reported By: nlandys@bioeng.ucsd.edu


 Description  « Hide
In release 1.2.2 of org.freehep.graphicsio.AbstractVectorGraphicsIO.java, the method setTransform(AffineTransform) is behaving in a "pass by reference" manner. Although it is not clearly documented in the java API specs, java.awt.Graphics2D implementations all treat this method as "pass by value". Therefore, to be truly compatible with other Graphics2D implementations, you should not store a reference to the AffineTransform being passed into this method; instead, make a copy of it into a private (or new) AffineTransform. The patch I'm submitting is instantiating a new AffineTransform; the patch fixes the problem with the least amount of code change (one line). However, my fix is not the most efficient because it requires one instantiation of AffineTransform per call to setTransform(), which is not the most efficient solution possible.

I'm using a patched version of AbstractVectorGraphicsIO.java to work around this bug. This problem still exists in today's CVS snapshot. Here is the patch:

--- org/freehep/graphicsio/AbstractVectorGraphicsIO.java-orig 2005-08-23 20:45:17.274831904 -0700
+++ org/freehep/graphicsio/AbstractVectorGraphicsIO.java 2005-08-23 20:46:45.842367592 -0700
@@ -579,7 +579,7 @@
         } catch (IOException e) {
             handleException(e);
         }
- currentTransform = transform;
+ currentTransform = new AffineTransform(transform);
     }

/**


 All   Comments   Change History      Sort Order:
There are no comments yet on this issue.