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 "media/tools/player_x11/x11_video_renderer.h" | 5 #include "media/tools/player_x11/x11_video_renderer.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 use_render_(false) { | 76 use_render_(false) { |
77 } | 77 } |
78 | 78 |
79 X11VideoRenderer::~X11VideoRenderer() { | 79 X11VideoRenderer::~X11VideoRenderer() { |
80 if (image_) | 80 if (image_) |
81 XDestroyImage(image_); | 81 XDestroyImage(image_); |
82 if (use_render_) | 82 if (use_render_) |
83 XRenderFreePicture(display_, picture_); | 83 XRenderFreePicture(display_, picture_); |
84 } | 84 } |
85 | 85 |
86 void X11VideoRenderer::Paint(media::VideoFrame* video_frame) { | 86 void X11VideoRenderer::Paint( |
| 87 const scoped_refptr<media::VideoFrame>& video_frame) { |
87 if (!image_) | 88 if (!image_) |
88 Initialize(video_frame->coded_size(), video_frame->visible_rect()); | 89 Initialize(video_frame->coded_size(), video_frame->visible_rect()); |
89 | 90 |
90 const int coded_width = video_frame->coded_size().width(); | 91 const int coded_width = video_frame->coded_size().width(); |
91 const int coded_height = video_frame->coded_size().height(); | 92 const int coded_height = video_frame->coded_size().height(); |
92 const int visible_width = video_frame->visible_rect().width(); | 93 const int visible_width = video_frame->visible_rect().width(); |
93 const int visible_height = video_frame->visible_rect().height(); | 94 const int visible_height = video_frame->visible_rect().height(); |
94 | 95 |
95 // Check if we need to reallocate our XImage. | 96 // Check if we need to reallocate our XImage. |
96 if (image_->width != coded_width || image_->height != coded_height) { | 97 if (image_->width != coded_width || image_->height != coded_height) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 206 |
206 XRenderPictFormat* pictformat = XRenderFindVisualFormat( | 207 XRenderPictFormat* pictformat = XRenderFindVisualFormat( |
207 display_, | 208 display_, |
208 attr.visual); | 209 attr.visual); |
209 CHECK(pictformat) << "XRender does not support default visual"; | 210 CHECK(pictformat) << "XRender does not support default visual"; |
210 | 211 |
211 picture_ = XRenderCreatePicture(display_, window_, pictformat, 0, NULL); | 212 picture_ = XRenderCreatePicture(display_, window_, pictformat, 0, NULL); |
212 CHECK(picture_) << "Backing picture not created"; | 213 CHECK(picture_) << "Backing picture not created"; |
213 } | 214 } |
214 } | 215 } |
OLD | NEW |