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

Unified Diff: src/core/SkCanvas.cpp

Issue 791763002: Revert of remove (dumb) canvas::NewRaster, and rename surface::NewRasterPMColor to N32Premul (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « samplecode/SamplePictFile.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « samplecode/SamplePictFile.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698