| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // Copy the contents of texture of |video_frame| to texture |texture|. | 76 // Copy the contents of texture of |video_frame| to texture |texture|. |
| 77 // |level|, |internal_format|, |type| specify target texture |texture|. | 77 // |level|, |internal_format|, |type| specify target texture |texture|. |
| 78 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE. | 78 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE. |
| 79 // |copy_mode| alters how the copy is done, and takes into consideration | 79 // |copy_mode| alters how the copy is done, and takes into consideration |
| 80 // whether the caller will clip the texture to the frame's |visible_rect|, | 80 // whether the caller will clip the texture to the frame's |visible_rect|, |
| 81 // or expects this to be done internally. | 81 // or expects this to be done internally. |
| 82 static void CopyVideoFrameSingleTextureToGLTexture( | 82 static void CopyVideoFrameSingleTextureToGLTexture( |
| 83 gpu::gles2::GLES2Interface* gl, | 83 gpu::gles2::GLES2Interface* gl, |
| 84 VideoFrame* video_frame, | 84 VideoFrame* video_frame, |
| 85 SingleFrameCopyMode copy_mode, | 85 SingleFrameCopyMode copy_mode, |
| 86 unsigned int target, |
| 86 unsigned int texture, | 87 unsigned int texture, |
| 87 unsigned int internal_format, | 88 unsigned int internal_format, |
| 88 unsigned int format, | 89 unsigned int format, |
| 89 unsigned int type, | 90 unsigned int type, |
| 91 int level, |
| 90 bool premultiply_alpha, | 92 bool premultiply_alpha, |
| 91 bool flip_y); | 93 bool flip_y); |
| 92 | 94 |
| 93 // Copy the contents of texture of |video_frame| to texture |texture| in | 95 // Copy the contents of texture of |video_frame| to texture |texture| in |
| 94 // context |destination_gl|. | 96 // context |destination_gl|. |
| 95 // |level|, |internal_format|, |type| specify target texture |texture|. | 97 // |level|, |internal_format|, |type| specify target texture |texture|. |
| 96 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE. | 98 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE. |
| 97 // |context_3d| has a GrContext that may be used during the copy. | 99 // |context_3d| has a GrContext that may be used during the copy. |
| 98 // Returns true on success. | 100 // Returns true on success. |
| 99 bool CopyVideoFrameTexturesToGLTexture( | 101 bool CopyVideoFrameTexturesToGLTexture( |
| 100 const Context3D& context_3d, | 102 const Context3D& context_3d, |
| 101 gpu::gles2::GLES2Interface* destination_gl, | 103 gpu::gles2::GLES2Interface* destination_gl, |
| 102 const scoped_refptr<VideoFrame>& video_frame, | 104 const scoped_refptr<VideoFrame>& video_frame, |
| 105 unsigned int target, |
| 103 unsigned int texture, | 106 unsigned int texture, |
| 104 unsigned int internal_format, | 107 unsigned int internal_format, |
| 105 unsigned int format, | 108 unsigned int format, |
| 106 unsigned int type, | 109 unsigned int type, |
| 110 int level, |
| 107 bool premultiply_alpha, | 111 bool premultiply_alpha, |
| 108 bool flip_y); | 112 bool flip_y); |
| 109 | 113 |
| 110 // Calls texImage2D where the texture image data source is the contents of | 114 // Calls texImage2D where the texture image data source is the contents of |
| 111 // |video_frame|. Texture |texture| needs to be created and bound to |target| | 115 // |video_frame|. Texture |texture| needs to be created and bound to |target| |
| 112 // before this call and the binding is active upon return. | 116 // before this call and the binding is active upon return. |
| 113 // This is an optimization of WebGL |video_frame| TexImage2D implementation | 117 // This is an optimization of WebGL |video_frame| TexImage2D implementation |
| 114 // for specific combinations of |video_frame| and |texture| formats; e.g. if | 118 // for specific combinations of |video_frame| and |texture| formats; e.g. if |
| 115 // |frame format| is Y16, optimizes conversion of normalized 16-bit content | 119 // |frame format| is Y16, optimizes conversion of normalized 16-bit content |
| 116 // and calls texImage2D to |texture|. |level|, |internal_format|, |format| and | 120 // and calls texImage2D to |texture|. |level|, |internal_format|, |format| and |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 180 |
| 177 // Used for unit test. | 181 // Used for unit test. |
| 178 SkISize last_image_dimensions_for_testing_; | 182 SkISize last_image_dimensions_for_testing_; |
| 179 | 183 |
| 180 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); | 184 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); |
| 181 }; | 185 }; |
| 182 | 186 |
| 183 } // namespace media | 187 } // namespace media |
| 184 | 188 |
| 185 #endif // MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ | 189 #endif // MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ |
| OLD | NEW |