From 03912f141fba6a5c17ac7e8fbe5998ac3834e29c Mon Sep 17 00:00:00 2001 From: fmalita Date: Wed, 6 Jul 2016 06:22:06 -0700 Subject: Document SkSurface::MakeRaster's memory initialization So clients don't go clearing w/ SK_ColorTRANSPARENT unnecessarily. R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2066903003 Review-Url: https://codereview.chromium.org/2066903003 --- include/core/SkSurface.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'include/core') diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h index a092a81ca5..6c85be04bb 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 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 MakeRaster(const SkImageInfo&, const SkSurfaceProps* = nullptr); + static sk_sp MakeRaster(const SkImageInfo& info, + const SkSurfaceProps* props = nullptr) { + return MakeRaster(info, 0, props); + } /** * Helper version of NewRaster. It creates a SkImageInfo with the -- cgit v1.2.3