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