| 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/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "media/base/media_export.h" | 9 #include "media/base/media_export.h" |
| 10 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
| 11 #include "third_party/skia/include/core/SkXfermode.h" |
| 11 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
| 12 | 13 |
| 13 class SkCanvas; | 14 class SkCanvas; |
| 14 | 15 |
| 15 namespace media { | 16 namespace media { |
| 16 | 17 |
| 17 class VideoFrame; | 18 class VideoFrame; |
| 18 | 19 |
| 19 // Handles rendering of VideoFrames to SkCanvases, doing any necessary YUV | 20 // Handles rendering of VideoFrames to SkCanvases, doing any necessary YUV |
| 20 // conversion and caching of resulting RGB bitmaps. | 21 // conversion and caching of resulting RGB bitmaps. |
| 21 class MEDIA_EXPORT SkCanvasVideoRenderer { | 22 class MEDIA_EXPORT SkCanvasVideoRenderer { |
| 22 public: | 23 public: |
| 23 SkCanvasVideoRenderer(); | 24 SkCanvasVideoRenderer(); |
| 24 ~SkCanvasVideoRenderer(); | 25 ~SkCanvasVideoRenderer(); |
| 25 | 26 |
| 26 // Paints |video_frame| on |canvas|, scaling the result to fit dimensions | 27 // Paints |video_frame| on |canvas|, scaling the result to fit dimensions |
| 27 // specified by |dest_rect|. | 28 // specified by |dest_rect|. |
| 28 // | 29 // |
| 29 // Black will be painted on |canvas| if |video_frame| is null. | 30 // Black will be painted on |canvas| if |video_frame| is null. |
| 30 void Paint(media::VideoFrame* video_frame, | 31 void Paint(media::VideoFrame* video_frame, |
| 31 SkCanvas* canvas, | 32 SkCanvas* canvas, |
| 32 const gfx::RectF& dest_rect, | 33 const gfx::RectF& dest_rect, |
| 33 uint8 alpha); | 34 uint8 alpha, |
| 35 SkXfermode::Mode mode); |
| 34 | 36 |
| 35 private: | 37 private: |
| 36 // An RGB bitmap and corresponding timestamp of the previously converted | 38 // An RGB bitmap and corresponding timestamp of the previously converted |
| 37 // video frame data. | 39 // video frame data. |
| 38 SkBitmap last_frame_; | 40 SkBitmap last_frame_; |
| 39 base::TimeDelta last_frame_timestamp_; | 41 base::TimeDelta last_frame_timestamp_; |
| 40 | 42 |
| 41 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); | 43 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 } // namespace media | 46 } // namespace media |
| 45 | 47 |
| 46 #endif // MEDIA_FILTERS_SKCANVAS_VIDEO_RENDERER_H_ | 48 #endif // MEDIA_FILTERS_SKCANVAS_VIDEO_RENDERER_H_ |
| OLD | NEW |