OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "remoting/host/desktop_shape_tracker.h" | 5 #include "remoting/host/desktop_shape_tracker.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // Accumulate a new desktop shape from current window positions. | 61 // Accumulate a new desktop shape from current window positions. |
62 scoped_ptr<EnumDesktopShapeData> shape_data(new EnumDesktopShapeData); | 62 scoped_ptr<EnumDesktopShapeData> shape_data(new EnumDesktopShapeData); |
63 if (!EnumWindows(EnumWindowsCallback, (LPARAM)shape_data.get())) { | 63 if (!EnumWindows(EnumWindowsCallback, (LPARAM)shape_data.get())) { |
64 PLOG(ERROR) << "Failed to enumerate windows"; | 64 PLOG(ERROR) << "Failed to enumerate windows"; |
65 desktop_shape_.Clear(); | 65 desktop_shape_.Clear(); |
66 return; | 66 return; |
67 } | 67 } |
68 | 68 |
69 // If the shape has changed, refresh |desktop_shape_|. | 69 // If the shape has changed, refresh |desktop_shape_|. |
70 if (!EqualRgn(shape_data->desktop_region.get(), old_desktop_region_.get())) { | 70 if (!EqualRgn(shape_data->desktop_region.get(), old_desktop_region_.get())) { |
71 old_desktop_region_ = shape_data->desktop_region.Pass(); | 71 old_desktop_region_ = std::move(shape_data->desktop_region); |
72 | 72 |
73 // Determine the size of output buffer required to receive the region. | 73 // Determine the size of output buffer required to receive the region. |
74 DWORD bytes_size = GetRegionData(old_desktop_region_.get(), 0, nullptr); | 74 DWORD bytes_size = GetRegionData(old_desktop_region_.get(), 0, nullptr); |
75 CHECK(bytes_size != 0); | 75 CHECK(bytes_size != 0); |
76 | 76 |
77 // Fetch the Windows RECTs that comprise the region. | 77 // Fetch the Windows RECTs that comprise the region. |
78 std::vector<char> buffer(bytes_size); | 78 std::vector<char> buffer(bytes_size); |
79 LPRGNDATA region_data = reinterpret_cast<LPRGNDATA>(buffer.data()); | 79 LPRGNDATA region_data = reinterpret_cast<LPRGNDATA>(buffer.data()); |
80 DWORD result = | 80 DWORD result = |
81 GetRegionData(old_desktop_region_.get(), bytes_size, region_data); | 81 GetRegionData(old_desktop_region_.get(), bytes_size, region_data); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 } // namespace | 138 } // namespace |
139 | 139 |
140 // static | 140 // static |
141 scoped_ptr<DesktopShapeTracker> DesktopShapeTracker::Create( | 141 scoped_ptr<DesktopShapeTracker> DesktopShapeTracker::Create( |
142 webrtc::DesktopCaptureOptions options) { | 142 webrtc::DesktopCaptureOptions options) { |
143 return make_scoped_ptr(new DesktopShapeTrackerWin()); | 143 return make_scoped_ptr(new DesktopShapeTrackerWin()); |
144 } | 144 } |
145 | 145 |
146 } // namespace remoting | 146 } // namespace remoting |
OLD | NEW |