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

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

Issue 8954003: Revised sub-rectangle scaling for use in Chromoting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Replace bounds-check on loop with a DCHECK. Created 9 years 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
OLDNEW
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 #ifndef REMOTING_BASE_UTIL_H_ 5 #ifndef REMOTING_BASE_UTIL_H_
6 #define REMOTING_BASE_UTIL_H_ 6 #define REMOTING_BASE_UTIL_H_
7 7
8 #include <string>
9
8 #include "media/base/video_frame.h" 10 #include "media/base/video_frame.h"
9 #include "third_party/skia/include/core/SkRect.h" 11 #include "third_party/skia/include/core/SkRect.h"
10 12
11 namespace remoting { 13 namespace remoting {
12 14
13 std::string GetTimestampString(); 15 std::string GetTimestampString();
14 16
15 // TODO(sergeyu): Move these methods to media. 17 // TODO(sergeyu): Move these methods to media.
16 int GetBytesPerPixel(media::VideoFrame::Format format); 18 int GetBytesPerPixel(media::VideoFrame::Format format);
17 19
18 // Convert YUV to RGB32 on a specific rectangle. 20 // Convert YUV to RGB32 on a specific rectangle.
19 void ConvertYUVToRGB32WithRect(const uint8* y_plane, 21 void ConvertYUVToRGB32WithRect(const uint8* y_plane,
20 const uint8* u_plane, 22 const uint8* u_plane,
21 const uint8* v_plane, 23 const uint8* v_plane,
22 uint8* rgb_plane, 24 uint8* rgb_plane,
23 const SkIRect& rect, 25 const SkIRect& rect,
24 int y_stride, 26 int y_stride,
25 int uv_stride, 27 int uv_stride,
26 int rgb_stride); 28 int rgb_stride);
27 29
28 void ScaleYUVToRGB32WithRect(const uint8* y_plane,
29 const uint8* u_plane,
30 const uint8* v_plane,
31 uint8* rgb_plane,
32 const SkIRect& source_rect,
33 const SkIRect& dest_rect,
34 int y_stride,
35 int uv_stride,
36 int rgb_stride);
37
38 void ConvertRGB32ToYUVWithRect(const uint8* rgb_plane, 30 void ConvertRGB32ToYUVWithRect(const uint8* rgb_plane,
39 uint8* y_plane, 31 uint8* y_plane,
40 uint8* u_plane, 32 uint8* u_plane,
41 uint8* v_plane, 33 uint8* v_plane,
42 int x, 34 int x,
43 int y, 35 int y,
44 int width, 36 int width,
45 int height, 37 int height,
46 int rgb_stride, 38 int rgb_stride,
47 int y_stride, 39 int y_stride,
48 int uv_stride); 40 int uv_stride);
49 41
50 int RoundToTwosMultiple(int x); 42 int RoundToTwosMultiple(int x);
51 43
52 // Align the sides of the rectangle to multiples of 2 (expanding outwards). 44 // Align the sides of the rectangle to multiples of 2 (expanding outwards).
53 SkIRect AlignRect(const SkIRect& rect); 45 SkIRect AlignRect(const SkIRect& rect);
54 46
55 // Return a scaled rectangle using the horizontal and vertical scale 47 // Scale a rectangle by horizontal and vertical factors. If the result has
56 // factors. 48 // non-integer coordinates then the smallest integer-coordinate rectangle that
49 // wholly encloses it is returned.
57 SkIRect ScaleRect(const SkIRect& rect, 50 SkIRect ScaleRect(const SkIRect& rect,
58 double horizontal_ratio, 51 double horizontal_ratio,
59 double vertical_ratio); 52 double vertical_ratio);
60 53
61 // Copy pixels in the rectangle from source to destination. 54 // Copy pixels in the rectangle from source to destination.
62 void CopyRect(const uint8* src_plane, 55 void CopyRect(const uint8* src_plane,
63 int src_plane_stride, 56 int src_plane_stride,
64 uint8* dest_plane, 57 uint8* dest_plane,
65 int dest_plane_stride, 58 int dest_plane_stride,
66 int bytes_per_pixel, 59 int bytes_per_pixel,
67 const SkIRect& rect); 60 const SkIRect& rect);
68 61
69 } // namespace remoting 62 } // namespace remoting
70 63
71 #endif // REMOTING_BASE_UTIL_H_ 64 #endif // REMOTING_BASE_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698