Chromium Code Reviews| 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_FILTERS_SKCANVAS_VIDEO_RENDERER_H_ | 5 #ifndef MEDIA_FILTERS_SKCANVAS_VIDEO_RENDERER_H_ |
| 6 #define MEDIA_FILTERS_SKCANVAS_VIDEO_RENDERER_H_ | 6 #define MEDIA_FILTERS_SKCANVAS_VIDEO_RENDERER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 | 24 |
| 25 // Handles rendering of VideoFrames to SkCanvases, doing any necessary YUV | 25 // Handles rendering of VideoFrames to SkCanvases, doing any necessary YUV |
| 26 // conversion and caching of resulting RGB bitmaps. | 26 // conversion and caching of resulting RGB bitmaps. |
| 27 class MEDIA_EXPORT SkCanvasVideoRenderer { | 27 class MEDIA_EXPORT SkCanvasVideoRenderer { |
| 28 public: | 28 public: |
| 29 SkCanvasVideoRenderer(); | 29 SkCanvasVideoRenderer(); |
| 30 ~SkCanvasVideoRenderer(); | 30 ~SkCanvasVideoRenderer(); |
| 31 | 31 |
| 32 // Paints |video_frame| on |canvas|, scaling and rotating the result to fit | 32 // Paints |video_frame| on |canvas|, scaling and rotating the result to fit |
| 33 // dimensions specified by |dest_rect|. | 33 // dimensions specified by |dest_rect|. |
| 34 // If the format of |video_frame| is VideoFrame::NATIVE_TEXTURE and |canvas| | 34 // If the format of |video_frame| is VideoFrame::NATIVE_TEXTURE, |context_3d| |
| 35 // is ganeshed, |context_3d| must be provided. | 35 // must be provided. |
| 36 // | 36 // |
| 37 // Black will be painted on |canvas| if |video_frame| is null. | 37 // Black will be painted on |canvas| if |video_frame| is null. |
| 38 void Paint(const scoped_refptr<VideoFrame>& video_frame, | 38 void Paint(const scoped_refptr<VideoFrame>& video_frame, |
| 39 SkCanvas* canvas, | 39 SkCanvas* canvas, |
| 40 const gfx::RectF& dest_rect, | 40 const gfx::RectF& dest_rect, |
| 41 uint8 alpha, | 41 uint8 alpha, |
| 42 SkXfermode::Mode mode, | 42 SkXfermode::Mode mode, |
| 43 VideoRotation video_rotation, | 43 VideoRotation video_rotation, |
| 44 const Context3D& context_3d); | 44 const Context3D& context_3d); |
| 45 | 45 |
| 46 // Copy |video_frame| on |canvas|. | 46 // Copy |video_frame| on |canvas|. |
| 47 void Copy(const scoped_refptr<VideoFrame>&, SkCanvas* canvas); | 47 // If the format of |video_frame| is VideoFrame::NATIVE_TEXTURE, |context_3d| |
| 48 // must be provided. | |
| 49 void Copy(const scoped_refptr<VideoFrame>&, | |
|
DaleCurtis
2015/01/14 22:44:01
add video_frame variable name.
dshwang
2015/01/15 13:44:16
Done.
| |
| 50 SkCanvas* canvas, | |
| 51 const Context3D& context_3d); | |
| 48 | 52 |
| 49 // Copy the contents of texture of |video_frame| to texture |texture|. | 53 // Copy the contents of texture of |video_frame| to texture |texture|. |
| 50 // |level|, |internal_format|, |type| specify target texture |texture|. | 54 // |level|, |internal_format|, |type| specify target texture |texture|. |
| 51 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE. | 55 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE. |
| 52 static void CopyVideoFrameTextureToGLTexture(gpu::gles2::GLES2Interface* gl, | 56 static void CopyVideoFrameTextureToGLTexture(gpu::gles2::GLES2Interface* gl, |
| 53 VideoFrame* video_frame, | 57 VideoFrame* video_frame, |
| 54 unsigned int texture, | 58 unsigned int texture, |
| 55 unsigned int level, | 59 unsigned int level, |
| 56 unsigned int internal_format, | 60 unsigned int internal_format, |
| 57 unsigned int type, | 61 unsigned int type, |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 77 VideoImageGenerator* accelerated_generator_; | 81 VideoImageGenerator* accelerated_generator_; |
| 78 base::TimeDelta accelerated_last_frame_timestamp_; | 82 base::TimeDelta accelerated_last_frame_timestamp_; |
| 79 base::DelayTimer<SkCanvasVideoRenderer> accelerated_frame_deleting_timer_; | 83 base::DelayTimer<SkCanvasVideoRenderer> accelerated_frame_deleting_timer_; |
| 80 | 84 |
| 81 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); | 85 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); |
| 82 }; | 86 }; |
| 83 | 87 |
| 84 } // namespace media | 88 } // namespace media |
| 85 | 89 |
| 86 #endif // MEDIA_FILTERS_SKCANVAS_VIDEO_RENDERER_H_ | 90 #endif // MEDIA_FILTERS_SKCANVAS_VIDEO_RENDERER_H_ |
| OLD | NEW |