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
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index a92ecbe..2a322ea 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -751,6 +751,18 @@
REPORTER_ASSERT(reporter, nullptr == s);
}
+DEF_TEST(surface_raster_zeroinitialized, reporter) {
+ sk_sp<SkSurface> s(SkSurface::MakeRasterN32Premul(100, 100));
+ SkPixmap pixmap;
+ REPORTER_ASSERT(reporter, s->peekPixels(&pixmap));
+
+ for (int i = 0; i < pixmap.info().width(); ++i) {
+ for (int j = 0; j < pixmap.info().height(); ++j) {
+ REPORTER_ASSERT(reporter, *pixmap.addr32(i, j) == 0);
+ }
+ }
+}
+
#if SK_SUPPORT_GPU
static sk_sp<SkSurface> create_gpu_surface_backend_texture(
GrContext* context, int sampleCnt, uint32_t color, GrBackendObject* outTexture) {