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

Side by Side Diff: webrtc/modules/desktop_capture/win/dxgi_adapter_duplicator.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 if (error.Error() != S_OK || !output1) { 69 if (error.Error() != S_OK || !output1) {
70 LOG(LS_WARNING) << "Failed to convert IDXGIOutput to IDXGIOutput1, " 70 LOG(LS_WARNING) << "Failed to convert IDXGIOutput to IDXGIOutput1, "
71 "this usually means the system does not support " 71 "this usually means the system does not support "
72 "DirectX 11"; 72 "DirectX 11";
73 return false; 73 return false;
74 } 74 }
75 duplicators_.emplace_back(device_, output1, desc); 75 duplicators_.emplace_back(device_, output1, desc);
76 if (!duplicators_.back().Initialize()) { 76 if (!duplicators_.back().Initialize()) {
77 return false; 77 return false;
78 } 78 }
79 if (desktop_rect_.is_empty()) { 79 desktop_rect_.UnionWith(duplicators_.back().desktop_rect());
80 desktop_rect_ = duplicators_.back().desktop_rect();
81 } else {
82 const DesktopRect& left = desktop_rect_;
83 const DesktopRect& right = duplicators_.back().desktop_rect();
84 desktop_rect_ =
85 DesktopRect::MakeLTRB(std::min(left.left(), right.left()),
86 std::min(left.top(), right.top()),
87 std::max(left.right(), right.right()),
88 std::max(left.bottom(), right.bottom()));
89 }
90 } 80 }
91 } else { 81 } else {
92 LOG(LS_WARNING) << "Failed to get output description of device " << i 82 LOG(LS_WARNING) << "Failed to get output description of device " << i
93 << ", ignore."; 83 << ", ignore.";
94 } 84 }
95 } 85 }
96 return true; 86 return true;
97 } 87 }
98 88
99 void DxgiAdapterDuplicator::Setup(Context* context) { 89 void DxgiAdapterDuplicator::Setup(Context* context) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 144
155 void DxgiAdapterDuplicator::TranslateRect(const DesktopVector& position) { 145 void DxgiAdapterDuplicator::TranslateRect(const DesktopVector& position) {
156 desktop_rect_.Translate(position); 146 desktop_rect_.Translate(position);
157 RTC_DCHECK(desktop_rect_.left() >= 0 && desktop_rect_.top() >= 0); 147 RTC_DCHECK(desktop_rect_.left() >= 0 && desktop_rect_.top() >= 0);
158 for (auto& duplicator : duplicators_) { 148 for (auto& duplicator : duplicators_) {
159 duplicator.TranslateRect(position); 149 duplicator.TranslateRect(position);
160 } 150 }
161 } 151 }
162 152
163 } // namespace webrtc 153 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698