| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 void CapturerGdi::InitializeBuffers() { | 77 void CapturerGdi::InitializeBuffers() { |
| 78 desktop_dc_ = GetDC(GetDesktopWindow()); | 78 desktop_dc_ = GetDC(GetDesktopWindow()); |
| 79 memory_dc_ = CreateCompatibleDC(desktop_dc_); | 79 memory_dc_ = CreateCompatibleDC(desktop_dc_); |
| 80 | 80 |
| 81 // Create a bitmap to keep the desktop image. | 81 // Create a bitmap to keep the desktop image. |
| 82 width_ = GetSystemMetrics(SM_CXSCREEN); | 82 width_ = GetSystemMetrics(SM_CXSCREEN); |
| 83 height_ = GetSystemMetrics(SM_CYSCREEN); | 83 height_ = GetSystemMetrics(SM_CYSCREEN); |
| 84 int rounded_width = (width_ + 3) & (~3); | 84 int rounded_width = (width_ + 3) & (~3); |
| 85 | 85 |
| 86 // Dimensions of screen. | 86 // Dimensions of screen. |
| 87 pixel_format_ = chromotocol_pb::PixelFormatRgb24; | 87 pixel_format_ = PixelFormatRgb24; |
| 88 bytes_per_pixel_ = kBytesPerPixel; | 88 bytes_per_pixel_ = kBytesPerPixel; |
| 89 bytes_per_row_ = rounded_width * bytes_per_pixel_; | 89 bytes_per_row_ = rounded_width * bytes_per_pixel_; |
| 90 | 90 |
| 91 // Create a device independant bitmap (DIB) that is the same size. | 91 // Create a device independant bitmap (DIB) that is the same size. |
| 92 BITMAPINFO bmi; | 92 BITMAPINFO bmi; |
| 93 memset(&bmi, 0, sizeof(bmi)); | 93 memset(&bmi, 0, sizeof(bmi)); |
| 94 bmi.bmiHeader.biHeight = height_; | 94 bmi.bmiHeader.biHeight = height_; |
| 95 bmi.bmiHeader.biWidth = width_; | 95 bmi.bmiHeader.biWidth = width_; |
| 96 bmi.bmiHeader.biPlanes = 1; | 96 bmi.bmiHeader.biPlanes = 1; |
| 97 bmi.bmiHeader.biBitCount = bytes_per_pixel_ * 8; | 97 bmi.bmiHeader.biBitCount = bytes_per_pixel_ * 8; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 115 } | 115 } |
| 116 // Selection the target bitmap into the memory dc. | 116 // Selection the target bitmap into the memory dc. |
| 117 SelectObject(memory_dc_, target_bitmap_[current_buffer_]); | 117 SelectObject(memory_dc_, target_bitmap_[current_buffer_]); |
| 118 | 118 |
| 119 // And then copy the rect from desktop to memory. | 119 // And then copy the rect from desktop to memory. |
| 120 BitBlt(memory_dc_, 0, 0, width_, height_, desktop_dc_, 0, 0, | 120 BitBlt(memory_dc_, 0, 0, width_, height_, desktop_dc_, 0, 0, |
| 121 SRCCOPY | CAPTUREBLT); | 121 SRCCOPY | CAPTUREBLT); |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace remoting | 124 } // namespace remoting |
| OLD | NEW |