| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/base/util.h" | 5 #include "remoting/base/util.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 int right = RoundToTwosMultiple(rect.right() + 1); | 214 int right = RoundToTwosMultiple(rect.right() + 1); |
| 215 int bottom = RoundToTwosMultiple(rect.bottom() + 1); | 215 int bottom = RoundToTwosMultiple(rect.bottom() + 1); |
| 216 return SkIRect::MakeLTRB(x, y, right, bottom); | 216 return SkIRect::MakeLTRB(x, y, right, bottom); |
| 217 } | 217 } |
| 218 | 218 |
| 219 SkIRect ScaleRect(const SkIRect& rect, | 219 SkIRect ScaleRect(const SkIRect& rect, |
| 220 const SkISize& in_size, | 220 const SkISize& in_size, |
| 221 const SkISize& out_size) { | 221 const SkISize& out_size) { |
| 222 int left = (rect.left() * out_size.width()) / in_size.width(); | 222 int left = (rect.left() * out_size.width()) / in_size.width(); |
| 223 int top = (rect.top() * out_size.height()) / in_size.height(); | 223 int top = (rect.top() * out_size.height()) / in_size.height(); |
| 224 int right = (rect.right() * out_size.width() + out_size.width() - 1) / | 224 int right = (rect.right() * out_size.width() + in_size.width() - 1) / |
| 225 in_size.width(); | 225 in_size.width(); |
| 226 int bottom = (rect.bottom() * out_size.height() + out_size.height() - 1) / | 226 int bottom = (rect.bottom() * out_size.height() + in_size.height() - 1) / |
| 227 in_size.height(); | 227 in_size.height(); |
| 228 return SkIRect::MakeLTRB(left, top, right, bottom); | 228 return SkIRect::MakeLTRB(left, top, right, bottom); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void CopyRect(const uint8* src_plane, | 231 void CopyRect(const uint8* src_plane, |
| 232 int src_plane_stride, | 232 int src_plane_stride, |
| 233 uint8* dest_plane, | 233 uint8* dest_plane, |
| 234 int dest_plane_stride, | 234 int dest_plane_stride, |
| 235 int bytes_per_pixel, | 235 int bytes_per_pixel, |
| 236 const SkIRect& rect) { | 236 const SkIRect& rect) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 // Copy bits. | 272 // Copy bits. |
| 273 CopyRect(source_buffer + source_offset, | 273 CopyRect(source_buffer + source_offset, |
| 274 source_stride, | 274 source_stride, |
| 275 dest_buffer + dest_offset, | 275 dest_buffer + dest_offset, |
| 276 dest_stride, | 276 dest_stride, |
| 277 GetBytesPerPixel(media::VideoFrame::RGB32), | 277 GetBytesPerPixel(media::VideoFrame::RGB32), |
| 278 SkIRect::MakeWH(dest_rect.width(), dest_rect.height())); | 278 SkIRect::MakeWH(dest_rect.width(), dest_rect.height())); |
| 279 } | 279 } |
| 280 | 280 |
| 281 } // namespace remoting | 281 } // namespace remoting |
| OLD | NEW |