Fix picking pixel on integer indices

The QImage.pixel() function should only get integers.
In theory an input position of -2,-2 would get rounded to 0 now. However that shouldn't occur because the user can't click outside of the window. And if it does occur, it's not really a problem either that it's theoretically picking a position inside of the window when you click slightly next to it.

Fixes #10785.
This commit is contained in:
Karl Nilsson 2021-11-18 11:36:20 +01:00 committed by Ghostkeeper
parent 3466404782
commit e0e227404f
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A

View File

@ -72,8 +72,8 @@ class PickingPass(RenderPass):
window_size = self._renderer.getWindowSize()
px = (0.5 + x / 2.0) * window_size[0]
py = (0.5 + y / 2.0) * window_size[1]
px = int((0.5 + x / 2.0) * window_size[0])
py = int((0.5 + y / 2.0) * window_size[1])
if px < 0 or px > (output.width() - 1) or py < 0 or py > (output.height() - 1):
return -1