Index: remoting/base/util.cc |
diff --git a/remoting/base/util.cc b/remoting/base/util.cc |
index e960f09fbd21dc0867afaf9e76a09b919f0e8110..e14324a044ef9f6ba3b7cafffacda81656d527c0 100644 |
--- a/remoting/base/util.cc |
+++ b/remoting/base/util.cc |
@@ -148,14 +148,15 @@ SkIRect AlignRect(const SkIRect& rect) { |
} |
SkIRect ScaleRect(const SkIRect& rect, |
- double horizontal_ratio, |
- double vertical_ratio) { |
- int x = rect.fLeft * horizontal_ratio; |
- int y = rect.fTop * vertical_ratio; |
- int w = rect.fRight * horizontal_ratio - x; |
- int h = rect.fBottom * vertical_ratio - y; |
- |
- return SkIRect::MakeXYWH(x, y, w, h); |
+ const SkISize& in_size, |
+ const SkISize& out_size) { |
+ int x1 = (rect.fLeft * out_size.width()) / in_size.width(); |
Sergey Ulanov
2011/12/20 00:05:35
here and below, left() instead of fLeft?
Wez
2011/12/20 07:14:14
Done.
|
+ int y1 = (rect.fTop * out_size.height()) / in_size.height(); |
+ int x2 = (rect.fRight * out_size.width() + out_size.width()-1) / |
Sergey Ulanov
2011/12/20 00:05:35
nit: spaces around minus here and in the next line
Wez
2011/12/20 07:14:14
Done.
|
+ in_size.width(); |
+ int y2 = (rect.fBottom * out_size.height() + out_size.height()-1) / |
Sergey Ulanov
2011/12/20 00:05:35
maybe call it right and bottom instead of x2 and y
Sergey Ulanov
2011/12/20 00:05:35
I think it would be useful to add a comment saying
Wez
2011/12/20 07:14:14
Done.
Wez
2011/12/20 07:14:14
I've updated the comment on ScaleRect() in the hea
|
+ in_size.height(); |
+ return SkIRect::MakeXYWH(x1, y1, x2-x1, y2-y1); |
Sergey Ulanov
2011/12/20 00:05:35
Use MakeLTRB() here?
Wez
2011/12/20 07:14:14
Done.
|
} |
void CopyRect(const uint8* src_plane, |
@@ -164,7 +165,7 @@ void CopyRect(const uint8* src_plane, |
int dest_plane_stride, |
int bytes_per_pixel, |
const SkIRect& rect) { |
- // Get the address of the starting point. |
+ // Get the address of the starting point. |
const int src_y_offset = src_plane_stride * rect.fTop; |
const int dest_y_offset = dest_plane_stride * rect.fTop; |
const int x_offset = bytes_per_pixel * rect.fLeft; |