On Wed, 13 Mar 2024 08:56:13 GMT, Jayathirth D V <j...@openjdk.org> wrote:

> Updated test to get screen capture in different platforms to see how we are 
> picking colors. Found that this test fails because it assumes that red,green 
> & blue bands in the test image are of equal size and picks color based on 
> that assumption.
> 
> If we take 20 * 20 aligned image, each scanline is 3 red pixels -> 3 green 
> pixels -> 8 blue pixels -> 3 green pixels -> 3 red pixels. So the blue pixels 
> actually acquire more space in a scanline. Even in y direction pattern is 
> same.
> 
> If we 48 * 48 unaligned image, each scanline is 7 red pixels -> 8 green 
> pixels -> 19 blue pixels -> 7 green pixels -> 7 red pixels. So the blue 
> pixels actually acquire more space in a scanline. Even in y direction pattern 
> is same.
> 
> So when this 48 * 48 image is scaled to 336 * 336 in case of 
> unalignedImage_Cover, we are calculating picking point for green color in 
> such a way that it is hitting border of green and blue bands and test is 
> failing. Only in this specific scenario we are scaling by large amount and 
> the inappropriate color picking logic is failing.
> 
> Updated color picking logic in such a way that appropriate weightage is given 
> to each color and we pick that color properly even when we have large 
> scaling. With this change test is passing on all platforms and there are no 
> regressions seen in all test run.

The fix looks good.
Verified that if enabled, the test fails without this fix and passes with it. 
Tested on macOS 14.

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

Marked as reviewed by aghaisas (Reviewer).

PR Review: https://git.openjdk.org/jfx/pull/1400#pullrequestreview-1936203035

Reply via email to