clipMaxX = Math.min(clipMaxX, dx2);
} else {
// xdenom == 0, all points have same x coordinate as the first
if (s_ix < src_rect_x1 || s_ix >= src_rect_x2) {
clipMinX = clipMaxX = dst_min_x;
return new Range(Integer.class,
new Integer(clipMinX),
new Integer(clipMaxX));
}
}
long ydenom = incy*geom_frac_max + ifracdy;
if (ydenom != 0) {
long clipy1 = (long)src_rect_y1 + tpad;
long clipy2 = (long)src_rect_y2 - bpad;
long y1 = ((clipy1 - s_iy)*geom_frac_max - ifracy) +
dst_min_x*ydenom;
long y2 = ((clipy2 - s_iy)*geom_frac_max - ifracy) +
dst_min_x*ydenom;
// Moving backwards, switch roles of top and bottom edges
if (ydenom < 0) {
long tmp = y1;
y1 = y2;
y2 = tmp;
}
int dx1 = ceilRatio(y1, ydenom);
clipMinX = Math.max(clipMinX, dx1);
int dx2 = floorRatio(y2, ydenom) + 1;
clipMaxX = Math.min(clipMaxX, dx2);
} else {
// ydenom == 0, all points have same y coordinate as the first
if (s_iy < src_rect_y1 || s_iy >= src_rect_y2) {
clipMinX = clipMaxX = dst_min_x;
}
}
if (clipMinX > dst_max_x)
clipMinX = dst_max_x;
if (clipMaxX < dst_min_x)
clipMaxX = dst_min_x;
return new Range(Integer.class,
new Integer(clipMinX),
new Integer(clipMaxX));
}