On Thu, 19 Jan 2023 08:23:15 GMT, Jayathirth D V <j...@openjdk.org> wrote:
>> This is the next iteration of fixing the issue of rendering "broken" image. >> The fix for [JDK-7183828](https://bugs.openjdk.org/browse/JDK-7183828) >> changed the possible IllegalArgumentException during rendering to the >> InvalidPipeException in assumtion that the new exception will be catched by >> the java2d machinery and the current-accelerated pipeline will be >> invalidated and software-pipeline will take care about that image. >> >> But that change uncover another bug, the accelerated-pipeline invalidation >> by the InvalidPipeException works in D3D pipeline only, other pipelines >> start to use software based surfaces, but do not report about that the >> client code, as a result the next code does not work as expected, since >> contentsLost alwys return false: >> >> do { >> vi.validate(gc); >> Graphics2D g = vi.createGraphics(); >> g.fillRect(0, 0, vi.getWidth(), vi.getHeight()); >> g.dispose(); >> } while (vi.contentsLost()); >> >> After this change the correct value will be reported by the contentsLost(), >> so the RepaintManager will be able to catch that. >> But this fix uncovered another bug. That fallback code path in the >> RepaintManager was not tested on HiDPI screen and does not work well. I'll >> file a separate bug about that. > > test/jdk/java/awt/image/VolatileImage/ReportRenderingError.java line 61: > >> 59: * >> 60: * @requires (os.family == "mac") >> 61: * @run main/othervm -Dsun.java2d.opengl=True ReportRenderingError > > I ran this test in macOS and without the fix it exits after checking only > OpenGL pipeline. We dont override restoreContents() in > CGLVolatileSurfaceManager/MTLVolatileSurfaceManager so its better if we can > force the test to run on all pipelines on individual platforms and not exit > on first failure based on jtreg instrcutions. This will make the test more > robust. This java file already contains 4 tests(each can be run/problemlists separately), one covers the default pipeline on all platforms, and the other 3 cover some platform specific just in case. > test/jdk/java/awt/image/VolatileImage/ReportRenderingError.java line 91: > >> 89: Graphics2D g = vi.createGraphics(); >> 90: g.setColor(Color.RED); >> 91: g.drawImage(image, 0, 0, null); // <- can cause >> InvalidPipeException > > This drawImage call is expected to through InvalidPipeException all the times > or is it intermittent? > If it is intermittent why so? Please explain. > > It looks like after https://github.com/openjdk/jdk/commit/8da6c8d6 we will > through InvalidPipeException for all cases of custom images and not > intermittently. It is not really intermittent but depends on the java2d pipeline currently in use. InvalidPipeException is produced by the accelerated pipelines but code works fine on GDI for example. ------------- PR: https://git.openjdk.org/jdk/pull/11664