Chromium Code Reviews| 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 "media/base/video_frame.h" | 7 #include "media/base/video_frame.h" |
| 8 #include "media/base/yuv_convert.h" | 8 #include "media/base/yuv_convert.h" |
| 9 #include "webkit/glue/webmediaplayer_impl.h" | 9 #include "webkit/glue/webmediaplayer_impl.h" |
| 10 | 10 |
| 11 namespace webkit_glue { | 11 namespace webkit_glue { |
| 12 | 12 |
| 13 VideoRendererImpl::VideoRendererImpl(bool pts_logging) | 13 VideoRendererImpl::VideoRendererImpl(bool pts_logging) |
| 14 : last_converted_frame_(NULL), | 14 : last_converted_frame_(NULL), |
| 15 pts_logging_(pts_logging) { | 15 pts_logging_(pts_logging) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 VideoRendererImpl::~VideoRendererImpl() {} | 18 VideoRendererImpl::~VideoRendererImpl() {} |
| 19 | 19 |
| 20 bool VideoRendererImpl::OnInitialize(media::VideoDecoder* decoder) { | 20 bool VideoRendererImpl::OnInitialize(media::VideoDecoder* decoder) { |
| 21 video_size_.SetSize(width(), height()); | 21 video_size_.SetSize(decoder->width(), decoder->height()); |
| 22 bitmap_.setConfig(SkBitmap::kARGB_8888_Config, width(), height()); | 22 bitmap_.setConfig(SkBitmap::kARGB_8888_Config, |
| 23 if (bitmap_.allocPixels(NULL, NULL)) { | 23 decoder->width(), decoder->height()); |
| 24 bitmap_.eraseRGB(0x00, 0x00, 0x00); | 24 bitmap_.allocPixels(); |
|
Ami GONE FROM CHROMIUM
2011/07/20 16:30:22
CHECK it?
scherkus (not reviewing)
2011/07/20 16:51:52
most chromium code simply assumes the call will wo
Ami GONE FROM CHROMIUM
2011/07/20 16:56:26
I wish code like this had a compile-time flag that
| |
| 25 return true; | 25 bitmap_.eraseRGB(0x00, 0x00, 0x00); |
| 26 } | 26 return true; |
| 27 | |
| 28 NOTREACHED(); | |
| 29 return false; | |
| 30 } | 27 } |
| 31 | 28 |
| 32 void VideoRendererImpl::OnStop(media::FilterCallback* callback) { | 29 void VideoRendererImpl::OnStop(media::FilterCallback* callback) { |
| 33 if (callback) { | 30 if (callback) { |
| 34 callback->Run(); | 31 callback->Run(); |
| 35 delete callback; | 32 delete callback; |
| 36 } | 33 } |
| 37 } | 34 } |
| 38 | 35 |
| 39 void VideoRendererImpl::OnFrameAvailable() { | 36 void VideoRendererImpl::OnFrameAvailable() { |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 // Transform destination rect to local coordinates. | 304 // Transform destination rect to local coordinates. |
| 308 SkRect transformed_rect; | 305 SkRect transformed_rect; |
| 309 SkRect skia_dest_rect; | 306 SkRect skia_dest_rect; |
| 310 skia_dest_rect.iset(src_rect.x(), src_rect.y(), | 307 skia_dest_rect.iset(src_rect.x(), src_rect.y(), |
| 311 src_rect.right(), src_rect.bottom()); | 308 src_rect.right(), src_rect.bottom()); |
| 312 matrix.mapRect(&transformed_rect, skia_dest_rect); | 309 matrix.mapRect(&transformed_rect, skia_dest_rect); |
| 313 transformed_rect.round(dest_rect); | 310 transformed_rect.round(dest_rect); |
| 314 } | 311 } |
| 315 | 312 |
| 316 } // namespace webkit_glue | 313 } // namespace webkit_glue |
| OLD | NEW |