| 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 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 media::ConvertYUVToRGB32(video_frame->data(media::VideoFrame::kYPlane), | 169 media::ConvertYUVToRGB32(video_frame->data(media::VideoFrame::kYPlane), |
| 170 video_frame->data(media::VideoFrame::kUPlane), | 170 video_frame->data(media::VideoFrame::kUPlane), |
| 171 video_frame->data(media::VideoFrame::kVPlane), | 171 video_frame->data(media::VideoFrame::kVPlane), |
| 172 static_cast<uint8*>(bitmap_.getPixels()), | 172 static_cast<uint8*>(bitmap_.getPixels()), |
| 173 video_frame->width(), | 173 video_frame->width(), |
| 174 video_frame->height(), | 174 video_frame->height(), |
| 175 video_frame->stride(media::VideoFrame::kYPlane), | 175 video_frame->stride(media::VideoFrame::kYPlane), |
| 176 video_frame->stride(media::VideoFrame::kUPlane), | 176 video_frame->stride(media::VideoFrame::kUPlane), |
| 177 bitmap_.rowBytes(), | 177 bitmap_.rowBytes(), |
| 178 yuv_type); | 178 yuv_type); |
| 179 bitmap_.notifyPixelsChanged(); |
| 179 bitmap_.unlockPixels(); | 180 bitmap_.unlockPixels(); |
| 180 } | 181 } |
| 181 | 182 |
| 182 // 2. Paint the bitmap to canvas. | 183 // 2. Paint the bitmap to canvas. |
| 183 SkMatrix matrix; | 184 SkMatrix matrix; |
| 184 matrix.setTranslate(static_cast<SkScalar>(dest_rect.x()), | 185 matrix.setTranslate(static_cast<SkScalar>(dest_rect.x()), |
| 185 static_cast<SkScalar>(dest_rect.y())); | 186 static_cast<SkScalar>(dest_rect.y())); |
| 186 if (dest_rect.width() != video_size_.width() || | 187 if (dest_rect.width() != video_size_.width() || |
| 187 dest_rect.height() != video_size_.height()) { | 188 dest_rect.height() != video_size_.height()) { |
| 188 matrix.preScale(SkIntToScalar(dest_rect.width()) / | 189 matrix.preScale(SkIntToScalar(dest_rect.width()) / |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // Transform destination rect to local coordinates. | 305 // Transform destination rect to local coordinates. |
| 305 SkRect transformed_rect; | 306 SkRect transformed_rect; |
| 306 SkRect skia_dest_rect; | 307 SkRect skia_dest_rect; |
| 307 skia_dest_rect.iset(src_rect.x(), src_rect.y(), | 308 skia_dest_rect.iset(src_rect.x(), src_rect.y(), |
| 308 src_rect.right(), src_rect.bottom()); | 309 src_rect.right(), src_rect.bottom()); |
| 309 matrix.mapRect(&transformed_rect, skia_dest_rect); | 310 matrix.mapRect(&transformed_rect, skia_dest_rect); |
| 310 transformed_rect.round(dest_rect); | 311 transformed_rect.round(dest_rect); |
| 311 } | 312 } |
| 312 | 313 |
| 313 } // namespace webkit_glue | 314 } // namespace webkit_glue |
| OLD | NEW |