<AWT Dev> [13] Review Request: 8225118 Robot.createScreenCapture() returns black image on HiDPI linux with gtk3
Anton Tarasov
anton.tarasov at jetbrains.com
Fri May 31 16:11:46 UTC 2019
Hi All!
Please review the fix for JDK 13:
Bug: https://bugs.openjdk.java.net/browse/JDK-8225118
Fix: http://cr.openjdk.java.net/~ant/JDK-8225118/webrev.0
The problem with Robot.createScreenCapture() on gtk3 is in the following
function call (quoting from gtk3_interface.h):
fp_gdk_pixbuf_get_from_drawable = dl_symbol("gdk_pixbuf_get_from_window")
which, as you can see, is resolved to another function in gtk3 (unlike
gtk2) due to its deprecation.
The spec [1] states that the passed size is scaled:
"the width and height arguments scaled by the scale factor of window"
however this fact is not taken into account and so the returned pixbuf has
wrong size and is then ignored.
To meet the spec, I retrieve the root window scale and downscale the size,
ceiling the result. Also, I weaken the condition where the pixbuf size is
compared to the passed size, from "==" to ">=". My reasoning is this:
1) The original passed size (of the screen) may appear to be lossy due to
downscaling/upscaling ops.
2) The weakened condition is enough for the valid pixbuf copying.
The test (which I've modified to allow its run on Linux) reproduces the
issue.
With regards,
Anton.
[1]
https://developer.gnome.org/gdk3/stable/gdk3-Pixbufs.html#gdk-pixbuf-get-from-window
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/awt-dev/attachments/20190531/991bd3be/attachment.html>
More information about the awt-dev
mailing list