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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 glPixelStorei(GL_PACK_ALIGNMENT, 4); // Force 4-byte alignment. | 86 glPixelStorei(GL_PACK_ALIGNMENT, 4); // Force 4-byte alignment. |
87 glPixelStorei(GL_PACK_ROW_LENGTH, 0); | 87 glPixelStorei(GL_PACK_ROW_LENGTH, 0); |
88 glPixelStorei(GL_PACK_SKIP_ROWS, 0); | 88 glPixelStorei(GL_PACK_SKIP_ROWS, 0); |
89 glPixelStorei(GL_PACK_SKIP_PIXELS, 0); | 89 glPixelStorei(GL_PACK_SKIP_PIXELS, 0); |
90 | 90 |
91 // Read a block of pixels from the frame buffer. | 91 // Read a block of pixels from the frame buffer. |
92 glReadPixels(0, 0, width(), height(), GL_BGRA, GL_UNSIGNED_BYTE, | 92 glReadPixels(0, 0, width(), height(), GL_BGRA, GL_UNSIGNED_BYTE, |
93 buffers_[current_buffer_].get()); | 93 buffers_[current_buffer_].get()); |
94 glPopClientAttrib(); | 94 glPopClientAttrib(); |
95 | 95 |
96 Capturer::DataPlanes planes; | 96 DataPlanes planes; |
97 planes.data[0] = buffers_[current_buffer_].get(); | 97 planes.data[0] = buffers_[current_buffer_].get(); |
98 planes.strides[0] = bytes_per_row_; | 98 planes.strides[0] = bytes_per_row_; |
99 | 99 |
100 scoped_refptr<CaptureData> data(new CaptureData(planes, | 100 scoped_refptr<CaptureData> data(new CaptureData(planes, |
101 width(), | 101 width(), |
102 height(), | 102 height(), |
103 pixel_format())); | 103 pixel_format())); |
104 data->mutable_dirty_rects().assign(1, dirtyRect); | 104 data->mutable_dirty_rects().assign(1, dirtyRect); |
105 FinishCapture(data, callback); | 105 FinishCapture(data, callback); |
106 } | 106 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 CGDisplayChangeSummaryFlags flags, | 151 CGDisplayChangeSummaryFlags flags, |
152 void *user_parameter) { | 152 void *user_parameter) { |
153 if ((display == CGMainDisplayID()) && | 153 if ((display == CGMainDisplayID()) && |
154 !(flags & kCGDisplayBeginConfigurationFlag)) { | 154 !(flags & kCGDisplayBeginConfigurationFlag)) { |
155 CapturerMac *capturer = reinterpret_cast<CapturerMac *>(user_parameter); | 155 CapturerMac *capturer = reinterpret_cast<CapturerMac *>(user_parameter); |
156 capturer->ScreenConfigurationChanged(); | 156 capturer->ScreenConfigurationChanged(); |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 } // namespace remoting | 160 } // namespace remoting |
OLD | NEW |