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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // 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| |
59 // 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 |
60 // as are in the visible_rect() area of the frame. | 60 // as are in the visible_rect() area of the frame. |
61 static void ConvertVideoFrameToRGBPixels(const media::VideoFrame* video_frame, | 61 static void ConvertVideoFrameToRGBPixels(const media::VideoFrame* video_frame, |
62 void* rgb_pixels, | 62 void* rgb_pixels, |
63 size_t row_bytes); | 63 size_t row_bytes); |
64 | 64 |
65 // Copy the contents of texture of |video_frame| to texture |texture|. | 65 // Copy the contents of texture of |video_frame| to texture |texture|. |
66 // |level|, |internal_format|, |type| specify target texture |texture|. | 66 // |level|, |internal_format|, |type| specify target texture |texture|. |
67 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE. | 67 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE. |
| 68 // Assumes |texture| has already been allocated with the appropriate |
| 69 // size and a compatible format, internal format and type; this is |
| 70 // effectively a "TexSubImage" operation. |
68 static void CopyVideoFrameSingleTextureToGLTexture( | 71 static void CopyVideoFrameSingleTextureToGLTexture( |
69 gpu::gles2::GLES2Interface* gl, | 72 gpu::gles2::GLES2Interface* gl, |
70 VideoFrame* video_frame, | 73 VideoFrame* video_frame, |
71 unsigned int texture, | 74 unsigned int texture, |
72 unsigned int internal_format, | |
73 unsigned int type, | |
74 bool premultiply_alpha, | 75 bool premultiply_alpha, |
75 bool flip_y); | 76 bool flip_y); |
76 | 77 |
77 // Copy the contents of texture of |video_frame| to texture |texture| in | 78 // Copy the contents of texture of |video_frame| to texture |texture| in |
78 // context |destination_gl|. | 79 // context |destination_gl|. |
79 // |level|, |internal_format|, |type| specify target texture |texture|. | 80 // |level|, |internal_format|, |type| specify target texture |texture|. |
80 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE. | 81 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE. |
81 // |context_3d| has a GrContext that may be used during the copy. | 82 // |context_3d| has a GrContext that may be used during the copy. |
| 83 // Assumes |texture| has already been allocated with the appropriate |
| 84 // size and a compatible format, internal format and type; this is |
| 85 // effectively a "TexSubImage" operation. |
82 // Returns true on success. | 86 // Returns true on success. |
83 bool CopyVideoFrameTexturesToGLTexture( | 87 bool CopyVideoFrameTexturesToGLTexture( |
84 const Context3D& context_3d, | 88 const Context3D& context_3d, |
85 gpu::gles2::GLES2Interface* destination_gl, | 89 gpu::gles2::GLES2Interface* destination_gl, |
86 const scoped_refptr<VideoFrame>& video_frame, | 90 const scoped_refptr<VideoFrame>& video_frame, |
87 unsigned int texture, | 91 unsigned int texture, |
88 unsigned int internal_format, | |
89 unsigned int type, | |
90 bool premultiply_alpha, | 92 bool premultiply_alpha, |
91 bool flip_y); | 93 bool flip_y); |
92 | 94 |
93 // Converts unsigned 16-bit value to target |format| for Y16 format and | 95 // Converts unsigned 16-bit value to target |format| for Y16 format and |
94 // calls WebGL texImage2D. | 96 // calls WebGL texImage2D. |
95 // |level|, |internal_format|, |format|, |type| are WebGL texImage2D | 97 // |level|, |internal_format|, |format|, |type| are WebGL texImage2D |
96 // parameters. | 98 // parameters. |
97 // Returns false if there is no implementation for given parameters. | 99 // Returns false if there is no implementation for given parameters. |
98 static bool TexImage2D(unsigned target, | 100 static bool TexImage2D(unsigned target, |
99 gpu::gles2::GLES2Interface* gl, | 101 gpu::gles2::GLES2Interface* gl, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 152 |
151 // Used for unit test. | 153 // Used for unit test. |
152 SkISize last_image_dimensions_for_testing_; | 154 SkISize last_image_dimensions_for_testing_; |
153 | 155 |
154 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); | 156 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); |
155 }; | 157 }; |
156 | 158 |
157 } // namespace media | 159 } // namespace media |
158 | 160 |
159 #endif // MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ | 161 #endif // MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ |
OLD | NEW |