-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
7001973: java/awt/Graphics2D/CopyAreaOOB.java fails #5491
Conversation
👋 Welcome back myano! A progress list of the required criteria for merging this PR into |
Webrevs
|
This test is quite strict and its purpose exactly check that the first paint() will properly render the windows content. |
I read JDK-6430601 and JDK-8198613, described at |
The test checks that the painting is correct, why it should check that a few times? If the paint method was called and the copyArea completed then why the window can be blank? |
The test checks only one time for painting "result". I think the painting sequence depends on rendering pipeline. I collected a log the Java2D and the ComponentPeer, then multiple PaintEvent is recorded with default D3D pipeline (see below). So, paint() should not be restrict one time.
|
Let's check the sequence in the test:
It is fine to have a few paint events posted for the code above, my question was why the first CopyArea is ignored? If the awt/java2d is not ready yet to draw/repaint the window that events should not be posted, if it is ready then CopyArea should work, no? |
This is a RepaintArea's behavior. clearRect() is called before paint() because shouldClearRectBeforePaint is true for Canvas. Then, if 2nd paint() is called and paint() does nothing, blank window will be drawn. |
So the "sun.awt.noerasebackground" property may fix the problem? Or simple freeze the EDT after g2d.copyArea? |
Yes. With paint() is called twice with default settings on Windows, so my suggested fix is more realistic and reasonable than original code with |
Yes, it is just a workaround that most probably will not work on other platforms. But EDT freeze for some time after copyarea will work.
Do you know why we post it twice? It does not seem right, since we repaint all content in the apps like Netbeans/Idea and it is quite a heavyweight operation. |
Because SurfaceData is judged to be lost when 1st getGraphics() is called on 1st PaintEvent processing. I traced PaintEvent, then I got following stacktrace.
At 1st PaintEvent is processing, RepaintArea calls getGraphics(), then D3DScreenUpdateManager finally calls new PaintEvent(). |
It does not look right, isn't it? Every time we show a frame we render its content twice, and the first rendering is always discarded. Probably we should validate the surface before we posting the first paint event and before we show the window. |
I think we should fix D3DScreenUpdateManager. I would like to create a new issue for it. But I think this test should be fixed, because the purpose of this test is to confirm the usual drawing result on default settings, then there is no need to restrict paint() one time. If the test that verifies paint() isn't called twice is needed, we should create a new test in the new bug id. |
You will not be able to write the test which will check that only one paint event is posted, it is not guaranteed. So for the test update, you can add a big delay after the rendering, and wait for what will occur on the screen, any ideas why it may not work? You also can create a separate bug to investigate how we can validate the surface before showing the window so we did not post more events than necessary. |
I understood what you wanted to test. I think all paint events can be examined by only checking at the end of paint(). So I moved checkRegion into paint() part. It also works fine in case of multi paint events happen when restoring Frame from the iconified status to normal status. |
@mrserb Could you please reply to the above comments and fix of test? |
This looks fine, but should be checked on other platforms Linux/macOS since it can uncover some issues there. |
@mrserb I have tested on Linux, and it worked fine. But I don't have MacOS environment. Could you test it instead of me? |
I'll check it, let me some time. |
@mrserb Thank you for helping me with the test. How many more days does the test run? |
@mrserb Could you please reply to the above comment? |
@mrserb How is the test running? Could you give me a reply? |
@mrserb Could you tell me how long it will take to run the test? |
@mrserb Could you please reply to the above comment? |
@mrserb I have tested on MacOS. The drawing result has no problem, and passed with no Exception. Please review this PR again. |
@mrserb Could you please review the above comments? |
@masyano This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 961 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@mrserb) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
@mrserb Could you please commit this fix as a sponsor? |
/sponsor |
Going to push as commit 22b7295.
Your commit was automatically rebased without conflicts. |
Could you please review the 7001973 fixes?
On Windows, CopyAreaOOB.java fails with a blank window. The cause of this problem is that paint() works one time only. Painting area is not guaranteed when showing a window.
I think this behavior should be removed for purpose of this test (
@summary: Verifies that copyArea() works properly
). Also, this program uses a Robot, but implements waiting logic by itself. This logic should be replaced to Robot API.This fix works fine in Windows, so this test can be removed from ProblemList.txt. I don't have a Mac environment, so can someone please confirm that this fix will work on Mac?
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5491/head:pull/5491
$ git checkout pull/5491
Update a local copy of the PR:
$ git checkout pull/5491
$ git pull https://git.openjdk.java.net/jdk pull/5491/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 5491
View PR using the GUI difftool:
$ git pr show -t 5491
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5491.diff