[Rev 01] RFR: 8234471: Canvas in webview displayed with wrong scale on Windows
Kevin Rushforth
kcr at openjdk.java.net
Tue Mar 24 14:21:37 UTC 2020
On Tue, 25 Feb 2020 07:11:43 GMT, Arun Joseph <ajoseph at openjdk.org> wrote:
>> This bug can be reproduced when the screen resolution is at 125%, 150% and 175% for Windows, which correpsonds to
>> `pixelScale` values of 1.25, 1.5 and 1.75, respectively.
>> Issue: The rectangle inside canvas is rendered on `pixelScale` while the borders are rendered on `Math.ceil(pixelScale)`
>>
>> Fix: Use `Math.ceil(pixelScale)` for calculating `pixelScaleTransform`
>
> Arun Joseph has updated the pull request incrementally with one additional commit since the last revision:
>
> Added CanvasTest
The fix looks good to me. I left one comment on the test.
tests/system/src/test/java/test/javafx/scene/web/CanvasTest.java line 125:
> 124: assertEquals("Rect bottom-right corner", redColor, (int) webView.getEngine().executeScript(
> 125: "document.getElementById('canvas').getContext('2d').getImageData(99, 99, 1, 1).data[0]"));
> 126: webViewStateLatch.countDown();
An assertion failure here will not be propagated outside the listener. A failure will be reported as a timeout rather
than an assertion failure.
I recommend moving the above two assertion checks to a `Util.runAndWait` block at the end of this method -- after the
await call for `webViewStateLatch`.
-------------
PR: https://git.openjdk.java.net/jfx/pull/62
More information about the openjfx-dev
mailing list