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

Side by Side Diff: media/renderers/skcanvas_video_renderer.h

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years 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
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | media/renderers/skcanvas_video_renderer.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ 5 #ifndef MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_
6 #define MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ 6 #define MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
16 #include "media/base/media_export.h" 16 #include "media/base/media_export.h"
17 #include "media/base/timestamp_constants.h" 17 #include "media/base/timestamp_constants.h"
18 #include "media/base/video_frame.h" 18 #include "media/base/video_frame.h"
19 #include "media/base/video_rotation.h" 19 #include "media/base/video_rotation.h"
20 #include "media/filters/context_3d.h" 20 #include "media/filters/context_3d.h"
21 #include "skia/ext/cdl_common.h"
21 #include "third_party/skia/include/core/SkImage.h" 22 #include "third_party/skia/include/core/SkImage.h"
22 #include "third_party/skia/include/core/SkRefCnt.h" 23 #include "third_party/skia/include/core/SkRefCnt.h"
23 24
24 class SkCanvas;
25
26 namespace gfx { 25 namespace gfx {
27 class RectF; 26 class RectF;
28 } 27 }
29 28
30 namespace media { 29 namespace media {
31 30
32 // Handles rendering of VideoFrames to SkCanvases. 31 // Handles rendering of VideoFrames to SkCanvases.
33 class MEDIA_EXPORT SkCanvasVideoRenderer { 32 class MEDIA_EXPORT SkCanvasVideoRenderer {
34 public: 33 public:
35 SkCanvasVideoRenderer(); 34 SkCanvasVideoRenderer();
36 ~SkCanvasVideoRenderer(); 35 ~SkCanvasVideoRenderer();
37 36
38 // Paints |video_frame| on |canvas|, scaling and rotating the result to fit 37 // Paints |video_frame| on |canvas|, scaling and rotating the result to fit
39 // dimensions specified by |dest_rect|. 38 // dimensions specified by |dest_rect|.
40 // If the format of |video_frame| is PIXEL_FORMAT_NATIVE_TEXTURE, |context_3d| 39 // If the format of |video_frame| is PIXEL_FORMAT_NATIVE_TEXTURE, |context_3d|
41 // must be provided. 40 // must be provided.
42 // 41 //
43 // Black will be painted on |canvas| if |video_frame| is null. 42 // Black will be painted on |canvas| if |video_frame| is null.
44 void Paint(const scoped_refptr<VideoFrame>& video_frame, 43 void Paint(const scoped_refptr<VideoFrame>& video_frame,
45 SkCanvas* canvas, 44 CdlCanvas* canvas,
46 const gfx::RectF& dest_rect, 45 const gfx::RectF& dest_rect,
47 SkPaint& paint, 46 CdlPaint& paint,
48 VideoRotation video_rotation, 47 VideoRotation video_rotation,
49 const Context3D& context_3d); 48 const Context3D& context_3d);
50 49
51 // Copy |video_frame| on |canvas|. 50 // Copy |video_frame| on |canvas|.
52 // If the format of |video_frame| is PIXEL_FORMAT_NATIVE_TEXTURE, |context_3d| 51 // If the format of |video_frame| is PIXEL_FORMAT_NATIVE_TEXTURE, |context_3d|
53 // must be provided. 52 // must be provided.
54 void Copy(const scoped_refptr<VideoFrame>& video_frame, 53 void Copy(const scoped_refptr<VideoFrame>& video_frame,
55 SkCanvas* canvas, 54 CdlCanvas* canvas,
56 const Context3D& context_3d); 55 const Context3D& context_3d);
57 56
58 enum class ConvertingSize { VISUAL, CODED }; 57 enum class ConvertingSize { VISUAL, CODED };
59 // Convert the contents of |video_frame| to raw RGB pixels. |rgb_pixels| 58 // Convert the contents of |video_frame| to raw RGB pixels. |rgb_pixels|
60 // should point into a buffer large enough to hold as many 32 bit RGBA pixels 59 // should point into a buffer large enough to hold as many 32 bit RGBA pixels
61 // as are in the visible_rect() area of the frame. 60 // as are in the visible_rect() area of the frame.
62 static void ConvertVideoFrameToRGBPixels(const media::VideoFrame* video_frame, 61 static void ConvertVideoFrameToRGBPixels(const media::VideoFrame* video_frame,
63 ConvertingSize size_type, 62 ConvertingSize size_type,
64 void* rgb_pixels, 63 void* rgb_pixels,
65 size_t row_bytes); 64 size_t row_bytes);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 120
122 // Used for unit test. 121 // Used for unit test.
123 SkISize last_image_dimensions_for_testing_; 122 SkISize last_image_dimensions_for_testing_;
124 123
125 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); 124 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer);
126 }; 125 };
127 126
128 } // namespace media 127 } // namespace media
129 128
130 #endif // MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ 129 #endif // MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | media/renderers/skcanvas_video_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698