Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1091)

Side by Side Diff: cc/resources/media/skcanvas_video_renderer.h

Issue 445013002: media: Optimize HW Video to 2D Canvas copy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "cc/base/cc_export.h"
10 #include "cc/output/context_provider.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 11 #include "third_party/skia/include/core/SkBitmap.h"
11 #include "ui/gfx/rect.h" 12 #include "ui/gfx/rect.h"
12 13
13 class SkCanvas; 14 class SkCanvas;
14 15
15 namespace media { 16 namespace media {
17 class VideoFrame;
18 }
16 19
17 class VideoFrame; 20 namespace cc {
18 21
19 // Handles rendering of VideoFrames to SkCanvases, doing any necessary YUV 22 // Handles rendering of VideoFrames to SkCanvases, doing any necessary YUV
20 // conversion and caching of resulting RGB bitmaps. 23 // conversion and caching of resulting RGB bitmaps.
21 class MEDIA_EXPORT SkCanvasVideoRenderer { 24 class CC_EXPORT SkCanvasVideoRenderer {
22 public: 25 public:
23 SkCanvasVideoRenderer(); 26 SkCanvasVideoRenderer();
24 ~SkCanvasVideoRenderer(); 27 ~SkCanvasVideoRenderer();
25 28
26 // Paints |video_frame| on |canvas|, scaling the result to fit dimensions 29 // Paints |video_frame| on |canvas|, scaling the result to fit dimensions
27 // specified by |dest_rect|. 30 // specified by |dest_rect|.
28 // 31 //
29 // Black will be painted on |canvas| if |video_frame| is null. 32 // Black will be painted on |canvas| if |video_frame| is null.
30 void Paint(media::VideoFrame* video_frame, 33 void Paint(media::VideoFrame* video_frame,
31 SkCanvas* canvas, 34 SkCanvas* canvas,
32 const gfx::RectF& dest_rect, 35 const gfx::RectF& dest_rect,
33 uint8 alpha); 36 uint8 alpha,
37 ContextProvider* context_provider);
38
39 static void CopyVideoFrameToTexture(gpu::gles2::GLES2Interface* gl,
40 media::VideoFrame* video_frame,
41 unsigned int texture,
42 unsigned int level,
43 unsigned int internal_format,
44 unsigned int type,
45 bool premultiply_alpha,
46 bool flip_y);
34 47
35 private: 48 private:
49 void CleanUpTemporaryBuffers();
50
36 // An RGB bitmap and corresponding timestamp of the previously converted 51 // An RGB bitmap and corresponding timestamp of the previously converted
37 // video frame data. 52 // video frame data.
38 SkBitmap last_frame_; 53 SkBitmap last_frame_;
39 base::TimeDelta last_frame_timestamp_; 54 base::TimeDelta last_frame_timestamp_;
55 // It's possible to be used by accelerated client and non-accelerated client.
56 SkBitmap accelerated_last_frame_;
57 base::TimeDelta accelerated_last_frame_timestamp_;
40 58
41 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); 59 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer);
42 }; 60 };
43 61
44 } // namespace media 62 } // namespace cc
45 63
46 #endif // MEDIA_FILTERS_SKCANVAS_VIDEO_RENDERER_H_ 64 #endif // MEDIA_FILTERS_SKCANVAS_VIDEO_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698