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