On Sat, 31 May 2025 00:59:49 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:
>> @mrserb >> >> Added back Toolkit.sync() and canvas capture to paint method. Although I'm >> not sure if I understood _"each render frame"_ correctly. Can you please >> explain? >> >> >> BufferedImage capture = null; >> try { >> Thread.sleep(500); >> if (robot == null) robot = new Robot(); >> Point pt1 = getLocationOnScreen(); >> Rectangle rect = new Rectangle(pt1.x, pt1.y, 400, 400); >> capture = robot.createScreenCapture(rect); >> } catch (Exception e) { >> throw new RuntimeException("Problems handling Robot"); >> } >> // Test pixels >> testRegion(capture, "green", 0, 0, 400, 10, 0xff00ff00); >> testRegion(capture, "original red", 0, 10, 50, 400, 0xffff0000); >> testRegion(capture, "background", 50, 10, 60, 400, 0xff000000); >> testRegion(capture, "in-between", 60, 10, 110, 20, 0xff000000); >> testRegion(capture, "copied red", 60, 20, 110, 400, 0xffff0000); >> testRegion(capture, "background", 110, 10, 400, 400, 0xff000000); >> >> >> Isn't capture going to be the same image throughout? I'm not sure why it is >> passed as an extra argument to testRegion. It can be saved once as static >> BufferedImage var and the same can be used for testing or am I missing >> something? > >> Added back Toolkit.sync() and canvas capture to paint method. Although I'm >> not sure if I understood _"each render frame"_ correctly. Can you please >> explain? > > The paint method may be invoked multiple times after the frame becomes > visible, so the validation logic inside paint will be executed for each > rendering data. oh okay, although when I debug I don't see paint method being called multiple times. Probably the case when frame is resized or screen configuration changes? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25279#discussion_r2121957234