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

Unified Diff: gm/surface.cpp

Issue 1959173002: Stop valgrind bot from crashing (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/surface.cpp
diff --git a/gm/surface.cpp b/gm/surface.cpp
index 6b794794928f8e52d1c14d6a0d1a87c51e60eeef..15d362efd5942d1112b805656c676f69a05460a4 100644
--- a/gm/surface.cpp
+++ b/gm/surface.cpp
@@ -85,7 +85,7 @@ protected:
const struct {
SkPixelGeometry fGeo;
const char* fLabel;
- } rec[] = {
+ } recs[] = {
{ kUnknown_SkPixelGeometry, "Unknown" },
{ kRGB_H_SkPixelGeometry, "RGB_H" },
{ kBGR_H_SkPixelGeometry, "BGR_H" },
@@ -97,10 +97,16 @@ protected:
for (int disallowAA = 0; disallowAA <= 1; ++disallowAA) {
for (int disallowDither = 0; disallowDither <= 1; ++disallowDither) {
SkScalar y = 0;
- for (size_t i = 0; i < SK_ARRAY_COUNT(rec); ++i) {
- auto surface(make_surface(ctx, info, rec[i].fGeo, disallowAA, disallowDither,
+ for (const auto& rec : recs) {
+ auto surface(make_surface(ctx, info, rec.fGeo, disallowAA, disallowDither,
gammaCorrect));
- test_draw(surface->getCanvas(), rec[i].fLabel);
+ if (!surface) {
+ SkDebugf("failed to create surface! label: %s AA: %s dither: %s\n",
+ rec.fLabel, (disallowAA == 1 ? "disallowed" : "allowed"),
+ (disallowDither == 1 ? "disallowed" : "allowed"));
+ continue;
+ }
+ test_draw(surface->getCanvas(), rec.fLabel);
surface->draw(canvas, x, y, nullptr);
y += H;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698