Index: cc/paint/paint_canvas.cc |
diff --git a/cc/paint/paint_canvas.cc b/cc/paint/paint_canvas.cc |
index c3512dada61547f9b7d69768df6d6fa316f13acf..042af4754fe0cad7132dcd9f18190bb5f5bf4514 100644 |
--- a/cc/paint/paint_canvas.cc |
+++ b/cc/paint/paint_canvas.cc |
@@ -21,4 +21,17 @@ PaintCanvasPassThrough::PaintCanvasPassThrough(int width, int height) |
PaintCanvasPassThrough::~PaintCanvasPassThrough() = default; |
+bool ToPixmap(PaintCanvas* canvas, SkPixmap* output) { |
+ 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 |