On 08/02/2016 10:36 AM, Sergey Bylokhov wrote:
On 27.07.16 1:56, Jim Graham wrote:
Rectangle2D rClip = (Rectangle2D) usrClip;
int x0 = (int) Math.ceil(rClip.getMinX() - 0.5);
int y0 = (int) Math.ceil(rClip.getMinY() - 0.5);
int x1 = (int) Math.ceil(rClip.getMaxX() - 0.5);
int x1 = (int) Math.ceil(rClip.getMaxY() - 0.5);
clipRegion = devClip.getIntersectionXYXY(x0, y0, x1, y1);
Some work and testing should be done to see what happens when any of the
min/max/xy coordinates overflow an integer, but that would be the basic
gist of what we should be doing in that case in validateCompClip()...
Should we really take care about negative minXY/maxXY here? I assume
that negative coordinates will be skipped anyway when we interact them
with devClip. So it seems we can simply cast double to int here?
That might be possible if we were using floor(), but we are using ceil()
so casting is not a suitable substitute. I'd still rather see explicit
floor being used in cases like this that aren't in some sort of
per-pixel loop, but in either case, when we need a ceil() operation, we
can't rely on casting anyway...
...jim