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

Side by Side Diff: webrtc/modules/desktop_capture/desktop_geometry.h

Issue 2845213002: DesktopRect::UnionWith() to extend current rect to cover the input rect (Closed)
Patch Set: Resolve review comments Created 3 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 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 // Returns true if |point| lies within the rectangle boundaries. 118 // Returns true if |point| lies within the rectangle boundaries.
119 bool Contains(const DesktopVector& point) const; 119 bool Contains(const DesktopVector& point) const;
120 120
121 // Returns true if |rect| lies within the boundaries of this rectangle. 121 // Returns true if |rect| lies within the boundaries of this rectangle.
122 bool ContainsRect(const DesktopRect& rect) const; 122 bool ContainsRect(const DesktopRect& rect) const;
123 123
124 // Finds intersection with |rect|. 124 // Finds intersection with |rect|.
125 void IntersectWith(const DesktopRect& rect); 125 void IntersectWith(const DesktopRect& rect);
126 126
127 // Finds the minimum area to cover both |this| and |rect|. If |this| is empty,
Sergey Ulanov 2017/05/16 19:53:00 It's not clear from this comment that the result i
Hzj_jie 2017/05/16 23:04:18 Done.
128 // replaces |this| with |rect|; if |rect| is empty, this function takes no
129 // effect.
130 void UnionWith(const DesktopRect& rect);
131
127 // Adds (dx, dy) to the position of the rectangle. 132 // Adds (dx, dy) to the position of the rectangle.
128 void Translate(int32_t dx, int32_t dy); 133 void Translate(int32_t dx, int32_t dy);
129 void Translate(DesktopVector d) { Translate(d.x(), d.y()); }; 134 void Translate(DesktopVector d) { Translate(d.x(), d.y()); };
130 135
131 // Enlarges current DesktopRect by subtracting |left_offset| and |top_offset| 136 // Enlarges current DesktopRect by subtracting |left_offset| and |top_offset|
132 // from |left_| and |top_|, and adding |right_offset| and |bottom_offset| to 137 // from |left_| and |top_|, and adding |right_offset| and |bottom_offset| to
133 // |right_| and |bottom_|. This function does not normalize the result, so 138 // |right_| and |bottom_|. This function does not normalize the result, so
134 // |left_| and |top_| may be less than zero or larger than |right_| and 139 // |left_| and |top_| may be less than zero or larger than |right_| and
135 // |bottom_|. 140 // |bottom_|.
136 void Extend(int32_t left_offset, 141 void Extend(int32_t left_offset,
137 int32_t top_offset, 142 int32_t top_offset,
138 int32_t right_offset, 143 int32_t right_offset,
139 int32_t bottom_offset); 144 int32_t bottom_offset);
140 145
141 private: 146 private:
142 DesktopRect(int32_t left, int32_t top, int32_t right, int32_t bottom) 147 DesktopRect(int32_t left, int32_t top, int32_t right, int32_t bottom)
143 : left_(left), top_(top), right_(right), bottom_(bottom) { 148 : left_(left), top_(top), right_(right), bottom_(bottom) {
144 } 149 }
145 150
146 int32_t left_; 151 int32_t left_;
147 int32_t top_; 152 int32_t top_;
148 int32_t right_; 153 int32_t right_;
149 int32_t bottom_; 154 int32_t bottom_;
150 }; 155 };
151 156
152 } // namespace webrtc 157 } // namespace webrtc
153 158
154 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_GEOMETRY_H_ 159 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_GEOMETRY_H_
155 160
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/desktop_capture/desktop_geometry.cc » ('j') | webrtc/modules/desktop_capture/desktop_geometry.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698