JDK-8115150 : Canvas clip not working properly on Windows
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: 7u21,8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-05-06
  • Updated: 2015-06-17
  • Resolved: 2013-08-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7u40Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
In my application I have a ScrollPane containing an AnchorPane as Content.
This AnchorPane has several HBoxes as children. Each contains a Canvas.
When the application runs and my mouse hovers over the ScrollPane or when I scroll, the Canvases suddenly start popping up even though they should be out of view.

Screenshot: https://dl.dropboxusercontent.com/u/51537629/images%20drawn%20outside%20of%20viewport.png

After some more testing it seems this bug only appears on Windows systems and not on Linux systems. No idea about Mac systems though.

I have created a small testcase since I can't publish more code of the application itself:
https://dl.dropboxusercontent.com/u/51537629/Drawing.java

The Java-file makes use of the following image:
https://dl.dropboxusercontent.com/u/51537629/dna.png

I have also tried using the latest jfx8 build, but the problem remains present.
Comments
Reopen because it was verified in 2.2.40 but Lombard is also affected.
27-08-2013

Verified in JDK 1.7.0_40b39 (JavaFX 2.2.40 b39) using attached applications.
27-08-2013

The fix is in 7u40-b37
03-08-2013

+1 to get this into 7u40 in any way possible. This is a big deal.
03-08-2013

Attaching 2 test cases that show the problem. Animate1App is standalone and as the small rectangles animate over the big yellow rectangle they should remain in front of it at all times - if they disappear behind it then there is a bug. Drawing uses the dna.png image and if you scroll the tiny pane back and forth you will see copies of the "beaker" image escape from its bounds and render on the rest of the window. You can drag the window larger if you want to see the problem more, but there should be enough space in the standard sized window to see the clipping errors.
01-08-2013

Dev is so sure that this fix is safe that Kevin will attach a program to verify and SQE do not need to retest Graphics.
01-08-2013

From SQE perspective it is already too late. It makes sense to bring the bug to RT attention if dev still want's it to get in.
01-08-2013

I think this forum thread ( canvas render bug => https://forums.oracle.com/thread/2563827 ) may also be related to instances of this bug, where a couple of users report similar issues ( screenshot => http://imgur.com/a/RdJDQ ). One of the things which makes it seem related is the comment in the forum "only on the windows platform there is a strange render bug", and looking at the fix for this issue, it only applies to Windows.
01-08-2013

The submitter of RT-30591 has confirmed that the application in that report is using Canvas and believes that it is a duplicate of this bug. That makes 4 issues reported against this same underlying bug.
31-07-2013

There are no programmatic workarounds. A different pipeline can be used for testing, but that is not an option for application deployment.
31-07-2013

The symptoms from RT-30591 make it highly likely that this fourth reported issue may also be caused by this same underlying problem. Unfortunately, no isolated test case could be constructed for that report and until a build with this fix gets out to that developer, we can only go by the suspiciously similar symptoms.
31-07-2013

The reason we are making the request is that several developers have run into this (as evidenced by the stackoverflow threads and the three separate bug reports that all turned out to be the same bug). It is a safe fix, but you are right that it isn't a regression nor is it a blocker for anything.
31-07-2013

SQE does not see enough justification to take the fix that late in cycle. It is not a regression. It is not escalated. It is not blocking anything as far as we know.
31-07-2013

Fix pushed to the 2u/dev workspace with the following changeset: changeset: 16717:33a5e5ee548a date: Wed Jul 31 06:37:03 2013 -0700 summary: Fix RT-30223, RT-30826, RT-31044 - Canvas clears clip on Windows/D3D http://jfxsrc.us.oracle.com/javafx/2u/dev/rt-closed/rev/33a5e5ee548a
31-07-2013

The same fix was applied to the 8.0 graphics scrum with the following changeset: changeset: 4511:dd02ad45b83c date: Wed Jul 31 06:49:21 2013 -0700 summary: Fix RT-30223, RT-30826, RT-31044 - Canvas clears clip on Windows/D3D http://jfxsrc.us.oracle.com/javafx/8.0/scrum/graphics/rt/rev/dd02ad45b83c
31-07-2013

Dev / OK for 2.2.40
31-07-2013

Justification for 2.2.40. This bug was originally filed back in May and represented a problem for a developer in the field using 2.2.21, but was incorrectly tagged as affecting Lombard. As a result, it slipped through the triage cracks for 2.2.40 bugs and was only coincidentally targeted for fixing during Lombard at this time. The fix, just discovered, is pretty safe and backed up by documentation on the Microsoft site for how to use scissor clips with the SetRenderTarget function, so we should get this in to 2.2.40 if we can to avoid passing it on to the next release. Related Microsoft documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/bb147354(v=vs.85).aspx
31-07-2013

Tried the test case, here is a screenshot of the bug, taken on my system: http://imgur.com/wVH2gcX It looks fine, until you try to scroll left and right, at which point the pieces of the canvas that are outside the scrollpane's viewport appear. When I run wirh -Dprism.order=j2d there's no problem. Below is the output when using -Dprism.verbose=true Prism pipeline init order: d3d j2d Using t2k for text rasterization Using dirty region optimizations Prism pipeline name = com.sun.prism.d3d.D3DPipeline Loading D3D native library ... succeeded. Direct3D initialization succeeded (X) Got class = class com.sun.prism.d3d.D3DPipeline Initialized prism pipeline: com.sun.prism.d3d.D3DPipeline Maximum supported texture size: 16384 Maximum texture size clamped to 4096 OS Information: Windows 7 build 7601 D3D Driver Information: AMD Radeon HD 6900 Series \\.\DISPLAY1 Driver aticfx64.dll, version 8.17.10.1191 Pixel Shader version 3.0 Device : ven_1002, dev_6718, subsys_31301682 new alphas
31-07-2013

I tried the test case, but I do not see any rendering anomalies. What should I look for and what should I be seeing when the bug happens? This is on a MBP running Windows 7 with the D3D pipeline.
31-07-2013

I was finally able to reproduce it with a JavaFX 2udev build. The fix targeted for RT-30826 appears to fix this test case as well.
31-07-2013

Thanks for the testcase. This works properly on Mac, so is unlikely to be a ScrollPane bug. It's most likely that this is a rendering/clip problem, as ScrollPanes use clips to contain their contents.
03-06-2013

This issue shouldn't have been re-opened without an evaluation.
28-05-2013

A testcase has now been submitted.
28-05-2013

Still no testcase, and no reply from filer after two weeks. Let me know if you get a testcase, and I can re-open.
23-05-2013

I rather a self-contained testcase that compiles and runs. This is just a collection of code snippets, and even at that they don't look complete. Take this line for example : vbox.getChildren().addAll(canvas, My guess is that you're hitting some kind of clipping bug, but I can't tell for sure. I you can't supply a testcase then can you try it on the latest promoted jfx8 build?
07-05-2013

I'm using JavaFX 2.2.21 so the latest version. My test case can be viewed here: http://stackoverflow.com/questions/15765034/javafx-scrollpane-showing-objects-outside-of-viewport
07-05-2013

Do you have a test case? Which version are you reporting this against?
07-05-2013

Assign to controls for initial evaluation although this may be a Graphics issue.
06-05-2013