I have a window with a global scale factor different than 1.0. This could for instance happen on a desktop with a DPI setting of more than 96DPI. This window has a subcomponent which displays an image. This image can be zoomed in and out, but if the zoom setting is 100%, then the image should be displayed with 1 image pixel = 1 display pixel, independent of the DPI setting.
Now, if you just apply a scale of 1 / getGlobalScaleFactor(), then the scale is correct but the alignment of the pixels is wrong, so every pixel of the image gets spread over 2×2 adjacent pixels on the screen, which slightly blurs the image.
Is it possible to figure out the exact physical screen bounds of a component? There are a lot of functions in Component and ComponentPeer but all of them seem to round the returned coordinates to integers.