[OpenJDK 2D-Dev] Please review patch for 7105461
linuxhippy at gmail.com
Sun Oct 7 13:41:17 UTC 2012
Thanks for your patience, sorry this bugfix review consumed so much time.
Please find the latest webrev at
The following changes were incooperated:
- Grab AWT lock consistently before entering the try/catch block.
- Clamp X/Y to Short.MAX_VALUE, and width/height to unsigned short,
X11 drawables may be larger than Short.MAX_VALUE which would cause
failure for rectangles with x/y outside [0, 32767].
I didn't take this into account the first time.
- dimAdd now used for x2/y2
- Protect against integer overflow in drawLine too, by using clipAdd.
> ... emcompassesXYXY and
> ecompassesXYWH will do that for you, the latter even uses dimAdd instead of
> clipAdd which points out that you probably wanted dimAdd for the x2,y2 in
> the first place - it will result in an empty rectangle if the dimension is
> <=0 which is appropriate for fillRect, and it will do it slightly faster
> than clipAdd I think.
Thanks for the pointer, I use dimAdd now directly.
> Also, it might be worth a comment that this isn't clipping code so much as
> making sure the values stay in range for the X protocol...
More information about the 2d-dev