RFR: 8342098: Write a test to compare the images [v3]
Alexey Ivanov
aivanov at openjdk.org
Wed Oct 30 16:03:25 UTC 2024
On Wed, 30 Oct 2024 14:52:17 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> @aivanov-jdk
>> While creating the Canvas
>> drawImage(realImage, 10, 10, this)
>> 10 offset is used.
>>
>> Hence the start point coordinates also moved by 10 pixels
>> for capturing.
>
> Okay, I see that you offset the image on the canvas too.
>
> If you insist on using an offset, please declare a constant `OFFSET = 10` and use it everywhere instead of the ‘magic’ numbers: when painting to canvas, and when capturing the image.
>
> You used a constant for a delay that was used once but you don't create a constant to offset the image off edges that you use in two different places. If one place is updated, the other has to be updated as well. Using a constant does it all automatically.
> @aivanov-jdk While creating the Canvas drawImage(realImage, 10, 10, this) 10 offset is used.
>
> Hence the start point coordinates also moved by 10 pixels for capturing.
This is why _you should create a constant_ for this offset and use when drawing the image on the canvas and when capturing the screen.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21524#discussion_r1822931687
More information about the client-libs-dev
mailing list