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

Unified Diff: content/renderer/media_capture_from_element/html_video_element_capturer_source.cc

Issue 2764633002: cc/paint: Remove cc::PaintSurface. (Closed)
Patch Set: more stuff Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media_capture_from_element/html_video_element_capturer_source.cc
diff --git a/content/renderer/media_capture_from_element/html_video_element_capturer_source.cc b/content/renderer/media_capture_from_element/html_video_element_capturer_source.cc
index 5314f254e938db0734f82fdde816f5ec728366d1..2b385fa939df84032eaa9c2854d2dccacb785ceb 100644
--- a/content/renderer/media_capture_from_element/html_video_element_capturer_source.cc
+++ b/content/renderer/media_capture_from_element/html_video_element_capturer_source.cc
@@ -9,8 +9,7 @@
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
-#include "cc/paint/paint_canvas.h"
-#include "cc/paint/paint_surface.h"
+#include "cc/paint/skia_paint_canvas.h"
#include "content/public/renderer/render_thread.h"
#include "content/renderer/media/media_stream_video_source.h"
#include "content/renderer/media/webrtc_uma_histograms.h"
@@ -94,9 +93,10 @@ void HtmlVideoElementCapturerSource::StartCapture(
return;
}
const blink::WebSize resolution = web_media_player_->naturalSize();
- surface_ = cc::PaintSurface::MakeRasterN32Premul(resolution.width,
- resolution.height);
- if (!surface_) {
+
+ canvas_ = cc::SkiaPaintCanvas::CreateRasterZeroed(
+ SkImageInfo::MakeN32Premul(resolution.width, resolution.height));
+ if (!canvas_) {
running_callback_.Run(false);
return;
}
@@ -133,19 +133,19 @@ void HtmlVideoElementCapturerSource::sendNewFrame() {
const base::TimeTicks current_time = base::TimeTicks::Now();
const blink::WebSize resolution = web_media_player_->naturalSize();
- cc::PaintCanvas* canvas = surface_->getCanvas();
cc::PaintFlags flags;
flags.setBlendMode(SkBlendMode::kSrc);
flags.setFilterQuality(kLow_SkFilterQuality);
web_media_player_->paint(
- canvas, blink::WebRect(0, 0, resolution.width, resolution.height), flags);
- DCHECK_NE(kUnknown_SkColorType, canvas->imageInfo().colorType());
- DCHECK_EQ(canvas->imageInfo().width(), resolution.width);
- DCHECK_EQ(canvas->imageInfo().height(), resolution.height);
+ canvas_.get(), blink::WebRect(0, 0, resolution.width, resolution.height),
+ flags);
+ DCHECK_NE(kUnknown_SkColorType, canvas_->imageInfo().colorType());
+ DCHECK_EQ(canvas_->imageInfo().width(), resolution.width);
+ DCHECK_EQ(canvas_->imageInfo().height(), resolution.height);
SkBitmap bitmap;
- bitmap.setInfo(canvas->imageInfo());
- canvas->readPixels(&bitmap, 0, 0);
+ bitmap.setInfo(canvas_->imageInfo());
+ canvas_->readPixels(&bitmap, 0, 0);
DCHECK_NE(kUnknown_SkColorType, bitmap.colorType());
DCHECK(!bitmap.drawsNothing());

Powered by Google App Engine
This is Rietveld 408576698