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

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: 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 | « src/image/SkSurface_Raster.cpp ('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 a92ecbe50b105befb7ac5e0d53e8ab6185fd5ef7..2a322eaac728bb5887be127ab15b3bf85669e97d 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) {
« no previous file with comments | « src/image/SkSurface_Raster.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698