Index: src/core/SkCanvas.cpp |
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp |
index 8351a52bf7adbad5b88b20da73c7d37a8a5b38d9..a6f263f517dd387510638b00d7bba207e93cda4e 100644 |
--- a/src/core/SkCanvas.cpp |
+++ b/src/core/SkCanvas.cpp |
@@ -2529,6 +2529,23 @@ |
return true; |
} |
+SkCanvas* SkCanvas::NewRaster(const SkImageInfo& info) { |
+ if (!supported_for_raster_canvas(info)) { |
+ return NULL; |
+ } |
+ |
+ SkBitmap bitmap; |
+ if (!bitmap.tryAllocPixels(info)) { |
+ return NULL; |
+ } |
+ |
+ // should this functionality be moved into allocPixels()? |
+ if (!bitmap.info().isOpaque()) { |
+ bitmap.eraseColor(0); |
+ } |
+ return SkNEW_ARGS(SkCanvas, (bitmap)); |
+} |
+ |
SkCanvas* SkCanvas::NewRasterDirect(const SkImageInfo& info, void* pixels, size_t rowBytes) { |
if (!supported_for_raster_canvas(info)) { |
return NULL; |