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

Side by Side Diff: include/gpu/GrTestUtils.h

Issue 1867053002: Appease valgrind wrt testing code initialization (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address code review comments Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/pathops/SkPathOpsSimplify.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrTestUtils_DEFINED 8 #ifndef GrTestUtils_DEFINED
9 #define GrTestUtils_DEFINED 9 #define GrTestUtils_DEFINED
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // There are only a few cases of random colors which interest us 44 // There are only a few cases of random colors which interest us
45 enum ColorMode { 45 enum ColorMode {
46 kAllOnes_ColorMode, 46 kAllOnes_ColorMode,
47 kAllZeros_ColorMode, 47 kAllZeros_ColorMode,
48 kAlphaOne_ColorMode, 48 kAlphaOne_ColorMode,
49 kRandom_ColorMode, 49 kRandom_ColorMode,
50 kLast_ColorMode = kRandom_ColorMode 50 kLast_ColorMode = kRandom_ColorMode
51 }; 51 };
52 52
53 ColorMode colorMode = ColorMode(random->nextULessThan(kLast_ColorMode + 1)); 53 ColorMode colorMode = ColorMode(random->nextULessThan(kLast_ColorMode + 1));
54 GrColor color; 54 GrColor color SK_INIT_TO_AVOID_WARNING;
55 switch (colorMode) { 55 switch (colorMode) {
56 case kAllOnes_ColorMode: 56 case kAllOnes_ColorMode:
57 color = GrColorPackRGBA(0xFF, 0xFF, 0xFF, 0xFF); 57 color = GrColorPackRGBA(0xFF, 0xFF, 0xFF, 0xFF);
58 break; 58 break;
59 case kAllZeros_ColorMode: 59 case kAllZeros_ColorMode:
60 color = GrColorPackRGBA(0, 0, 0, 0); 60 color = GrColorPackRGBA(0, 0, 0, 0);
61 break; 61 break;
62 case kAlphaOne_ColorMode: 62 case kAlphaOne_ColorMode:
63 color = GrColorPackRGBA(random->nextULessThan(256), 63 color = GrColorPackRGBA(random->nextULessThan(256),
64 random->nextULessThan(256), 64 random->nextULessThan(256),
(...skipping 15 matching lines...) Expand all
80 80
81 static inline uint8_t GrRandomCoverage(SkRandom* random) { 81 static inline uint8_t GrRandomCoverage(SkRandom* random) {
82 enum CoverageMode { 82 enum CoverageMode {
83 kZero_CoverageMode, 83 kZero_CoverageMode,
84 kAllOnes_CoverageMode, 84 kAllOnes_CoverageMode,
85 kRandom_CoverageMode, 85 kRandom_CoverageMode,
86 kLast_CoverageMode = kRandom_CoverageMode 86 kLast_CoverageMode = kRandom_CoverageMode
87 }; 87 };
88 88
89 CoverageMode colorMode = CoverageMode(random->nextULessThan(kLast_CoverageMo de + 1)); 89 CoverageMode colorMode = CoverageMode(random->nextULessThan(kLast_CoverageMo de + 1));
90 uint8_t coverage; 90 uint8_t coverage SK_INIT_TO_AVOID_WARNING;
91 switch (colorMode) { 91 switch (colorMode) {
92 case kZero_CoverageMode: 92 case kZero_CoverageMode:
93 coverage = 0; 93 coverage = 0;
94 break; 94 break;
95 case kAllOnes_CoverageMode: 95 case kAllOnes_CoverageMode:
96 coverage = 0xff; 96 coverage = 0xff;
97 break; 97 break;
98 case kRandom_CoverageMode: 98 case kRandom_CoverageMode:
99 coverage = random->nextULessThan(256); 99 coverage = random->nextULessThan(256);
100 break; 100 break;
101 } 101 }
102 return coverage; 102 return coverage;
103 } 103 }
104 104
105 #endif 105 #endif
106 #endif 106 #endif
OLDNEW
« no previous file with comments | « no previous file | src/pathops/SkPathOpsSimplify.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698