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_linux.h" | 5 #include "remoting/host/capturer_linux.h" |
6 | 6 |
7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 #include <X11/Xutil.h> | 8 #include <X11/Xutil.h> |
9 #include <X11/extensions/Xdamage.h> | 9 #include <X11/extensions/Xdamage.h> |
10 | 10 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 void CapturerLinuxPimpl::CaptureRects( | 228 void CapturerLinuxPimpl::CaptureRects( |
229 const InvalidRects& rects, | 229 const InvalidRects& rects, |
230 Capturer::CaptureCompletedCallback* callback) { | 230 Capturer::CaptureCompletedCallback* callback) { |
231 uint8* buffer = buffers_[capturer_->current_buffer_]; | 231 uint8* buffer = buffers_[capturer_->current_buffer_]; |
232 DataPlanes planes; | 232 DataPlanes planes; |
233 planes.data[0] = buffer; | 233 planes.data[0] = buffer; |
234 planes.strides[0] = stride_; | 234 planes.strides[0] = stride_; |
235 | 235 |
236 scoped_refptr<CaptureData> capture_data( | 236 scoped_refptr<CaptureData> capture_data( |
237 new CaptureData(planes, capturer_->width(), capturer_->height(), | 237 new CaptureData(planes, capturer_->width(), capturer_->height(), |
238 PIXEL_FORMAT_RGB32)); | 238 media::VideoFrame::RGB32)); |
239 | 239 |
240 for (InvalidRects::const_iterator it = rects.begin(); | 240 for (InvalidRects::const_iterator it = rects.begin(); |
241 it != rects.end(); | 241 it != rects.end(); |
242 ++it) { | 242 ++it) { |
243 XImage* image = XGetImage(display_, root_window_, it->x(), it->y(), | 243 XImage* image = XGetImage(display_, root_window_, it->x(), it->y(), |
244 it->width(), it->height(), AllPlanes, ZPixmap); | 244 it->width(), it->height(), AllPlanes, ZPixmap); |
245 | 245 |
246 // Check if we can fastpath the blit. | 246 // Check if we can fastpath the blit. |
247 if ((image->depth == 24 || image->depth == 32) && | 247 if ((image->depth == 24 || image->depth == 32) && |
248 image->bits_per_pixel == 32 && | 248 image->bits_per_pixel == 32 && |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 (((pixel & image->blue_mask) >> blue_shift) * max_green) / 255; | 331 (((pixel & image->blue_mask) >> blue_shift) * max_green) / 255; |
332 | 332 |
333 // Write as 32-bit RGB. | 333 // Write as 32-bit RGB. |
334 *dst_pos = r << 16 | g << 8 | b; | 334 *dst_pos = r << 16 | g << 8 | b; |
335 dst_pos++; | 335 dst_pos++; |
336 } | 336 } |
337 } | 337 } |
338 } | 338 } |
339 | 339 |
340 } // namespace remoting | 340 } // namespace remoting |
OLD | NEW |