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