| 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_ || !frame_) { | 76 if (!display_ || !window_ || !height_ || !width_) { |
| 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_); | |
| 151 } | 149 } |
| 152 | 150 |
| 153 void X11View::InitPaintTarget() { | 151 void X11View::InitPaintTarget() { |
| 154 // Testing XRender support. | 152 // Testing XRender support. |
| 155 int dummy; | 153 int dummy; |
| 156 bool xrender_support = XRenderQueryExtension(display_, &dummy, &dummy); | 154 bool xrender_support = XRenderQueryExtension(display_, &dummy, &dummy); |
| 157 CHECK(xrender_support) << "XRender is not supported!"; | 155 CHECK(xrender_support) << "XRender is not supported!"; |
| 158 | 156 |
| 159 XWindowAttributes attr; | 157 XWindowAttributes attr; |
| 160 XGetWindowAttributes(display_, window_, &attr); | 158 XGetWindowAttributes(display_, window_, &attr); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 XEvent event; | 211 XEvent event; |
| 214 event.type = Expose; | 212 event.type = Expose; |
| 215 XSendEvent(display_, static_cast<int>(window_), true, ExposureMask, &event); | 213 XSendEvent(display_, static_cast<int>(window_), true, ExposureMask, &event); |
| 216 } | 214 } |
| 217 | 215 |
| 218 void X11View::OnDecodeDone() { | 216 void X11View::OnDecodeDone() { |
| 219 // Since we do synchronous decoding here there's nothing in this method. | 217 // Since we do synchronous decoding here there's nothing in this method. |
| 220 } | 218 } |
| 221 | 219 |
| 222 } // namespace remoting | 220 } // namespace remoting |
| OLD | NEW |