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

Unified Diff: cc/paint/paint_canvas.cc

Issue 2686173003: Remove uses of skia::GetWritablePixels(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 side-by-side diff with in-line comments
Download patch
Index: cc/paint/paint_canvas.cc
diff --git a/cc/paint/paint_canvas.cc b/cc/paint/paint_canvas.cc
index c3512dada61547f9b7d69768df6d6fa316f13acf..41ae9c0ed63a9462e62b0a1803b12485cd774c9b 100644
--- a/cc/paint/paint_canvas.cc
+++ b/cc/paint/paint_canvas.cc
@@ -21,4 +21,21 @@ PaintCanvasPassThrough::PaintCanvasPassThrough(int width, int height)
PaintCanvasPassThrough::~PaintCanvasPassThrough() = default;
+bool ToPixmap(PaintCanvas* canvas, SkPixmap* output) {
+ if (!canvas || !output) {
danakj 2017/02/09 23:13:50 ಠ_ಠ is needed?
danakj 2017/02/09 23:23:58 I can't see why this would be needed, so LGTM with
+ return false;
+ }
+
+ SkImageInfo info;
+ size_t row_bytes;
+ void* pixels = canvas->accessTopLayerPixels(&info, &row_bytes);
+ if (!pixels) {
+ output->reset();
+ return false;
+ }
+
+ output->reset(info, pixels, row_bytes);
+ return true;
+}
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698