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/client/x11_view.h" | 5 #include "remoting/client/x11_view.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/Xrender.h> | 9 #include <X11/extensions/Xrender.h> |
10 #include <X11/extensions/Xcomposite.h> | 10 #include <X11/extensions/Xcomposite.h> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // Shutdown the window system. | 66 // Shutdown the window system. |
67 XDestroyWindow(display_, window_); | 67 XDestroyWindow(display_, window_); |
68 XCloseDisplay(display_); | 68 XCloseDisplay(display_); |
69 } | 69 } |
70 display_ = NULL; | 70 display_ = NULL; |
71 window_ = 0; | 71 window_ = 0; |
72 } | 72 } |
73 | 73 |
74 void X11View::Paint() { | 74 void X11View::Paint() { |
75 // Don't bother attempting to paint if the display hasn't been set up. | 75 // Don't bother attempting to paint if the display hasn't been set up. |
76 if (!display_ || !window_ || !height_ || !width_) { | 76 if (!display_ || !window_ || !height_ || !width_ || !frame_) { |
77 return; | 77 return; |
78 } | 78 } |
79 | 79 |
80 // TODO(hclam): Paint only the updated regions. | 80 // TODO(hclam): Paint only the updated regions. |
81 all_update_rects_.clear(); | 81 all_update_rects_.clear(); |
82 | 82 |
83 // If we have not initialized the render target then do it now. | 83 // If we have not initialized the render target then do it now. |
84 if (!picture_) | 84 if (!picture_) |
85 InitPaintTarget(); | 85 InitPaintTarget(); |
86 | 86 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 void X11View::SetViewport(int x, int y, int width, int height) { | 140 void X11View::SetViewport(int x, int y, int width, int height) { |
141 // TODO(garykac): Implement. | 141 // TODO(garykac): Implement. |
142 // NOTIMPLEMENTED(); | 142 // NOTIMPLEMENTED(); |
143 } | 143 } |
144 | 144 |
145 void X11View::SetHostScreenSize(int width, int height) { | 145 void X11View::SetHostScreenSize(int width, int height) { |
146 width_ = width; | 146 width_ = width; |
147 height_ = height; | 147 height_ = height; |
148 XResizeWindow(display_, window_, width_, height_); | 148 XResizeWindow(display_, window_, width_, height_); |
| 149 media::VideoFrame::CreateFrame(media::VideoFrame::RGB32, width_, height_, |
| 150 base::TimeDelta(), base::TimeDelta(), &frame_); |
149 } | 151 } |
150 | 152 |
151 void X11View::InitPaintTarget() { | 153 void X11View::InitPaintTarget() { |
152 // Testing XRender support. | 154 // Testing XRender support. |
153 int dummy; | 155 int dummy; |
154 bool xrender_support = XRenderQueryExtension(display_, &dummy, &dummy); | 156 bool xrender_support = XRenderQueryExtension(display_, &dummy, &dummy); |
155 CHECK(xrender_support) << "XRender is not supported!"; | 157 CHECK(xrender_support) << "XRender is not supported!"; |
156 | 158 |
157 XWindowAttributes attr; | 159 XWindowAttributes attr; |
158 XGetWindowAttributes(display_, window_, &attr); | 160 XGetWindowAttributes(display_, window_, &attr); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 XEvent event; | 213 XEvent event; |
212 event.type = Expose; | 214 event.type = Expose; |
213 XSendEvent(display_, static_cast<int>(window_), true, ExposureMask, &event); | 215 XSendEvent(display_, static_cast<int>(window_), true, ExposureMask, &event); |
214 } | 216 } |
215 | 217 |
216 void X11View::OnDecodeDone() { | 218 void X11View::OnDecodeDone() { |
217 // Since we do synchronous decoding here there's nothing in this method. | 219 // Since we do synchronous decoding here there's nothing in this method. |
218 } | 220 } |
219 | 221 |
220 } // namespace remoting | 222 } // namespace remoting |
OLD | NEW |