| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "remoting/host/capturer.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 |
| 11 #include <set> | 11 #include <set> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "remoting/host/capturer_helper.h" | 16 #include "remoting/host/capturer_helper.h" |
| 17 #include "remoting/host/differ.h" | 17 #include "remoting/host/differ.h" |
| 18 #include "remoting/host/x_server_pixel_buffer.h" | 18 #include "remoting/host/x_server_pixel_buffer.h" |
| 19 | 19 |
| 20 namespace remoting { | 20 namespace remoting { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 static const int kBytesPerPixel = 4; | 24 static const int kBytesPerPixel = 4; |
| 25 | 25 |
| 26 // Default to false, since many systems have broken XDamage support - see |
| 27 // http://crbug.com/73423. |
| 28 static bool g_should_use_x_damage = false; |
| 29 |
| 26 static bool ShouldUseXDamage() { | 30 static bool ShouldUseXDamage() { |
| 27 // For now, always use full-screen polling instead of the DAMAGE extension, | 31 return g_should_use_x_damage; |
| 28 // as this extension is broken on many current systems OOTB. | |
| 29 return false; | |
| 30 } | 32 } |
| 31 | 33 |
| 32 // A class representing a full-frame pixel buffer | 34 // A class representing a full-frame pixel buffer |
| 33 class VideoFrameBuffer { | 35 class VideoFrameBuffer { |
| 34 public: | 36 public: |
| 35 VideoFrameBuffer() : bytes_per_row_(0), needs_update_(true) {} | 37 VideoFrameBuffer() : bytes_per_row_(0), needs_update_(true) {} |
| 36 | 38 |
| 37 void Update(Display* display, Window root_window) { | 39 void Update(Display* display, Window root_window) { |
| 38 if (needs_update_) { | 40 if (needs_update_) { |
| 39 needs_update_ = false; | 41 needs_update_ = false; |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 // static | 508 // static |
| 507 Capturer* Capturer::Create() { | 509 Capturer* Capturer::Create() { |
| 508 CapturerLinux* capturer = new CapturerLinux(); | 510 CapturerLinux* capturer = new CapturerLinux(); |
| 509 if (!capturer->Init()) { | 511 if (!capturer->Init()) { |
| 510 delete capturer; | 512 delete capturer; |
| 511 capturer = NULL; | 513 capturer = NULL; |
| 512 } | 514 } |
| 513 return capturer; | 515 return capturer; |
| 514 } | 516 } |
| 515 | 517 |
| 518 // static |
| 519 void Capturer::EnableXDamage(bool enable) { |
| 520 g_should_use_x_damage = enable; |
| 521 } |
| 522 |
| 516 } // namespace remoting | 523 } // namespace remoting |
| OLD | NEW |