summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-10-03 23:39:43 +0200
committerSven Gothel <[email protected]>2013-10-03 23:39:43 +0200
commit50bc843365f65bc6b84a57baa429e32f53fa26e5 (patch)
tree5873b0b4c623ed8d6079b607d37b2b0c493c76c4 /src/jogl
parentcdf38b01fc4b632554c6400239ca5cdca1fe13d9 (diff)
AWTTilePainter: Avoid NPE if Graphic2D's AffineTransform is null, use identity tranform in such case.
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
index 2b921f799..fbf6faf08 100644
--- a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
+++ b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
@@ -88,10 +88,14 @@ public class AWTTilePainter {
System.err.println("Hint["+count+"]: "+rEntry.getKey()+" -> "+rEntry.getValue());
}
final AffineTransform aTrans = g2d.getTransform();
- System.err.println(" type "+aTrans.getType());
- System.err.println(" scale "+aTrans.getScaleX()+" x "+aTrans.getScaleY());
- System.err.println(" move "+aTrans.getTranslateX()+" x "+aTrans.getTranslateY());
- System.err.println(" mat "+aTrans);
+ if( null != aTrans ) {
+ System.err.println(" type "+aTrans.getType());
+ System.err.println(" scale "+aTrans.getScaleX()+" x "+aTrans.getScaleY());
+ System.err.println(" move "+aTrans.getTranslateX()+" x "+aTrans.getTranslateY());
+ System.err.println(" mat "+aTrans);
+ } else {
+ System.err.println(" null transform");
+ }
}
/**
@@ -188,6 +192,9 @@ public class AWTTilePainter {
public void setupGraphics2DAndClipBounds(Graphics2D g2d, int width, int height) throws NoninvertibleTransformException {
this.g2d = g2d;
saveAT = g2d.getTransform();
+ if( null == saveAT ) {
+ saveAT = new AffineTransform(); // use identity
+ }
// We use double precision for scaling
//
// Setup original rectangles
@@ -201,7 +208,7 @@ public class AWTTilePainter {
{
final AffineTransform scaledATI;
{
- final AffineTransform scaledAT = g2d.getTransform();
+ final AffineTransform scaledAT = new AffineTransform(saveAT);
scaledAT.scale(scaleMatX, scaleMatY);
scaledATI = scaledAT.createInverse(); // -> NoninvertibleTransformException
}