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 #include "remoting/host/differ.h" | 6 #include "remoting/host/differ.h" |
7 | 7 |
8 #include "gfx/rect.h" | 8 #include "gfx/rect.h" |
9 | 9 |
10 namespace remoting { | 10 namespace remoting { |
11 | 11 |
12 // 3780 pixels per meter is equivalent to 96 DPI, typical on desktop monitors. | 12 // 3780 pixels per meter is equivalent to 96 DPI, typical on desktop monitors. |
13 static const int kPixelsPerMeter = 3780; | 13 static const int kPixelsPerMeter = 3780; |
14 // 32 bit RGBA is 4 bytes per pixel. | 14 // 32 bit RGBA is 4 bytes per pixel. |
15 static const int kBytesPerPixel = 4; | 15 static const int kBytesPerPixel = 4; |
16 | 16 |
17 CapturerGdi::CapturerGdi() | 17 CapturerGdi::CapturerGdi(MessageLoop* message_loop) |
18 : desktop_dc_(NULL), | 18 : Capturer(message_loop), |
| 19 desktop_dc_(NULL), |
19 memory_dc_(NULL), | 20 memory_dc_(NULL), |
20 capture_fullscreen_(true) { | 21 capture_fullscreen_(true) { |
21 memset(target_bitmap_, 0, sizeof(target_bitmap_)); | 22 memset(target_bitmap_, 0, sizeof(target_bitmap_)); |
22 memset(buffers_, 0, sizeof(buffers_)); | 23 memset(buffers_, 0, sizeof(buffers_)); |
23 } | 24 } |
24 | 25 |
25 CapturerGdi::~CapturerGdi() { | 26 CapturerGdi::~CapturerGdi() { |
26 ReleaseBuffers(); | 27 ReleaseBuffers(); |
27 } | 28 } |
28 | 29 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 void CapturerGdi::CaptureImage() { | 129 void CapturerGdi::CaptureImage() { |
129 // Select the target bitmap into the memory dc. | 130 // Select the target bitmap into the memory dc. |
130 SelectObject(memory_dc_, target_bitmap_[current_buffer_]); | 131 SelectObject(memory_dc_, target_bitmap_[current_buffer_]); |
131 | 132 |
132 // And then copy the rect from desktop to memory. | 133 // And then copy the rect from desktop to memory. |
133 BitBlt(memory_dc_, 0, 0, width_, height_, desktop_dc_, 0, 0, | 134 BitBlt(memory_dc_, 0, 0, width_, height_, desktop_dc_, 0, 0, |
134 SRCCOPY | CAPTUREBLT); | 135 SRCCOPY | CAPTUREBLT); |
135 } | 136 } |
136 | 137 |
137 } // namespace remoting | 138 } // namespace remoting |
OLD | NEW |