diff options
author | fmalita <fmalita@chromium.org> | 2016-07-06 06:22:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-06 06:22:06 -0700 |
commit | 03912f141fba6a5c17ac7e8fbe5998ac3834e29c (patch) | |
tree | eb2cde8e33cbafc8903098ce054bd08a279cb8b4 /include/core | |
parent | 1e2a702c1959d37db734d2ecfaee0e5035b2bfbb (diff) |
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
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkSurface.h | 15 |
1 files changed, 10 insertions, 5 deletions
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<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 |