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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 SkCanvas* canvas, | 59 SkCanvas* canvas, |
60 const Context3D& context_3d); | 60 const Context3D& context_3d); |
61 | 61 |
62 // Convert the contents of |video_frame| to raw RGB pixels. |rgb_pixels| | 62 // Convert the contents of |video_frame| to raw RGB pixels. |rgb_pixels| |
63 // should point into a buffer large enough to hold as many 32 bit RGBA pixels | 63 // should point into a buffer large enough to hold as many 32 bit RGBA pixels |
64 // as are in the visible_rect() area of the frame. | 64 // as are in the visible_rect() area of the frame. |
65 static void ConvertVideoFrameToRGBPixels(const media::VideoFrame* video_frame, | 65 static void ConvertVideoFrameToRGBPixels(const media::VideoFrame* video_frame, |
66 void* rgb_pixels, | 66 void* rgb_pixels, |
67 size_t row_bytes); | 67 size_t row_bytes); |
68 | 68 |
69 // Copy the contents of texture of |video_frame| to texture |texture|. | 69 // Copy the contents of texture of |video_frame| to texture |texture| in |
| 70 // context |destination_gl|. |
70 // |level|, |internal_format|, |type| specify target texture |texture|. | 71 // |level|, |internal_format|, |type| specify target texture |texture|. |
71 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE. | 72 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE. |
72 static void CopyVideoFrameSingleTextureToGLTexture( | 73 // |context_3d| has a GrContext that may be used during the copy. |
73 gpu::gles2::GLES2Interface* gl, | 74 // Returns true on success. |
| 75 static bool CopyVideoFrameTexturesToGLTexture( |
| 76 const Context3D& context_3d, |
| 77 gpu::gles2::GLES2Interface* destination_gl, |
74 VideoFrame* video_frame, | 78 VideoFrame* video_frame, |
75 unsigned int texture, | 79 unsigned int texture, |
76 unsigned int internal_format, | 80 unsigned int internal_format, |
77 unsigned int type, | 81 unsigned int type, |
78 bool premultiply_alpha, | 82 bool premultiply_alpha, |
79 bool flip_y); | 83 bool flip_y); |
80 | 84 |
81 // In general, We hold the most recently painted frame to increase the | 85 // In general, We hold the most recently painted frame to increase the |
82 // performance for the case that the same frame needs to be painted | 86 // performance for the case that the same frame needs to be painted |
83 // repeatedly. Call this function if you are sure the most recent frame will | 87 // repeatedly. Call this function if you are sure the most recent frame will |
(...skipping 10 matching lines...) Expand all Loading... |
94 | 98 |
95 // Used for DCHECKs to ensure method calls executed in the correct thread. | 99 // Used for DCHECKs to ensure method calls executed in the correct thread. |
96 base::ThreadChecker thread_checker_; | 100 base::ThreadChecker thread_checker_; |
97 | 101 |
98 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); | 102 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); |
99 }; | 103 }; |
100 | 104 |
101 } // namespace media | 105 } // namespace media |
102 | 106 |
103 #endif // MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ | 107 #endif // MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ |
OLD | NEW |