OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/video_frame_capturer.h" | 5 #include "remoting/host/video_frame_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 #include <X11/extensions/Xfixes.h> | 10 #include <X11/extensions/Xfixes.h> |
(...skipping 19 matching lines...) Expand all Loading... |
30 // http://crbug.com/73423. | 30 // http://crbug.com/73423. |
31 static bool g_should_use_x_damage = false; | 31 static bool g_should_use_x_damage = false; |
32 | 32 |
33 static bool ShouldUseXDamage() { | 33 static bool ShouldUseXDamage() { |
34 return g_should_use_x_damage; | 34 return g_should_use_x_damage; |
35 } | 35 } |
36 | 36 |
37 // A class representing a full-frame pixel buffer | 37 // A class representing a full-frame pixel buffer |
38 class VideoFrameBuffer { | 38 class VideoFrameBuffer { |
39 public: | 39 public: |
40 VideoFrameBuffer() : bytes_per_row_(0), needs_update_(true) { | 40 VideoFrameBuffer() |
41 size_.set(0, 0); | 41 : size_(SkISize::Make(0, 0)), |
| 42 bytes_per_row_(0), |
| 43 needs_update_(true) { |
42 } | 44 } |
43 | 45 |
44 void Update(Display* display, Window root_window) { | 46 void Update(Display* display, Window root_window) { |
45 if (needs_update_) { | 47 if (needs_update_) { |
46 needs_update_ = false; | 48 needs_update_ = false; |
47 XWindowAttributes root_attr; | 49 XWindowAttributes root_attr; |
48 XGetWindowAttributes(display, root_window, &root_attr); | 50 XGetWindowAttributes(display, root_window, &root_attr); |
49 if (root_attr.width != size_.width() || | 51 if (root_attr.width != size_.width() || |
50 root_attr.height != size_.height()) { | 52 root_attr.height != size_.height()) { |
51 size_.set(root_attr.width, root_attr.height); | 53 size_.set(root_attr.width, root_attr.height); |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 } | 631 } |
630 return capturer; | 632 return capturer; |
631 } | 633 } |
632 | 634 |
633 // static | 635 // static |
634 void VideoFrameCapturer::EnableXDamage(bool enable) { | 636 void VideoFrameCapturer::EnableXDamage(bool enable) { |
635 g_should_use_x_damage = enable; | 637 g_should_use_x_damage = enable; |
636 } | 638 } |
637 | 639 |
638 } // namespace remoting | 640 } // namespace remoting |
OLD | NEW |