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

Unified Diff: webrtc/modules/desktop_capture/desktop_geometry.cc

Issue 2845213002: DesktopRect::UnionWith() to extend current rect to cover the input rect (Closed)
Patch Set: Sync latest changes 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/desktop_capture/desktop_geometry.cc
diff --git a/webrtc/modules/desktop_capture/desktop_geometry.cc b/webrtc/modules/desktop_capture/desktop_geometry.cc
index 2af8cf826e4dc70193e58569b0e6824eddc140de..33d6070cf25cd8dcced79bedbdd4110598a2c258 100644
--- a/webrtc/modules/desktop_capture/desktop_geometry.cc
+++ b/webrtc/modules/desktop_capture/desktop_geometry.cc
@@ -37,6 +37,22 @@ void DesktopRect::IntersectWith(const DesktopRect& rect) {
}
}
+void DesktopRect::UnionWith(const DesktopRect& rect) {
+ if (is_empty()) {
+ *this = rect;
+ return;
+ }
+
+ if (rect.is_empty()) {
+ return;
+ }
+
+ left_ = std::min(left(), rect.left());
+ top_ = std::min(top(), rect.top());
+ right_ = std::max(right(), rect.right());
+ bottom_ = std::max(bottom(), rect.bottom());
+}
+
void DesktopRect::Translate(int32_t dx, int32_t dy) {
left_ += dx;
top_ += dy;
« no previous file with comments | « webrtc/modules/desktop_capture/desktop_geometry.h ('k') | webrtc/modules/desktop_capture/mac/desktop_configuration.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698