Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: remoting/base/util.cc

Issue 9331003: Improving the decoder pipeline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Integer ScaleRect Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/base/decoder_vp8.cc ('k') | remoting/client/chromoting_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « remoting/base/decoder_vp8.cc ('k') | remoting/client/chromoting_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698