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

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: more readpixels 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 SkBitmap bitmap;
147 bitmap.setInfo(canvas->imageInfo());
148 canvas->readPixels(&bitmap, 0, 0);
149
147 DCHECK_NE(kUnknown_SkColorType, bitmap.colorType()); 150 DCHECK_NE(kUnknown_SkColorType, bitmap.colorType());
148 DCHECK(!bitmap.drawsNothing()); 151 DCHECK(!bitmap.drawsNothing());
149 DCHECK(bitmap.getPixels()); 152 DCHECK(bitmap.getPixels());
150 if (bitmap.colorType() != kN32_SkColorType) { 153 if (bitmap.colorType() != kN32_SkColorType) {
151 DLOG(ERROR) << "Only supported color type is kN32_SkColorType (ARGB/ABGR)"; 154 DLOG(ERROR) << "Only supported color type is kN32_SkColorType (ARGB/ABGR)";
152 return; 155 return;
153 } 156 }
154 157
155 scoped_refptr<media::VideoFrame> frame = frame_pool_.CreateFrame( 158 scoped_refptr<media::VideoFrame> frame = frame_pool_.CreateFrame(
156 media::PIXEL_FORMAT_I420, resolution, gfx::Rect(resolution), resolution, 159 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; 198 next_capture_time_ = current_time;
196 } 199 }
197 // Schedule next capture. 200 // Schedule next capture.
198 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 201 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
199 FROM_HERE, base::Bind(&HtmlVideoElementCapturerSource::sendNewFrame, 202 FROM_HERE, base::Bind(&HtmlVideoElementCapturerSource::sendNewFrame,
200 weak_factory_.GetWeakPtr()), 203 weak_factory_.GetWeakPtr()),
201 next_capture_time_ - current_time); 204 next_capture_time_ - current_time);
202 } 205 }
203 206
204 } // namespace content 207 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698