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

Unified Diff: include/core/SkSurface.h

Issue 2066903003: Document SkSurface::MakeRaster's memory initialization (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review Created 4 years, 5 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
« no previous file with comments | « no previous file | src/image/SkSurface_Raster.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkSurface.h
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h
index a092a81ca592745fc599804952f680194f29f437..6c85be04bb959c382dccef6d7e62ea0b646da8af 100644
--- a/include/core/SkSurface.h
+++ b/include/core/SkSurface.h
@@ -36,6 +36,8 @@ public:
*
* If the requested surface cannot be created, or the request is not a
* supported configuration, NULL will be returned.
+ *
+ * Callers are responsible for initialiazing the surface pixels.
*/
static sk_sp<SkSurface> MakeRasterDirect(const SkImageInfo&, void* pixels, size_t rowBytes,
const SkSurfaceProps* = nullptr);
@@ -49,10 +51,10 @@ public:
void* context, const SkSurfaceProps* = nullptr);
/**
- * Return a new surface, with the memory for the pixels automatically allocated, but respecting
- * the specified rowBytes. If rowBytes==0, then a default value will be chosen. If a non-zero
- * rowBytes is specified, then any images snapped off of this surface (via newImageSnapshot())
- * are guaranteed to have the same rowBytes.
+ * Return a new surface, with the memory for the pixels automatically allocated and
+ * zero-initialized, but respecting the specified rowBytes. If rowBytes==0, then a default
+ * value will be chosen. If a non-zero rowBytes is specified, then any images snapped off of
+ * this surface (via makeImageSnapshot()) are guaranteed to have the same rowBytes.
*
* If the requested surface cannot be created, or the request is not a
* supported configuration, NULL will be returned.
@@ -62,7 +64,10 @@ public:
/**
* Allocate a new surface, automatically computing the rowBytes.
*/
- static sk_sp<SkSurface> MakeRaster(const SkImageInfo&, const SkSurfaceProps* = nullptr);
+ static sk_sp<SkSurface> MakeRaster(const SkImageInfo& info,
+ const SkSurfaceProps* props = nullptr) {
+ return MakeRaster(info, 0, props);
+ }
/**
* Helper version of NewRaster. It creates a SkImageInfo with the
« no previous file with comments | « no previous file | src/image/SkSurface_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698