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