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.
5 #ifndef MEDIA_FILTERS_SKCANVAS_VIDEO_RENDERER_H_
6 #define MEDIA_FILTERS_SKCANVAS_VIDEO_RENDERER_H_
8 #include "base/time/time.h"
9 #include "media/base/media_export.h"
10 #include "third_party/skia/include/core/SkBitmap.h"
11 #include "ui/gfx/rect.h"
19 // Handles rendering of VideoFrames to SkCanvases, doing any necessary YUV
20 // conversion and caching of resulting RGB bitmaps.
21 class MEDIA_EXPORT SkCanvasVideoRenderer
{
23 SkCanvasVideoRenderer();
24 ~SkCanvasVideoRenderer();
26 // Paints |video_frame| on |canvas|, scaling the result to fit dimensions
27 // specified by |dest_rect|.
29 // Black will be painted on |canvas| if |video_frame| is null.
30 void Paint(media::VideoFrame
* video_frame
,
32 const gfx::RectF
& dest_rect
,
36 // An RGB bitmap and corresponding timestamp of the previously converted
39 base::TimeDelta last_frame_timestamp_
;
41 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer
);
46 #endif // MEDIA_FILTERS_SKCANVAS_VIDEO_RENDERER_H_