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 |