| 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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/win/scoped_gdi_object.h" | 10 #include "base/win/scoped_gdi_object.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 PLOG(ERROR) << "Failed to enumerate windows"; | 60 PLOG(ERROR) << "Failed to enumerate windows"; |
| 61 desktop_shape_.Clear(); | 61 desktop_shape_.Clear(); |
| 62 return; | 62 return; |
| 63 } | 63 } |
| 64 | 64 |
| 65 // If the shape has changed, refresh |desktop_shape_|. | 65 // If the shape has changed, refresh |desktop_shape_|. |
| 66 if (!EqualRgn(shape_data->desktop_region, old_desktop_region_)) { | 66 if (!EqualRgn(shape_data->desktop_region, old_desktop_region_)) { |
| 67 old_desktop_region_.Set(shape_data->desktop_region.release()); | 67 old_desktop_region_.Set(shape_data->desktop_region.release()); |
| 68 | 68 |
| 69 // Determine the size of output buffer required to receive the region. | 69 // Determine the size of output buffer required to receive the region. |
| 70 DWORD bytes_size = GetRegionData(old_desktop_region_, 0, NULL); | 70 DWORD bytes_size = GetRegionData(old_desktop_region_, 0, nullptr); |
| 71 CHECK(bytes_size != 0); | 71 CHECK(bytes_size != 0); |
| 72 | 72 |
| 73 // Fetch the Windows RECTs that comprise the region. | 73 // Fetch the Windows RECTs that comprise the region. |
| 74 std::vector<char> buffer(bytes_size); | 74 std::vector<char> buffer(bytes_size); |
| 75 LPRGNDATA region_data = reinterpret_cast<LPRGNDATA>(buffer.data()); | 75 LPRGNDATA region_data = reinterpret_cast<LPRGNDATA>(buffer.data()); |
| 76 DWORD result = GetRegionData(old_desktop_region_, bytes_size, region_data); | 76 DWORD result = GetRegionData(old_desktop_region_, bytes_size, region_data); |
| 77 CHECK(result == bytes_size); | 77 CHECK(result == bytes_size); |
| 78 const LPRECT rects = reinterpret_cast<LPRECT>(®ion_data->Buffer[0]); | 78 const LPRECT rects = reinterpret_cast<LPRECT>(®ion_data->Buffer[0]); |
| 79 | 79 |
| 80 // Reset |desktop_shape_| and add new rectangles into it. | 80 // Reset |desktop_shape_| and add new rectangles into it. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 } // namespace | 133 } // namespace |
| 134 | 134 |
| 135 // static | 135 // static |
| 136 scoped_ptr<DesktopShapeTracker> DesktopShapeTracker::Create( | 136 scoped_ptr<DesktopShapeTracker> DesktopShapeTracker::Create( |
| 137 webrtc::DesktopCaptureOptions options) { | 137 webrtc::DesktopCaptureOptions options) { |
| 138 return make_scoped_ptr(new DesktopShapeTrackerWin()); | 138 return make_scoped_ptr(new DesktopShapeTrackerWin()); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace remoting | 141 } // namespace remoting |
| OLD | NEW |