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