OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.h" |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "media/base/video_frame.h" | 8 #include "media/base/video_frame.h" |
9 #include "media/base/yuv_convert.h" | 9 #include "media/base/yuv_convert.h" |
10 #include "remoting/base/util.h" | 10 #include "remoting/base/util.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 scaled_rect.set_height( | 154 scaled_rect.set_height( |
155 rect.bottom() * vertical_ratio - scaled_rect.y()); | 155 rect.bottom() * vertical_ratio - scaled_rect.y()); |
156 return scaled_rect; | 156 return scaled_rect; |
157 } | 157 } |
158 | 158 |
159 void CopyRect(const uint8* src_plane, | 159 void CopyRect(const uint8* src_plane, |
160 int src_plane_stride, | 160 int src_plane_stride, |
161 uint8* dest_plane, | 161 uint8* dest_plane, |
162 int dest_plane_stride, | 162 int dest_plane_stride, |
163 int bytes_per_pixel, | 163 int bytes_per_pixel, |
164 const gfx::Rect& rect) { | 164 const SkIRect& rect) { |
165 // Get the address of the starting point. | 165 // Get the address of the starting point. |
166 const int src_y_offset = src_plane_stride * rect.y(); | 166 const int src_y_offset = src_plane_stride * rect.fTop; |
167 const int dest_y_offset = dest_plane_stride * rect.y(); | 167 const int dest_y_offset = dest_plane_stride * rect.fTop; |
168 const int x_offset = bytes_per_pixel * rect.x(); | 168 const int x_offset = bytes_per_pixel * rect.fLeft; |
169 src_plane += src_y_offset + x_offset; | 169 src_plane += src_y_offset + x_offset; |
170 dest_plane += dest_y_offset + x_offset; | 170 dest_plane += dest_y_offset + x_offset; |
171 | 171 |
172 // Copy pixels in the rectangle line by line. | 172 // Copy pixels in the rectangle line by line. |
173 const int bytes_per_line = bytes_per_pixel * rect.width(); | 173 const int bytes_per_line = bytes_per_pixel * rect.width(); |
174 const int height = rect.height(); | 174 const int height = rect.height(); |
175 for (int i = 0 ; i < height; ++i) { | 175 for (int i = 0 ; i < height; ++i) { |
176 memcpy(dest_plane, src_plane, bytes_per_line); | 176 memcpy(dest_plane, src_plane, bytes_per_line); |
177 src_plane += src_plane_stride; | 177 src_plane += src_plane_stride; |
178 dest_plane += dest_plane_stride; | 178 dest_plane += dest_plane_stride; |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
182 } // namespace remoting | 182 } // namespace remoting |
OLD | NEW |