Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(765)

Side by Side Diff: webkit/glue/media/video_renderer_impl.cc

Issue 7572027: Fixes video to canvas drawing. The draw operationwas not updating the video (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698