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.

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

Commit messages:
 - Initial change

Changes: https://git.openjdk.org/jfx/pull/1400/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1400&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8255679
  Stats: 7 lines in 1 file changed: 1 ins; 1 del; 5 mod
  Patch: https://git.openjdk.org/jfx/pull/1400.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1400/head:pull/1400

PR: https://git.openjdk.org/jfx/pull/1400

Reply via email to