changeset 3758:167bc510ce34

RT-26702: Poor DisplacementMap effect performance on Mac [Java code only, fixes potential drawing of garbage on first frame on OS X]
author snorthov
date Wed, 29 May 2013 16:05:51 -0400
parents 7d97d6e4f096
children c75bd11d9865
files javafx-ui-quantum/src/com/sun/javafx/tk/quantum/PresentingPainter.java javafx-ui-quantum/src/com/sun/javafx/tk/quantum/ViewPainter.java
diffstat 2 files changed, 9 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/PresentingPainter.java	Wed May 29 10:43:18 2013 -0700
+++ b/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/PresentingPainter.java	Wed May 29 16:05:51 2013 -0400
@@ -26,6 +26,7 @@
 package com.sun.javafx.tk.quantum;
 
 import com.sun.prism.Graphics;
+import com.sun.prism.GraphicsPipeline;
 import com.sun.prism.impl.Disposer;
 import com.sun.prism.impl.ManagedResource;
 import com.sun.prism.impl.PrismSettings;
@@ -60,6 +61,13 @@
              */
             sceneState.lock();
             locked = true;
+            
+            if (factory == null) {
+                factory = GraphicsPipeline.getDefaultResourceFactory();
+                if (factory == null || !factory.isDeviceReady()) {
+                    return;
+                }
+            }
 
             boolean needsReset = (presentable == null) ||
                                  (penWidth != viewWidth) || (penHeight != viewHeight);
--- a/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/ViewPainter.java	Wed May 29 10:43:18 2013 -0700
+++ b/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/ViewPainter.java	Wed May 29 16:05:51 2013 -0400
@@ -28,7 +28,6 @@
 import com.sun.javafx.sg.NodePath;
 import com.sun.javafx.sg.prism.NGNode;
 import com.sun.prism.Graphics;
-import com.sun.prism.GraphicsPipeline;
 import com.sun.prism.impl.PrismSettings;
 import com.sun.prism.paint.Color;
 import com.sun.prism.paint.Paint;
@@ -70,24 +69,7 @@
 
         setPaintBounds(viewWidth, viewHeight);
 
-        if (factory == null) {
-            // the factory really should not be null as
-            // we really want all that factory work on the event thread
-            try {
-                sceneState.lock();
-                factory = GraphicsPipeline.getDefaultResourceFactory();
-            } finally {
-                /*
-                 * Don't flush to the screen if there was a failure
-                 * creating the graphics factory
-                 */
-                sceneState.unlock();
-            }
-            return ((factory != null) && factory.isDeviceReady());
-        }
-        return sceneState.isWindowVisible() &&
-               !sceneState.isWindowMinimized() &&
-               factory.isDeviceReady();
+        return sceneState.isWindowVisible() && !sceneState.isWindowMinimized();
     }
     
     @Override protected void doPaint(Graphics g, NodePath<NGNode> renderRootPath) {