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 #ifndef MEDIA_BASE_VIDEO_UTIL_H_ | 5 #ifndef MEDIA_BASE_VIDEO_UTIL_H_ |
6 #define MEDIA_BASE_VIDEO_UTIL_H_ | 6 #define MEDIA_BASE_VIDEO_UTIL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "media/base/media_export.h" | 9 #include "media/base/media_export.h" |
10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 int rotation, // Clockwise. | 77 int rotation, // Clockwise. |
78 bool flip_vert, | 78 bool flip_vert, |
79 bool flip_horiz); | 79 bool flip_horiz); |
80 | 80 |
81 // Return the largest centered rectangle with the same aspect ratio of |content| | 81 // Return the largest centered rectangle with the same aspect ratio of |content| |
82 // that fits entirely inside of |bounds|. If |content| is empty, its aspect | 82 // that fits entirely inside of |bounds|. If |content| is empty, its aspect |
83 // ratio would be undefined; and in this case an empty Rect would be returned. | 83 // ratio would be undefined; and in this case an empty Rect would be returned. |
84 MEDIA_EXPORT gfx::Rect ComputeLetterboxRegion(const gfx::Rect& bounds, | 84 MEDIA_EXPORT gfx::Rect ComputeLetterboxRegion(const gfx::Rect& bounds, |
85 const gfx::Size& content); | 85 const gfx::Size& content); |
86 | 86 |
87 // Return a scaled |size| whose area is less than or equal to |target|, where | |
88 // one of its dimensions is equal to |target|'s. The aspect ratio of the result | |
89 // is preserved as closely as possible. If |size| is empty, its aspect ratio | |
Wez
2015/05/13 19:05:09
nit: Aspect ratio of |size| is preserved as closel
miu
2015/05/14 01:21:33
Done.
| |
90 // would be undefined; and in this case an empty Size would be returned. | |
91 MEDIA_EXPORT gfx::Size ScaleSizeToFitWithinTarget(const gfx::Size& size, | |
92 const gfx::Size& target); | |
93 | |
94 // Return a scaled |size| whose area is greater than or equal to |target|, where | |
95 // one of its dimensions is equal to |target|'s. The aspect ratio of the result | |
96 // is preserved as closely as possible. If |size| is empty, its aspect ratio | |
Wez
2015/05/13 19:05:09
nit: You mean the aspect ratio of |size| is preser
miu
2015/05/14 01:21:33
Done.
| |
97 // would be undefined; and in this case an empty Size would be returned. | |
Wez
2015/05/13 19:05:09
I'd suggest just saying that the result is always
miu
2015/05/14 01:21:33
Done.
| |
98 MEDIA_EXPORT gfx::Size ScaleSizeToEncompassTarget(const gfx::Size& size, | |
99 const gfx::Size& target); | |
100 | |
101 // Returns |size| with one of its dimensions increased such that the result | |
102 // matches the aspect ratio of |target|. If |target| is empty, its aspect ratio | |
Wez
2015/05/13 19:05:09
It's not immediately obvious how this differs from
miu
2015/05/14 01:21:33
Done. Elaborated further in the comment.
| |
103 // would be undefined; and in this case an empty Size would be returned. | |
Wez
2015/05/13 19:05:09
Surely the same is true if |size| is empty?
Sugge
miu
2015/05/14 01:21:33
Yes.
| |
104 MEDIA_EXPORT gfx::Size PadToMatchAspectRatio(const gfx::Size& size, | |
105 const gfx::Size& target); | |
106 | |
87 // Copy an RGB bitmap into the specified |region_in_frame| of a YUV video frame. | 107 // Copy an RGB bitmap into the specified |region_in_frame| of a YUV video frame. |
88 // Fills the regions outside |region_in_frame| with black. | 108 // Fills the regions outside |region_in_frame| with black. |
89 MEDIA_EXPORT void CopyRGBToVideoFrame(const uint8* source, | 109 MEDIA_EXPORT void CopyRGBToVideoFrame(const uint8* source, |
90 int stride, | 110 int stride, |
91 const gfx::Rect& region_in_frame, | 111 const gfx::Rect& region_in_frame, |
92 VideoFrame* frame); | 112 VideoFrame* frame); |
93 | 113 |
94 } // namespace media | 114 } // namespace media |
95 | 115 |
96 #endif // MEDIA_BASE_VIDEO_UTIL_H_ | 116 #endif // MEDIA_BASE_VIDEO_UTIL_H_ |
OLD | NEW |