OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/capturer_gdi.h" | 5 #include "remoting/host/capturer_gdi.h" |
6 | 6 |
7 #include "gfx/rect.h" | 7 #include "gfx/rect.h" |
8 | 8 |
9 namespace remoting { | 9 namespace remoting { |
10 | 10 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // Create memory for the buffers. | 72 // Create memory for the buffers. |
73 for (int i = 0; i < kNumBuffers; i++) { | 73 for (int i = 0; i < kNumBuffers; i++) { |
74 target_bitmap_[i] = CreateDIBSection(desktop_dc_, &bmi, DIB_RGB_COLORS, | 74 target_bitmap_[i] = CreateDIBSection(desktop_dc_, &bmi, DIB_RGB_COLORS, |
75 static_cast<void**>(&buffers_[i]), | 75 static_cast<void**>(&buffers_[i]), |
76 NULL, 0); | 76 NULL, 0); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 void CapturerGdi::CaptureRects(const RectVector& rects, | 80 void CapturerGdi::CaptureRects(const RectVector& rects, |
81 CaptureCompletedCallback* callback) { | 81 CaptureCompletedCallback* callback) { |
82 Capturer::DataPlanes planes; | 82 DataPlanes planes; |
83 planes.data[0] = static_cast<uint8*>(buffers_[current_buffer_]); | 83 planes.data[0] = static_cast<uint8*>(buffers_[current_buffer_]); |
84 planes.strides[0] = bytes_per_row_; | 84 planes.strides[0] = bytes_per_row_; |
85 | 85 |
86 CaptureImage(); | 86 CaptureImage(); |
87 scoped_refptr<CaptureData> data(new CaptureData(planes, | 87 scoped_refptr<CaptureData> data(new CaptureData(planes, |
88 width(), | 88 width(), |
89 height(), | 89 height(), |
90 pixel_format())); | 90 pixel_format())); |
91 data->mutable_dirty_rects() = rects; | 91 data->mutable_dirty_rects() = rects; |
92 | 92 |
93 FinishCapture(data, callback); | 93 FinishCapture(data, callback); |
94 } | 94 } |
95 | 95 |
96 void CapturerGdi::CaptureImage() { | 96 void CapturerGdi::CaptureImage() { |
97 // Selection the target bitmap into the memory dc. | 97 // Selection the target bitmap into the memory dc. |
98 SelectObject(memory_dc_, target_bitmap_[current_buffer_]); | 98 SelectObject(memory_dc_, target_bitmap_[current_buffer_]); |
99 | 99 |
100 // And then copy the rect from desktop to memory. | 100 // And then copy the rect from desktop to memory. |
101 BitBlt(memory_dc_, 0, 0, width_, height_, desktop_dc_, 0, 0, | 101 BitBlt(memory_dc_, 0, 0, width_, height_, desktop_dc_, 0, 0, |
102 SRCCOPY | CAPTUREBLT); | 102 SRCCOPY | CAPTUREBLT); |
103 } | 103 } |
104 | 104 |
105 } // namespace remoting | 105 } // namespace remoting |
OLD | NEW |