Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: remoting/host/capturer_gdi.cc

Issue 2771007: Fix chromoting windows build (Closed)
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/client/client_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 // 3780 pixels per meter is equivalent to 96 DPI, typical on desktop monitors. 11 // 3780 pixels per meter is equivalent to 96 DPI, typical on desktop monitors.
12 static const int kPixelsPerMeter = 3780; 12 static const int kPixelsPerMeter = 3780;
13 // 24 bit RGB is 3 bytes per pixel. 13 // 24 bit RGB is 3 bytes per pixel.
14 static const int kBytesPerPixel = 3; 14 static const int kBytesPerPixel = 4;
15 15
16 CapturerGdi::CapturerGdi() 16 CapturerGdi::CapturerGdi()
17 : initialized_(false) { 17 : initialized_(false) {
18 } 18 }
19 19
20 CapturerGdi::~CapturerGdi() { 20 CapturerGdi::~CapturerGdi() {
21 if (initialized_) { 21 if (initialized_) {
22 for (int i = kNumBuffers - 1; i >= 0; i--) { 22 for (int i = kNumBuffers - 1; i >= 0; i--) {
23 DeleteObject(target_bitmap_[i]); 23 DeleteObject(target_bitmap_[i]);
24 } 24 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_ = PixelFormatRgb24; 87 pixel_format_ = PixelFormatRgb32;
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
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
OLDNEW
« no previous file with comments | « remoting/client/client_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698