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 "webkit/glue/media/video_renderer_impl.h" | 5 #include "webkit/glue/media/video_renderer_impl.h" |
6 | 6 |
| 7 #include "base/logging.h" |
7 #include "media/base/video_frame.h" | 8 #include "media/base/video_frame.h" |
8 #include "media/base/yuv_convert.h" | 9 #include "media/base/yuv_convert.h" |
9 #include "webkit/glue/webmediaplayer_impl.h" | 10 #include "webkit/glue/webmediaplayer_proxy.h" |
10 | 11 |
11 namespace webkit_glue { | 12 namespace webkit_glue { |
12 | 13 |
13 VideoRendererImpl::VideoRendererImpl(bool pts_logging) | 14 VideoRendererImpl::VideoRendererImpl(bool pts_logging) |
14 : last_converted_frame_(NULL), | 15 : last_converted_frame_(NULL), |
15 pts_logging_(pts_logging) { | 16 pts_logging_(pts_logging) { |
16 } | 17 } |
17 | 18 |
18 VideoRendererImpl::~VideoRendererImpl() {} | 19 VideoRendererImpl::~VideoRendererImpl() {} |
19 | 20 |
(...skipping 10 matching lines...) Expand all Loading... |
30 if (callback) { | 31 if (callback) { |
31 callback->Run(); | 32 callback->Run(); |
32 delete callback; | 33 delete callback; |
33 } | 34 } |
34 } | 35 } |
35 | 36 |
36 void VideoRendererImpl::OnFrameAvailable() { | 37 void VideoRendererImpl::OnFrameAvailable() { |
37 proxy_->Repaint(); | 38 proxy_->Repaint(); |
38 } | 39 } |
39 | 40 |
40 void VideoRendererImpl::SetWebMediaPlayerImplProxy( | 41 void VideoRendererImpl::SetWebMediaPlayerProxy(WebMediaPlayerProxy* proxy) { |
41 WebMediaPlayerImpl::Proxy* proxy) { | |
42 proxy_ = proxy; | 42 proxy_ = proxy; |
43 } | 43 } |
44 | 44 |
45 void VideoRendererImpl::SetRect(const gfx::Rect& rect) { | 45 void VideoRendererImpl::SetRect(const gfx::Rect& rect) {} |
46 } | |
47 | 46 |
48 // This method is always called on the renderer's thread. | 47 // This method is always called on the renderer's thread. |
49 void VideoRendererImpl::Paint(SkCanvas* canvas, | 48 void VideoRendererImpl::Paint(SkCanvas* canvas, |
50 const gfx::Rect& dest_rect) { | 49 const gfx::Rect& dest_rect) { |
51 scoped_refptr<media::VideoFrame> video_frame; | 50 scoped_refptr<media::VideoFrame> video_frame; |
52 GetCurrentFrame(&video_frame); | 51 GetCurrentFrame(&video_frame); |
53 if (!video_frame) { | 52 if (!video_frame) { |
54 SkPaint paint; | 53 SkPaint paint; |
55 paint.setColor(SK_ColorBLACK); | 54 paint.setColor(SK_ColorBLACK); |
56 canvas->drawRectCoords( | 55 canvas->drawRectCoords( |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 // Transform destination rect to local coordinates. | 303 // Transform destination rect to local coordinates. |
305 SkRect transformed_rect; | 304 SkRect transformed_rect; |
306 SkRect skia_dest_rect; | 305 SkRect skia_dest_rect; |
307 skia_dest_rect.iset(src_rect.x(), src_rect.y(), | 306 skia_dest_rect.iset(src_rect.x(), src_rect.y(), |
308 src_rect.right(), src_rect.bottom()); | 307 src_rect.right(), src_rect.bottom()); |
309 matrix.mapRect(&transformed_rect, skia_dest_rect); | 308 matrix.mapRect(&transformed_rect, skia_dest_rect); |
310 transformed_rect.round(dest_rect); | 309 transformed_rect.round(dest_rect); |
311 } | 310 } |
312 | 311 |
313 } // namespace webkit_glue | 312 } // namespace webkit_glue |
OLD | NEW |