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

Unified Diff: tests/SurfaceTest.cpp

Issue 2066903003: Document SkSurface::MakeRaster's memory initialization (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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
« include/core/SkSurface.h ('K') | « include/core/SkSurface.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SurfaceTest.cpp
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index bcfd0a9387f0f83a5fd835844b7906745884c10c..fdcf2efa391c2c382a487055e941aa8b52583491 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -751,6 +751,18 @@ DEF_TEST(surface_rowbytes, reporter) {
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) {
« include/core/SkSurface.h ('K') | « include/core/SkSurface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698