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

Side by Side Diff: media/base/video_util.h

Issue 1135823004: Implement all resolution change policies for desktop and tab capture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@resolution_change_policy_constraints_ITEM1_CR1
Patch Set: Addressed Wez's third round comments. Created 5 years, 7 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
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 #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
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 |size| is
89 // preserved as closely as possible. If |size| is empty, the result will be
90 // empty.
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 |size| is
96 // preserved as closely as possible. If |size| is empty, the result will be
97 // empty.
98 MEDIA_EXPORT gfx::Size ScaleSizeToEncompassTarget(const gfx::Size& size,
99 const gfx::Size& target);
100
101 // Returns |size| with only one of its dimensions increased such that the result
102 // matches the aspect ratio of |target|. This is different from
103 // ScaleSizeToEncompassTarget() in two ways: 1) The goal is to match the aspect
104 // ratio of |target| rather than that of |size|. 2) Only one of the dimensions
105 // of |size| may change, and it may only be increased (padded). If either
106 // |size| or |target| is empty, the result will be empty.
107 MEDIA_EXPORT gfx::Size PadToMatchAspectRatio(const gfx::Size& size,
108 const gfx::Size& target);
109
87 // Copy an RGB bitmap into the specified |region_in_frame| of a YUV video frame. 110 // 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. 111 // Fills the regions outside |region_in_frame| with black.
89 MEDIA_EXPORT void CopyRGBToVideoFrame(const uint8* source, 112 MEDIA_EXPORT void CopyRGBToVideoFrame(const uint8* source,
90 int stride, 113 int stride,
91 const gfx::Rect& region_in_frame, 114 const gfx::Rect& region_in_frame,
92 VideoFrame* frame); 115 VideoFrame* frame);
93 116
94 } // namespace media 117 } // namespace media
95 118
96 #endif // MEDIA_BASE_VIDEO_UTIL_H_ 119 #endif // MEDIA_BASE_VIDEO_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698