Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8102227

Scenegraph always creates a BasicStroke for every Shape node, even though the default stroke is null.

XMLWordPrintable

      I think that the scene graph marks all bits dirty for a new node when in fact it should be selective about this.
      For example the default stroke on a shape is null. But create any shape node: circle, rectangle, text, and
      you'll see the scene graph creates a BasicStroke and sets it on the NGShape.
      This is a lot of wasted work if strokes aren't wanted, as is likely to be the case for almost all text nodes,
      and Jasper guesses that fill is the most common in general.

      I overrode geometryChanged in NGRectangle to do a dump stack and ran the attached program and
      you can see that this occurs regardless of not setting a stroke :

      C:\fx2tests>c:\jdk1.7\bin\java -cp c:\fx2\jfx\artifacts\sdk\rt\lib\jfxrt.jar;.
       NoStrokeTest
      java.lang.Exception: Stack trace
              at java.lang.Thread.dumpStack(Thread.java:1342)
              at com.sun.javafx.sg.prism.NGRectangle.geometryChanged(NGRectangle.java:43)
              at com.sun.javafx.sg.prism.NGShape.setDrawStroke(NGShape.java:114)
              at javafx.scene.shape.Shape.updatePGShape(Shape.java:851)
              at javafx.scene.shape.Shape.impl_updatePG(Shape.java:914)
              at javafx.scene.shape.Rectangle.impl_updatePG(Rectangle.java:550)
              at javafx.scene.Node.impl_syncPGNode(Node.java:452)
              at javafx.scene.Scene$ScenePulseListener.syncAll(Scene.java:1775)
              at javafx.scene.Scene$ScenePulseListener.syncAll(Scene.java:1784)
              at javafx.scene.Scene$ScenePulseListener.synchronizeSceneNodes(Scene.java:1737)
              at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:1860)
              at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:357)
              at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:458)
              at com.sun.javafx.tk.quantum.QuantumToolkit$8.run(QuantumToolkit.java:325)
              at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
              at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
              at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:62)
              at java.lang.Thread.run(Thread.java:722)

            ekrejcir Eva Krejčířová (Inactive)
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: