OLD | NEW |
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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } else { | 187 } else { |
188 const DesktopRect& left = desktop_rect_; | 188 const DesktopRect& left = desktop_rect_; |
189 const DesktopRect& right = duplicators_.back().desktop_rect(); | 189 const DesktopRect& right = duplicators_.back().desktop_rect(); |
190 desktop_rect_ = | 190 desktop_rect_ = |
191 DesktopRect::MakeLTRB(std::min(left.left(), right.left()), | 191 DesktopRect::MakeLTRB(std::min(left.left(), right.left()), |
192 std::min(left.top(), right.top()), | 192 std::min(left.top(), right.top()), |
193 std::max(left.right(), right.right()), | 193 std::max(left.right(), right.right()), |
194 std::max(left.bottom(), right.bottom())); | 194 std::max(left.bottom(), right.bottom())); |
195 } | 195 } |
196 } | 196 } |
| 197 TranslateRect(); |
197 | 198 |
198 HDC hdc = GetDC(nullptr); | 199 HDC hdc = GetDC(nullptr); |
199 // Use old DPI value if failed. | 200 // Use old DPI value if failed. |
200 if (hdc) { | 201 if (hdc) { |
201 dpi_.set(GetDeviceCaps(hdc, LOGPIXELSX), GetDeviceCaps(hdc, LOGPIXELSY)); | 202 dpi_.set(GetDeviceCaps(hdc, LOGPIXELSX), GetDeviceCaps(hdc, LOGPIXELSY)); |
202 ReleaseDC(nullptr, hdc); | 203 ReleaseDC(nullptr, hdc); |
203 } | 204 } |
204 | 205 |
205 identity_++; | 206 identity_++; |
206 return true; | 207 return true; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 int64_t DxgiDuplicatorController::GetNumFramesCaptured() const { | 289 int64_t DxgiDuplicatorController::GetNumFramesCaptured() const { |
289 int64_t min = INT64_MAX; | 290 int64_t min = INT64_MAX; |
290 for (const auto& duplicator : duplicators_) { | 291 for (const auto& duplicator : duplicators_) { |
291 min = std::min(min, duplicator.GetNumFramesCaptured()); | 292 min = std::min(min, duplicator.GetNumFramesCaptured()); |
292 } | 293 } |
293 | 294 |
294 return min; | 295 return min; |
295 } | 296 } |
296 | 297 |
297 DesktopSize DxgiDuplicatorController::desktop_size() const { | 298 DesktopSize DxgiDuplicatorController::desktop_size() const { |
298 return DesktopSize(desktop_rect_.right(), desktop_rect_.bottom()); | 299 return desktop_rect_.size(); |
299 } | 300 } |
300 | 301 |
301 DesktopRect DxgiDuplicatorController::ScreenRect(int id) const { | 302 DesktopRect DxgiDuplicatorController::ScreenRect(int id) const { |
302 RTC_DCHECK(id >= 0); | 303 RTC_DCHECK(id >= 0); |
303 for (size_t i = 0; i < duplicators_.size(); i++) { | 304 for (size_t i = 0; i < duplicators_.size(); i++) { |
304 if (id >= duplicators_[i].screen_count()) { | 305 if (id >= duplicators_[i].screen_count()) { |
305 id -= duplicators_[i].screen_count(); | 306 id -= duplicators_[i].screen_count(); |
306 } else { | 307 } else { |
307 return duplicators_[i].ScreenRect(id); | 308 return duplicators_[i].ScreenRect(id); |
308 } | 309 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 if (!DoDuplicateAll(context, shared_frame)) { | 372 if (!DoDuplicateAll(context, shared_frame)) { |
372 return false; | 373 return false; |
373 } | 374 } |
374 if (rtc::TimeMillis() - start_ms > timeout_ms) { | 375 if (rtc::TimeMillis() - start_ms > timeout_ms) { |
375 return false; | 376 return false; |
376 } | 377 } |
377 } | 378 } |
378 return true; | 379 return true; |
379 } | 380 } |
380 | 381 |
| 382 void DxgiDuplicatorController::TranslateRect() { |
| 383 const DesktopVector position = |
| 384 DesktopVector().subtract(desktop_rect_.top_left()); |
| 385 desktop_rect_.Translate(position); |
| 386 for (auto& duplicator : duplicators_) { |
| 387 duplicator.TranslateRect(position); |
| 388 } |
| 389 } |
| 390 |
381 } // namespace webrtc | 391 } // namespace webrtc |
OLD | NEW |