Rect ScaledPixelBuffer::calculateScaleBoundary(const Rect& r) {
static int x_start, y_start, x_end, y_end;
- x_start = r.tl.x == 0 ? 0 : ceil((r.tl.x-1) * scale_ratio);
- y_start = r.tl.y == 0 ? 0 : ceil((r.tl.y-1) * scale_ratio);
- x_end = ceil(r.br.x * scale_ratio - 1);
+ x_start = r.tl.x == 0 ? 0 : int(ceil((r.tl.x-1) * scale_ratio));
+ y_start = r.tl.y == 0 ? 0 : int(ceil((r.tl.y-1) * scale_ratio));
+ x_end = int(ceil(r.br.x * scale_ratio - 1));
x_end = x_end < scaled_width ? x_end + 1 : scaled_width;
- y_end = ceil(r.br.y * scale_ratio - 1);
+ y_end = int(ceil(r.br.y * scale_ratio - 1));
y_end = y_end < scaled_height ? y_end + 1 : scaled_height;
return Rect(x_start, y_start, x_end, y_end);
}