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

Side by Side Diff: media/blink/skcanvas_video_renderer.h

Issue 1315323006: webgl: optimize webgl.texSubImage2D(video) path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix canvas2d-webgl failures Created 5 years, 2 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_BLINK_SKCANVAS_VIDEO_RENDERER_H_ 5 #ifndef MEDIA_BLINK_SKCANVAS_VIDEO_RENDERER_H_
6 #define MEDIA_BLINK_SKCANVAS_VIDEO_RENDERER_H_ 6 #define MEDIA_BLINK_SKCANVAS_VIDEO_RENDERER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // Convert the contents of |video_frame| to raw RGB pixels. |rgb_pixels| 57 // Convert the contents of |video_frame| to raw RGB pixels. |rgb_pixels|
58 // should point into a buffer large enough to hold as many 32 bit RGBA pixels 58 // should point into a buffer large enough to hold as many 32 bit RGBA pixels
59 // as are in the visible_rect() area of the frame. 59 // as are in the visible_rect() area of the frame.
60 static void ConvertVideoFrameToRGBPixels(const media::VideoFrame* video_frame, 60 static void ConvertVideoFrameToRGBPixels(const media::VideoFrame* video_frame,
61 void* rgb_pixels, 61 void* rgb_pixels,
62 size_t row_bytes); 62 size_t row_bytes);
63 63
64 // Copy the contents of texture of |video_frame| to texture |texture|. 64 // Copy the contents of texture of |video_frame| to texture |texture|.
65 // |level|, |internal_format|, |type| specify target texture |texture|. 65 // |level|, |internal_format|, |type| specify target texture |texture|.
66 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE. 66 // The format of |video_frame| must be VideoFrame::NATIVE_TEXTURE.
67 struct CopyFrameSingleTextureParams {
68 enum CopyType { FullCopy, SubCopy };
69 CopyType copy_type;
70 unsigned int target;
71 unsigned int texture;
72 unsigned int internal_format;
73 unsigned int type;
74 int level;
75 int xoffset;
76 int yoffset;
77 bool premultiply_alpha;
78 bool flip_y;
79 };
67 static void CopyVideoFrameSingleTextureToGLTexture( 80 static void CopyVideoFrameSingleTextureToGLTexture(
68 gpu::gles2::GLES2Interface* gl, 81 gpu::gles2::GLES2Interface* gl,
69 VideoFrame* video_frame, 82 VideoFrame* video_frame,
70 unsigned int texture, 83 const CopyFrameSingleTextureParams& params);
71 unsigned int internal_format,
72 unsigned int type,
73 bool premultiply_alpha,
74 bool flip_y);
75 84
76 private: 85 private:
77 void ResetCache(); 86 void ResetCache();
78 87
79 // Last image used to draw to the canvas. 88 // Last image used to draw to the canvas.
80 skia::RefPtr<SkImage> last_image_; 89 skia::RefPtr<SkImage> last_image_;
81 // Timestamp of the videoframe used to generate |last_image_|. 90 // Timestamp of the videoframe used to generate |last_image_|.
82 base::TimeDelta last_timestamp_ = media::kNoTimestamp(); 91 base::TimeDelta last_timestamp_ = media::kNoTimestamp();
83 // If |last_image_| is not used for a while, it's deleted to save memory. 92 // If |last_image_| is not used for a while, it's deleted to save memory.
84 base::DelayTimer last_image_deleting_timer_; 93 base::DelayTimer last_image_deleting_timer_;
85 94
86 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer); 95 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRenderer);
87 }; 96 };
88 97
89 } // namespace media 98 } // namespace media
90 99
91 #endif // MEDIA_BLINK_SKCANVAS_VIDEO_RENDERER_H_ 100 #endif // MEDIA_BLINK_SKCANVAS_VIDEO_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698