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