RFR: 8342098: Write a test to compare the images [v3]

Alexey Ivanov aivanov at openjdk.org
Mon Oct 21 13:57:25 UTC 2024


On Mon, 21 Oct 2024 12:00:17 GMT, Naveen Narayanan <duke at openjdk.org> wrote:

>> test/jdk/java/awt/Robot/ScreenCaptureRobotTest.java line 119:
>> 
>>> 117: 
>>> 118:         imgWidth = capturedImg.getWidth(null);
>>> 119:         imgHeight = capturedImg.getHeight(null);
>> 
>> These variables can be removed and `capturedImg.getWidth(null)` should replace `imgWidth` in for-loop condition. same for `imgHeight` also.
>
> @kumarabhi006 
> In that case, 
> capturedImg.getWidth(null);
> capturedImg.getHeight(null)
> will be calculated in every iteration of for loops right.
> May be an extra Memory/Processor burden ?

If you declare the size of the image as constants, you will always know the size of the images.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21524#discussion_r1808844638


More information about the client-libs-dev mailing list