changeset 6514:d1d4b24e037d

Fixed RT-36178: Printing: Scene is not printed when blending is used. Reviewed-by: flar
author prr
date Wed, 19 Mar 2014 11:06:41 -0700
parents 8a0dd88b5456
children 7123e5a61cee
files modules/graphics/src/main/java/com/sun/prism/j2d/J2DPresentable.java modules/graphics/src/main/java/com/sun/prism/j2d/J2DRTTexture.java modules/graphics/src/main/java/com/sun/prism/j2d/J2DResourceFactory.java modules/graphics/src/main/java/com/sun/prism/j2d/PrismPrintGraphics.java
diffstat 4 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/com/sun/prism/j2d/J2DPresentable.java	Wed Mar 19 08:46:54 2014 -0600
+++ b/modules/graphics/src/main/java/com/sun/prism/j2d/J2DPresentable.java	Wed Mar 19 11:06:41 2014 -0700
@@ -233,8 +233,8 @@
             ib = IntBuffer.wrap(pixels, db.getOffset(), db.getSize());
             needsResize = false;
         }
-        Graphics2D g2d = (Graphics2D) buffer.getGraphics();
-        return new J2DPrismGraphics(this, g2d);
+        Graphics2D g2d = buffer.createGraphics();
+        return factory.createJ2DPrismGraphics(this, g2d);
     }
 
     J2DRTTexture getReadbackBuffer() {
--- a/modules/graphics/src/main/java/com/sun/prism/j2d/J2DRTTexture.java	Wed Mar 19 08:46:54 2014 -0600
+++ b/modules/graphics/src/main/java/com/sun/prism/j2d/J2DRTTexture.java	Wed Mar 19 11:06:41 2014 -0700
@@ -99,7 +99,7 @@
         BufferedImage bimg = getBufferedImage();
         J2DPresentable presentable = J2DPresentable.create(bimg, factory);
         java.awt.Graphics2D g2d = bimg.createGraphics();
-        return new J2DPrismGraphics(presentable, g2d);
+        return factory.createJ2DPrismGraphics(presentable, g2d);
     }
 
     java.awt.Graphics2D createAWTGraphics2D() {
--- a/modules/graphics/src/main/java/com/sun/prism/j2d/J2DResourceFactory.java	Wed Mar 19 08:46:54 2014 -0600
+++ b/modules/graphics/src/main/java/com/sun/prism/j2d/J2DResourceFactory.java	Wed Mar 19 11:06:41 2014 -0700
@@ -51,6 +51,11 @@
         this.screen = screen;
     }
 
+    J2DPrismGraphics createJ2DPrismGraphics(J2DPresentable target,
+                                            java.awt.Graphics2D g2d) {
+        return new J2DPrismGraphics(target, g2d);
+    }
+
     public TextureResourcePool getTextureResourcePool() {
         return J2DTexturePool.instance;
     }
--- a/modules/graphics/src/main/java/com/sun/prism/j2d/PrismPrintGraphics.java	Wed Mar 19 08:46:54 2014 -0600
+++ b/modules/graphics/src/main/java/com/sun/prism/j2d/PrismPrintGraphics.java	Wed Mar 19 11:06:41 2014 -0700
@@ -51,6 +51,12 @@
         }
 
         @Override
+        J2DPrismGraphics createJ2DPrismGraphics(J2DPresentable target,
+                                                java.awt.Graphics2D g2d) {
+            return new PrismPrintGraphics(target, g2d);
+        }
+
+        @Override
         public Texture getCachedTexture(Image image, WrapMode wrapMode) {
             /*
              * The super-class has a static cache which does not allow
@@ -152,4 +158,8 @@
     public PrismPrintGraphics(java.awt.Graphics2D g2d, int width, int height) {
         super(new PagePresentable(width, height), g2d);
     }
+
+    PrismPrintGraphics(J2DPresentable target, java.awt.Graphics2D g2d) {
+        super(target, g2d);
+    }
 }