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

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

Issue 7726002: Completely random typo fixes and style corrections cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR response. 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 | « webkit/glue/media/video_renderer_impl.h ('k') | webkit/glue/media/web_video_renderer.h » ('j') | 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 "base/logging.h" 7 #include "base/logging.h"
8 #include "media/base/video_frame.h" 8 #include "media/base/video_frame.h"
9 #include "media/base/yuv_convert.h" 9 #include "media/base/yuv_convert.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 proxy_->Repaint(); 53 proxy_->Repaint();
54 } 54 }
55 55
56 void VideoRendererImpl::SetWebMediaPlayerProxy(WebMediaPlayerProxy* proxy) { 56 void VideoRendererImpl::SetWebMediaPlayerProxy(WebMediaPlayerProxy* proxy) {
57 proxy_ = proxy; 57 proxy_ = proxy;
58 } 58 }
59 59
60 void VideoRendererImpl::SetRect(const gfx::Rect& rect) {} 60 void VideoRendererImpl::SetRect(const gfx::Rect& rect) {}
61 61
62 // This method is always called on the renderer's thread. 62 // This method is always called on the renderer's thread.
63 void VideoRendererImpl::Paint(SkCanvas* canvas, 63 void VideoRendererImpl::Paint(SkCanvas* canvas, const gfx::Rect& dest_rect) {
64 const gfx::Rect& dest_rect) {
65 scoped_refptr<media::VideoFrame> video_frame; 64 scoped_refptr<media::VideoFrame> video_frame;
66 GetCurrentFrame(&video_frame); 65 GetCurrentFrame(&video_frame);
67 if (!video_frame) { 66 if (!video_frame) {
68 SkPaint paint; 67 SkPaint paint;
69 paint.setColor(SK_ColorBLACK); 68 paint.setColor(SK_ColorBLACK);
70 canvas->drawRectCoords( 69 canvas->drawRectCoords(
71 static_cast<float>(dest_rect.x()), 70 static_cast<float>(dest_rect.x()),
72 static_cast<float>(dest_rect.y()), 71 static_cast<float>(dest_rect.y()),
73 static_cast<float>(dest_rect.right()), 72 static_cast<float>(dest_rect.right()),
74 static_cast<float>(dest_rect.bottom()), 73 static_cast<float>(dest_rect.bottom()),
75 paint); 74 paint);
76 } else { 75 } else {
77 if (CanFastPaint(canvas, dest_rect)) { 76 if (CanFastPaint(canvas, dest_rect)) {
78 FastPaint(video_frame, canvas, dest_rect); 77 FastPaint(video_frame, canvas, dest_rect);
79 } else { 78 } else {
80 SlowPaint(video_frame, canvas, dest_rect); 79 SlowPaint(video_frame, canvas, dest_rect);
81 } 80 }
82 81
83 // Presentation timestamp logging is primarily used to measure performance 82 // Presentation timestamp logging is primarily used to measure performance
84 // on low-end devices. When profiled on an Intel Atom N280 @ 1.66GHz this 83 // on low-end devices. When profiled on an Intel Atom N280 @ 1.66GHz this
85 // code had a ~63 microsecond perf hit when logging to a file (not stdout), 84 // code had a ~63 microsecond perf hit when logging to a file (not stdout),
86 // which is neglible enough for measuring playback performance. 85 // which is neglible enough for measuring playback performance.
87 if (pts_logging_) 86 if (pts_logging_)
88 VLOG(1) << "pts=" << video_frame->GetTimestamp().InMicroseconds(); 87 VLOG(1) << "pts=" << video_frame->GetTimestamp().InMicroseconds();
89 } 88 }
90 89
91 PutCurrentFrame(video_frame); 90 PutCurrentFrame(video_frame);
92 } 91 }
93 92
94 void VideoRendererImpl::GetCurrentFrame(
95 scoped_refptr<media::VideoFrame>* frame_out) {
96 VideoRendererBase::GetCurrentFrame(frame_out);
97 }
98
99 void VideoRendererImpl::PutCurrentFrame(
100 scoped_refptr<media::VideoFrame> frame) {
101 VideoRendererBase::PutCurrentFrame(frame);
102 }
103
104 // CanFastPaint is a helper method to determine the conditions for fast 93 // CanFastPaint is a helper method to determine the conditions for fast
105 // painting. The conditions are: 94 // painting. The conditions are:
106 // 1. No skew in canvas matrix. 95 // 1. No skew in canvas matrix.
107 // 2. No flipping nor mirroring. 96 // 2. No flipping nor mirroring.
108 // 3. Canvas has pixel format ARGB8888. 97 // 3. Canvas has pixel format ARGB8888.
109 // 4. Canvas is opaque. 98 // 4. Canvas is opaque.
110 // TODO(hclam): The fast paint method should support flipping and mirroring. 99 // TODO(hclam): The fast paint method should support flipping and mirroring.
111 // Disable the flipping and mirroring checks once we have it. 100 // Disable the flipping and mirroring checks once we have it.
112 bool VideoRendererImpl::CanFastPaint(SkCanvas* canvas, 101 bool VideoRendererImpl::CanFastPaint(SkCanvas* canvas,
113 const gfx::Rect& dest_rect) { 102 const gfx::Rect& dest_rect) {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 video_frame->stride(media::VideoFrame::kUPlane), 296 video_frame->stride(media::VideoFrame::kUPlane),
308 bitmap.rowBytes(), 297 bitmap.rowBytes(),
309 yuv_type, 298 yuv_type,
310 media::ROTATE_0, 299 media::ROTATE_0,
311 media::FILTER_BILINEAR); 300 media::FILTER_BILINEAR);
312 bitmap.unlockPixels(); 301 bitmap.unlockPixels();
313 } 302 }
314 } 303 }
315 304
316 } // namespace webkit_glue 305 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/media/video_renderer_impl.h ('k') | webkit/glue/media/web_video_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698