OLD | NEW |
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 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "media/base/video_rotation.h" | 21 #include "media/base/video_rotation.h" |
22 #include "media/filters/context_3d.h" | 22 #include "media/filters/context_3d.h" |
23 #include "third_party/skia/include/core/SkImage.h" | 23 #include "third_party/skia/include/core/SkImage.h" |
24 #include "third_party/skia/include/core/SkRefCnt.h" | 24 #include "third_party/skia/include/core/SkRefCnt.h" |
25 | 25 |
26 | 26 |
27 namespace gfx { | 27 namespace gfx { |
28 class RectF; | 28 class RectF; |
29 } | 29 } |
30 | 30 |
| 31 namespace gpu { |
| 32 struct Capabilities; |
| 33 } |
| 34 |
31 namespace media { | 35 namespace media { |
32 | 36 |
33 // TODO(enne): rename to PaintCanvasVideoRenderer | 37 // TODO(enne): rename to PaintCanvasVideoRenderer |
34 // Handles rendering of VideoFrames to PaintCanvases. | 38 // Handles rendering of VideoFrames to PaintCanvases. |
35 class MEDIA_EXPORT SkCanvasVideoRenderer { | 39 class MEDIA_EXPORT SkCanvasVideoRenderer { |
36 public: | 40 public: |
37 SkCanvasVideoRenderer(); | 41 SkCanvasVideoRenderer(); |
38 ~SkCanvasVideoRenderer(); | 42 ~SkCanvasVideoRenderer(); |
39 | 43 |
40 // Paints |video_frame| on |canvas|, scaling and rotating the result to fit | 44 // Paints |video_frame| on |canvas|, scaling and rotating the result to fit |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 const Context3D& context_3d, | 100 const Context3D& context_3d, |
97 gpu::gles2::GLES2Interface* destination_gl, | 101 gpu::gles2::GLES2Interface* destination_gl, |
98 const scoped_refptr<VideoFrame>& video_frame, | 102 const scoped_refptr<VideoFrame>& video_frame, |
99 unsigned int texture, | 103 unsigned int texture, |
100 unsigned int internal_format, | 104 unsigned int internal_format, |
101 unsigned int format, | 105 unsigned int format, |
102 unsigned int type, | 106 unsigned int type, |
103 bool premultiply_alpha, | 107 bool premultiply_alpha, |
104 bool flip_y); | 108 bool flip_y); |
105 | 109 |
106 // Converts unsigned 16-bit value to target |format| for Y16 format and | 110 // Calls texImage2D where the texture image data source is the contents of |
107 // calls WebGL texImage2D. | 111 // |video_frame|. Texture |texture| needs to be created and bound to |target| |
108 // |level|, |internal_format|, |format|, |type| are WebGL texImage2D | 112 // before this call and the binding is active upon return. |
109 // parameters. | 113 // This is an optimization of WebGL |video_frame| TexImage2D implementation |
| 114 // for specific combinations of |video_frame| and |texture| formats; e.g. if |
| 115 // |frame format| is Y16, optimizes conversion of normalized 16-bit content |
| 116 // and calls texImage2D to |texture|. |level|, |internal_format|, |format| and |
| 117 // |type| are WebGL texImage2D parameters. |
110 // Returns false if there is no implementation for given parameters. | 118 // Returns false if there is no implementation for given parameters. |
111 static bool TexImage2D(unsigned target, | 119 static bool TexImage2D(unsigned target, |
| 120 unsigned texture, |
112 gpu::gles2::GLES2Interface* gl, | 121 gpu::gles2::GLES2Interface* gl, |
| 122 const gpu::Capabilities& gpu_capabilities, |
113 VideoFrame* video_frame, | 123 VideoFrame* video_frame, |
114 int level, | 124 int level, |
115 int internalformat, | 125 int internalformat, |
116 unsigned format, | 126 unsigned format, |
117 unsigned type, | 127 unsigned type, |
118 bool flip_y, | 128 bool flip_y, |
119 bool premultiply_alpha); | 129 bool premultiply_alpha); |
120 | 130 |
121 // Converts unsigned 16-bit value to target |format| for Y16 format and | 131 // Calls texSubImage2D where the texture image data source is the contents of |
122 // calls WebGL texSubImage2D. | 132 // |video_frame|. |
123 // |level|, |format|, |type|, |xoffset| and |yoffset| are texSubImage2D | 133 // This is an optimization of WebGL |video_frame| TexSubImage2D implementation |
124 // parameters. | 134 // for specific combinations of |video_frame| and texture |format| and |type|; |
| 135 // e.g. if |frame format| is Y16, converts unsigned 16-bit value to target |
| 136 // |format| and calls WebGL texSubImage2D. |level|, |format|, |type|, |
| 137 // |xoffset| and |yoffset| are texSubImage2D parameters. |
125 // Returns false if there is no implementation for given parameters. | 138 // Returns false if there is no implementation for given parameters. |
126 static bool TexSubImage2D(unsigned target, | 139 static bool TexSubImage2D(unsigned target, |
127 gpu::gles2::GLES2Interface* gl, | 140 gpu::gles2::GLES2Interface* gl, |
128 VideoFrame* video_frame, | 141 VideoFrame* video_frame, |
129 int level, | 142 int level, |
130 unsigned format, | 143 unsigned format, |
131 unsigned type, | 144 unsigned type, |
132 int xoffset, | 145 int xoffset, |
133 int yoffset, | 146 int yoffset, |
134 bool flip_y, | 147 bool flip_y, |
(...skipping 28 matching lines...) Expand all Loading... |
163 | 176 |
164 // Used for unit test. | 177 // Used for unit test. |
165 SkISize last_image_dimensions_for_testing_; | 178 SkISize last_image_dimensions_for_testing_; |
166 | 179 |
167 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); | 180 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); |
168 }; | 181 }; |
169 | 182 |
170 } // namespace media | 183 } // namespace media |
171 | 184 |
172 #endif // MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ | 185 #endif // MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ |
OLD | NEW |