changeset 4975:e0a443614907

RT-32595 Exception when printing contents of WebView
author peterz
date Thu, 05 Sep 2013 10:49:01 +0400
parents 1edf46aeb5f7
children 9cf30bb25652
files modules/web/src/main/java/com/sun/javafx/webkit/prism/WCGraphicsPrismContext.java
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/modules/web/src/main/java/com/sun/javafx/webkit/prism/WCGraphicsPrismContext.java	Wed Sep 04 16:40:24 2013 -0700
+++ b/modules/web/src/main/java/com/sun/javafx/webkit/prism/WCGraphicsPrismContext.java	Thu Sep 05 10:49:01 2013 +0400
@@ -1254,7 +1254,7 @@
             bufferGraphics.fill(p2d);
 
             // blend buffer and clipImg onto |g|
-            if (g instanceof MaskTextureGraphics) {
+            if (g instanceof MaskTextureGraphics && ! (g instanceof PrinterGraphics)) {
                 MaskTextureGraphics mg = (MaskTextureGraphics) g;
                 if (srcover) {
                     mg.drawPixelsMasked(buffer.getTextureObject(),
@@ -1451,10 +1451,13 @@
     }
 
     private static FilterContext getFilterContext(Graphics g) {
-        Screen screen = g.getAssociatedScreen();  // can be null when printing
-        return (screen != null
-                ? PrFilterContext.getInstance(screen)
-                : PrFilterContext.getDefaultInstance());
+        Screen screen = g.getAssociatedScreen();
+        if (screen == null) {
+            ResourceFactory factory = g.getResourceFactory();
+            return PrFilterContext.getPrinterContext(factory);
+        } else {
+            return PrFilterContext.getInstance(screen);
+        }
     }
 
     @Override public void strokeArc(final int x, final int y, final int w, final int h,