| 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 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 16 #include "media/base/media_export.h" | 16 #include "media/base/media_export.h" |
| 17 #include "media/base/timestamp_constants.h" | 17 #include "media/base/timestamp_constants.h" |
| 18 #include "media/base/video_frame.h" | 18 #include "media/base/video_frame.h" |
| 19 #include "media/base/video_rotation.h" | 19 #include "media/base/video_rotation.h" |
| 20 #include "media/filters/context_3d.h" | 20 #include "media/filters/context_3d.h" |
| 21 #include "third_party/skia/include/core/SkImage.h" | 21 #include "third_party/skia/include/core/SkImage.h" |
| 22 #include "third_party/skia/include/core/SkRefCnt.h" | 22 #include "third_party/skia/include/core/SkRefCnt.h" |
| 23 #include "third_party/skia/include/core/SkXfermode.h" | 23 #include "third_party/skia/include/core/SkXfermode.h" |
| 24 | 24 |
| 25 class SkCanvas; | 25 class SkCanvas; |
| 26 class SkImage; | |
| 27 | 26 |
| 28 namespace gfx { | 27 namespace gfx { |
| 29 class RectF; | 28 class RectF; |
| 30 } | 29 } |
| 31 | 30 |
| 32 namespace media { | 31 namespace media { |
| 33 class VideoImageGenerator; | 32 class VideoImageGenerator; |
| 34 | 33 |
| 35 // Handles rendering of VideoFrames to SkCanvases. | 34 // Handles rendering of VideoFrames to SkCanvases. |
| 36 class MEDIA_EXPORT SkCanvasVideoRenderer { | 35 class MEDIA_EXPORT SkCanvasVideoRenderer { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 bool CopyVideoFrameTexturesToGLTexture( | 85 bool CopyVideoFrameTexturesToGLTexture( |
| 87 const Context3D& context_3d, | 86 const Context3D& context_3d, |
| 88 gpu::gles2::GLES2Interface* destination_gl, | 87 gpu::gles2::GLES2Interface* destination_gl, |
| 89 const scoped_refptr<VideoFrame>& video_frame, | 88 const scoped_refptr<VideoFrame>& video_frame, |
| 90 unsigned int texture, | 89 unsigned int texture, |
| 91 unsigned int internal_format, | 90 unsigned int internal_format, |
| 92 unsigned int type, | 91 unsigned int type, |
| 93 bool premultiply_alpha, | 92 bool premultiply_alpha, |
| 94 bool flip_y); | 93 bool flip_y); |
| 95 | 94 |
| 95 // Method handles reinterpreting two components RG8 as 16 bit value for Y16 |
| 96 // format and optimizing upload-to-texture for some video frame and texture |
| 97 // formats. If needed, there is a conversion followed by a tex(Sub)Image2D or |
| 98 // tex(Sub)Image3D call. |
| 99 // |format|, |internal_format|, |type| specify target texture |texture|. |
| 100 // |xoffset|, |yoffset|, |zoffset| are used when functionID defines sub image |
| 101 // calls. |
| 102 // Returns false if there is no implementation for given parameters or if the |
| 103 // call fails. |
| 104 static bool TexImageImpl(const char* functionID, |
| 105 unsigned target, |
| 106 gpu::gles2::GLES2Interface* gl, |
| 107 VideoFrame* video_frame, |
| 108 int level, |
| 109 int internalformat, |
| 110 unsigned format, |
| 111 unsigned type, |
| 112 int xoffset, |
| 113 int yoffset, |
| 114 int zoffset, |
| 115 bool flipY, |
| 116 bool premultiplyAlpha); |
| 117 |
| 96 // In general, We hold the most recently painted frame to increase the | 118 // In general, We hold the most recently painted frame to increase the |
| 97 // performance for the case that the same frame needs to be painted | 119 // performance for the case that the same frame needs to be painted |
| 98 // repeatedly. Call this function if you are sure the most recent frame will | 120 // repeatedly. Call this function if you are sure the most recent frame will |
| 99 // never be painted again, so we can release the resource. | 121 // never be painted again, so we can release the resource. |
| 100 void ResetCache(); | 122 void ResetCache(); |
| 101 | 123 |
| 102 void CorrectLastImageDimensions(const SkIRect& visible_rect); | 124 void CorrectLastImageDimensions(const SkIRect& visible_rect); |
| 103 | 125 |
| 104 // Used for unit test. | 126 // Used for unit test. |
| 105 SkISize LastImageDimensionsForTesting(); | 127 SkISize LastImageDimensionsForTesting(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 122 | 144 |
| 123 // Used for unit test. | 145 // Used for unit test. |
| 124 SkISize last_image_dimensions_for_testing_; | 146 SkISize last_image_dimensions_for_testing_; |
| 125 | 147 |
| 126 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); | 148 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); |
| 127 }; | 149 }; |
| 128 | 150 |
| 129 } // namespace media | 151 } // namespace media |
| 130 | 152 |
| 131 #endif // MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ | 153 #endif // MEDIA_RENDERERS_SKCANVAS_VIDEO_RENDERER_H_ |
| OLD | NEW |