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

Side by Side Diff: content/renderer/media/capturefromelement/html_video_element_capturer_source.cc

Issue 2682123003: Remove uses of skia::ReadPixels(PaintCanvas) (Closed)
Patch Set: Created 3 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/renderer/media/capturefromelement/html_video_element_capturer_ source.h" 5 #include "content/renderer/media/capturefromelement/html_video_element_capturer_ source.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 cc::PaintCanvas* canvas = surface_->getCanvas(); 136 cc::PaintCanvas* canvas = surface_->getCanvas();
137 cc::PaintFlags paint; 137 cc::PaintFlags paint;
138 paint.setBlendMode(SkBlendMode::kSrc); 138 paint.setBlendMode(SkBlendMode::kSrc);
139 paint.setFilterQuality(kLow_SkFilterQuality); 139 paint.setFilterQuality(kLow_SkFilterQuality);
140 web_media_player_->paint( 140 web_media_player_->paint(
141 canvas, blink::WebRect(0, 0, resolution.width, resolution.height), paint); 141 canvas, blink::WebRect(0, 0, resolution.width, resolution.height), paint);
142 DCHECK_NE(kUnknown_SkColorType, canvas->imageInfo().colorType()); 142 DCHECK_NE(kUnknown_SkColorType, canvas->imageInfo().colorType());
143 DCHECK_EQ(canvas->imageInfo().width(), resolution.width); 143 DCHECK_EQ(canvas->imageInfo().width(), resolution.width);
144 DCHECK_EQ(canvas->imageInfo().height(), resolution.height); 144 DCHECK_EQ(canvas->imageInfo().height(), resolution.height);
145 145
146 const SkBitmap bitmap = skia::ReadPixels(canvas); 146 const SkBitmap bitmap = canvas.ToBitmap();
danakj 2017/02/09 16:27:08 canvas->
147 DCHECK_NE(kUnknown_SkColorType, bitmap.colorType()); 147 DCHECK_NE(kUnknown_SkColorType, bitmap.colorType());
148 DCHECK(!bitmap.drawsNothing()); 148 DCHECK(!bitmap.drawsNothing());
149 DCHECK(bitmap.getPixels()); 149 DCHECK(bitmap.getPixels());
150 if (bitmap.colorType() != kN32_SkColorType) { 150 if (bitmap.colorType() != kN32_SkColorType) {
151 DLOG(ERROR) << "Only supported color type is kN32_SkColorType (ARGB/ABGR)"; 151 DLOG(ERROR) << "Only supported color type is kN32_SkColorType (ARGB/ABGR)";
152 return; 152 return;
153 } 153 }
154 154
155 scoped_refptr<media::VideoFrame> frame = frame_pool_.CreateFrame( 155 scoped_refptr<media::VideoFrame> frame = frame_pool_.CreateFrame(
156 media::PIXEL_FORMAT_I420, resolution, gfx::Rect(resolution), resolution, 156 media::PIXEL_FORMAT_I420, resolution, gfx::Rect(resolution), resolution,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 next_capture_time_ = current_time; 195 next_capture_time_ = current_time;
196 } 196 }
197 // Schedule next capture. 197 // Schedule next capture.
198 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 198 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
199 FROM_HERE, base::Bind(&HtmlVideoElementCapturerSource::sendNewFrame, 199 FROM_HERE, base::Bind(&HtmlVideoElementCapturerSource::sendNewFrame,
200 weak_factory_.GetWeakPtr()), 200 weak_factory_.GetWeakPtr()),
201 next_capture_time_ - current_time); 201 next_capture_time_ - current_time);
202 } 202 }
203 203
204 } // namespace content 204 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698