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

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

Issue 1125573002: onGetInfo is deprecated, just pass info to constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | skia/config/SkUserConfig.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "media/blink/skcanvas_video_renderer.h" 5 #include "media/blink/skcanvas_video_renderer.h"
6 6
7 #include "gpu/GLES2/gl2extchromium.h" 7 #include "gpu/GLES2/gl2extchromium.h"
8 #include "gpu/command_buffer/client/gles2_interface.h" 8 #include "gpu/command_buffer/client/gles2_interface.h"
9 #include "gpu/command_buffer/common/mailbox_holder.h" 9 #include "gpu/command_buffer/common/mailbox_holder.h"
10 #include "media/base/video_frame.h" 10 #include "media/base/video_frame.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 gpu::gles2::GLES2Interface* gl_; 163 gpu::gles2::GLES2Interface* gl_;
164 164
165 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncPointClientImpl); 165 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncPointClientImpl);
166 }; 166 };
167 167
168 } // anonymous namespace 168 } // anonymous namespace
169 169
170 // Generates an RGB image from a VideoFrame. Convert YUV to RGB plain on GPU. 170 // Generates an RGB image from a VideoFrame. Convert YUV to RGB plain on GPU.
171 class VideoImageGenerator : public SkImageGenerator { 171 class VideoImageGenerator : public SkImageGenerator {
172 public: 172 public:
173 VideoImageGenerator(const scoped_refptr<VideoFrame>& frame) : frame_(frame) { 173 VideoImageGenerator(const scoped_refptr<VideoFrame>& frame)
174 : SkImageGenerator(
175 SkImageInfo::MakeN32Premul(frame->visible_rect().width(),
176 frame->visible_rect().height()))
177 , frame_(frame) {
174 DCHECK(frame_.get()); 178 DCHECK(frame_.get());
175 } 179 }
176 ~VideoImageGenerator() override {} 180 ~VideoImageGenerator() override {}
177 181
178 void set_frame(const scoped_refptr<VideoFrame>& frame) { frame_ = frame; } 182 void set_frame(const scoped_refptr<VideoFrame>& frame) { frame_ = frame; }
179 183
180 protected: 184 protected:
181 bool onGetInfo(SkImageInfo* info) override {
182 info->fWidth = frame_->visible_rect().width();
183 info->fHeight = frame_->visible_rect().height();
184 info->fColorType = kN32_SkColorType;
185 info->fAlphaType = kPremul_SkAlphaType;
186 return true;
187 }
188
189 Result onGetPixels(const SkImageInfo& info, 185 Result onGetPixels(const SkImageInfo& info,
190 void* pixels, 186 void* pixels,
191 size_t row_bytes, 187 size_t row_bytes,
192 SkPMColor ctable[], 188 SkPMColor ctable[],
193 int* ctable_count) override { 189 int* ctable_count) override {
194 if (!frame_.get()) 190 if (!frame_.get())
195 return kInvalidInput; 191 return kInvalidInput;
196 // If skia couldn't do the YUV conversion on GPU, we will on CPU. 192 // If skia couldn't do the YUV conversion on GPU, we will on CPU.
197 SkCanvasVideoRenderer::ConvertVideoFrameToRGBPixels( 193 SkCanvasVideoRenderer::ConvertVideoFrameToRGBPixels(
198 frame_, pixels, row_bytes); 194 frame_, pixels, row_bytes);
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 last_frame_timestamp_ = media::kNoTimestamp(); 637 last_frame_timestamp_ = media::kNoTimestamp();
642 } 638 }
643 639
644 void SkCanvasVideoRenderer::ResetAcceleratedLastFrame() { 640 void SkCanvasVideoRenderer::ResetAcceleratedLastFrame() {
645 accelerated_last_frame_.reset(); 641 accelerated_last_frame_.reset();
646 accelerated_generator_ = nullptr; 642 accelerated_generator_ = nullptr;
647 accelerated_last_frame_timestamp_ = media::kNoTimestamp(); 643 accelerated_last_frame_timestamp_ = media::kNoTimestamp();
648 } 644 }
649 645
650 } // namespace media 646 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | skia/config/SkUserConfig.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698