| 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>& video_frame, |
| 50 SkCanvas* canvas, |
| 51 const Context3D& context_3d); |
| 48 | 52 |
| 49 // Convert the contents of |video_frame| to raw RGB pixels. |rgb_pixels| | 53 // Convert the contents of |video_frame| to raw RGB pixels. |rgb_pixels| |
| 50 // should point into a buffer large enough to hold as many 32 bit RGBA pixels | 54 // should point into a buffer large enough to hold as many 32 bit RGBA pixels |
| 51 // as are in the visible_rect() area of the frame. | 55 // as are in the visible_rect() area of the frame. |
| 52 static void ConvertVideoFrameToRGBPixels( | 56 static void ConvertVideoFrameToRGBPixels( |
| 53 const scoped_refptr<media::VideoFrame>& video_frame, | 57 const scoped_refptr<media::VideoFrame>& video_frame, |
| 54 void* rgb_pixels, | 58 void* rgb_pixels, |
| 55 size_t row_bytes); | 59 size_t row_bytes); |
| 56 | 60 |
| 57 // Copy the contents of texture of |video_frame| to texture |texture|. | 61 // Copy the contents of texture of |video_frame| to texture |texture|. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 85 VideoImageGenerator* accelerated_generator_; | 89 VideoImageGenerator* accelerated_generator_; |
| 86 base::TimeDelta accelerated_last_frame_timestamp_; | 90 base::TimeDelta accelerated_last_frame_timestamp_; |
| 87 base::DelayTimer<SkCanvasVideoRenderer> accelerated_frame_deleting_timer_; | 91 base::DelayTimer<SkCanvasVideoRenderer> accelerated_frame_deleting_timer_; |
| 88 | 92 |
| 89 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); | 93 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); |
| 90 }; | 94 }; |
| 91 | 95 |
| 92 } // namespace media | 96 } // namespace media |
| 93 | 97 |
| 94 #endif // MEDIA_FILTERS_SKCANVAS_VIDEO_RENDERER_H_ | 98 #endif // MEDIA_FILTERS_SKCANVAS_VIDEO_RENDERER_H_ |
| OLD | NEW |