RFR: 8238954: Improve performance of tiled snapshot rendering [v5]

Ambarish Rapte arapte at openjdk.java.net
Mon Jun 29 14:04:28 UTC 2020

On Wed, 17 Jun 2020 11:33:27 GMT, Frederic Thevenet <github.com+7450507+fthevenet at openjdk.org> wrote:

>>> [...] I'd like to see some additional system tests that cover all of the cases of X and Y fitting/not-fitting exactly
>>> (and if you stick with your current approach, X or Y as the inner loop).
>> What kind of tests do you have in mind? More specifically do you mean simply adding tests that expand on the existing
>> `doTestSnapshotScaleNodeDefer`and `doTestSnapshotScaleNodeImm` (which basically just prove that taking a snapshot
>> returns a non-null image of the expected size)? Or do you think we need to include a test that proves the snapshot
>> produced by tiling is entirely faithful to the original, pixel-wise?
> I went ahead and wrote a bunch of tests that:
> 1. Setup a scene to display an `ImageView` of a selected dimensions chosen to trigger tiling in different ways when
> taking snapshots. 2. Fill up the image with noise.
> 3. Take a snapshot and do a pixel-wise comparison with the original image.
> I've added the new tests to the existing `Snapshot2Test.java`.

I observed that the added tests are failing on mac machine(Mojave 10.14.6), but they do pass on windows10. Can you
please verify ? Timeout and NPE exception from the log,

test.javafx.scene.Snapshot2Test > testSnapshot2x2TilesSameWidthImm[0] FAILED
    java.lang.IllegalArgumentException: Unrecognized image loader: null
        at javafx.graphics/javafx.scene.image.WritableImage.loadTkImage(WritableImage.java:278)
        at javafx.graphics/javafx.scene.image.WritableImage$1.loadTkImage(WritableImage.java:53)
        at javafx.graphics/javafx.scene.Scene.doSnapshot(Scene.java:1342)
        at javafx.graphics/javafx.scene.Node.doSnapshot(Node.java:2136)
        at javafx.graphics/javafx.scene.Node.snapshot(Node.java:2214)
        at test.javafx.scene.Snapshot2Test.lambda$doTestTiledSnapshotImm$12(Snapshot2Test.java:364)

test.javafx.scene.Snapshot2Test > testSnapshot2x1TilesSameSizeDefer[0] FAILED
    junit.framework.AssertionFailedError: Timeout waiting for snapshot callback
        at test.javafx.scene.SnapshotCommon.runDeferredSnapshotWait(SnapshotCommon.java:157)
        at test.javafx.scene.SnapshotCommon.runDeferredSnapshotWait(SnapshotCommon.java:183)
        at test.javafx.scene.Snapshot2Test.doTestTiledSnapshotDefer(Snapshot2Test.java:378)
        at test.javafx.scene.Snapshot2Test.testSnapshot2x1TilesSameSizeDefer(Snapshot2Test.java:459)

I would suggest to fill the image with a single or preferably some pattern of multiple recognizable colors instead of
noise. The noise gives a broken feel. It might confuse the verifications of any future fixes in this area. A well
defined color would be nice.


PR: https://git.openjdk.java.net/jfx/pull/112

More information about the openjfx-dev mailing list