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_mac.h" | 5 #include "remoting/host/capturer_mac.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <OpenGL/CGLMacro.h> | 9 #include <OpenGL/CGLMacro.h> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 void CapturerMac::ScreenConfigurationChanged() { | 43 void CapturerMac::ScreenConfigurationChanged() { |
44 ReleaseBuffers(); | 44 ReleaseBuffers(); |
45 CGDirectDisplayID mainDevice = CGMainDisplayID(); | 45 CGDirectDisplayID mainDevice = CGMainDisplayID(); |
46 | 46 |
47 width_ = CGDisplayPixelsWide(mainDevice); | 47 width_ = CGDisplayPixelsWide(mainDevice); |
48 height_ = CGDisplayPixelsHigh(mainDevice); | 48 height_ = CGDisplayPixelsHigh(mainDevice); |
49 bytes_per_row_ = width_ * sizeof(uint32_t); | 49 bytes_per_row_ = width_ * sizeof(uint32_t); |
50 pixel_format_ = PIXEL_FORMAT_RGB32; | 50 pixel_format_ = PixelFormatRgb32; |
51 size_t buffer_size = height() * bytes_per_row_; | 51 size_t buffer_size = height() * bytes_per_row_; |
52 for (int i = 0; i < kNumBuffers; ++i) { | 52 for (int i = 0; i < kNumBuffers; ++i) { |
53 buffers_[i].reset(new uint8[buffer_size]); | 53 buffers_[i].reset(new uint8[buffer_size]); |
54 } | 54 } |
55 CGLPixelFormatAttribute attributes[] = { | 55 CGLPixelFormatAttribute attributes[] = { |
56 kCGLPFAFullScreen, | 56 kCGLPFAFullScreen, |
57 kCGLPFADisplayMask, | 57 kCGLPFADisplayMask, |
58 (CGLPixelFormatAttribute)CGDisplayIDToOpenGLDisplayMask(mainDevice), | 58 (CGLPixelFormatAttribute)CGDisplayIDToOpenGLDisplayMask(mainDevice), |
59 (CGLPixelFormatAttribute)0 | 59 (CGLPixelFormatAttribute)0 |
60 }; | 60 }; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 CGDisplayChangeSummaryFlags flags, | 156 CGDisplayChangeSummaryFlags flags, |
157 void *user_parameter) { | 157 void *user_parameter) { |
158 if ((display == CGMainDisplayID()) && | 158 if ((display == CGMainDisplayID()) && |
159 !(flags & kCGDisplayBeginConfigurationFlag)) { | 159 !(flags & kCGDisplayBeginConfigurationFlag)) { |
160 CapturerMac *capturer = reinterpret_cast<CapturerMac *>(user_parameter); | 160 CapturerMac *capturer = reinterpret_cast<CapturerMac *>(user_parameter); |
161 capturer->ScreenConfigurationChanged(); | 161 capturer->ScreenConfigurationChanged(); |
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 } // namespace remoting | 165 } // namespace remoting |
OLD | NEW |