Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 #include "Fuzz.h" | 8 #include "Fuzz.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 return true; | 73 return true; |
| 74 } | 74 } |
| 75 | 75 |
| 76 void fuzzLinearGradient(Fuzz* fuzz) { | 76 void fuzzLinearGradient(Fuzz* fuzz) { |
| 77 SkScalar a, b, c, d; | 77 SkScalar a, b, c, d; |
| 78 bool useLocalMatrix, useGlobalMatrix; | 78 bool useLocalMatrix, useGlobalMatrix; |
| 79 if (!fuzz->next<SkScalar>(&a) || | 79 if (!fuzz->next<SkScalar>(&a) || |
| 80 !fuzz->next<SkScalar>(&b) || | 80 !fuzz->next<SkScalar>(&b) || |
| 81 !fuzz->next<SkScalar>(&c) || | 81 !fuzz->next<SkScalar>(&c) || |
| 82 !fuzz->next<SkScalar>(&d) || | 82 !fuzz->next<SkScalar>(&d) || |
| 83 !fuzz->next<bool>(&useLocalMatrix) || | 83 !fuzz->next(&useLocalMatrix) || |
|
mtklein_C
2016/10/24 17:45:10
This code reads inconsistently, before this CL and
kjlubick
2016/10/24 18:27:01
All the types removed and the || are lined up as w
| |
| 84 !fuzz->next<bool>(&useGlobalMatrix)) { | 84 !fuzz->next(&useGlobalMatrix)) { |
| 85 return; | 85 return; |
| 86 } | 86 } |
| 87 SkPoint pts[2] = {SkPoint::Make(a,b), SkPoint::Make(c, d)}; | 87 SkPoint pts[2] = {SkPoint::Make(a,b), SkPoint::Make(c, d)}; |
| 88 | 88 |
| 89 uint32_t count; | 89 uint32_t count; |
| 90 SkColor* colors; | 90 SkColor* colors; |
| 91 SkScalar* pos; | 91 SkScalar* pos; |
| 92 SkShader::TileMode mode; | 92 SkShader::TileMode mode; |
| 93 if (!initGradientParams(fuzz, &count, &colors, &pos, &mode)) { | 93 if (!initGradientParams(fuzz, &count, &colors, &pos, &mode)) { |
| 94 return; | 94 return; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 120 surface->getCanvas()->drawPaint(p); | 120 surface->getCanvas()->drawPaint(p); |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 void fuzzRadialGradient(Fuzz* fuzz) { | 124 void fuzzRadialGradient(Fuzz* fuzz) { |
| 125 SkScalar a, b, radius; | 125 SkScalar a, b, radius; |
| 126 bool useLocalMatrix, useGlobalMatrix; | 126 bool useLocalMatrix, useGlobalMatrix; |
| 127 if (!fuzz->next<SkScalar>(&a) || | 127 if (!fuzz->next<SkScalar>(&a) || |
| 128 !fuzz->next<SkScalar>(&b) || | 128 !fuzz->next<SkScalar>(&b) || |
| 129 !fuzz->next<SkScalar>(&radius) || | 129 !fuzz->next<SkScalar>(&radius) || |
| 130 !fuzz->next<bool>(&useLocalMatrix) || | 130 !fuzz->next(&useLocalMatrix) || |
| 131 !fuzz->next<bool>(&useGlobalMatrix)) { | 131 !fuzz->next(&useGlobalMatrix)) { |
| 132 return; | 132 return; |
| 133 } | 133 } |
| 134 SkPoint center = SkPoint::Make(a,b); | 134 SkPoint center = SkPoint::Make(a,b); |
| 135 | 135 |
| 136 uint32_t count; | 136 uint32_t count; |
| 137 SkColor* colors; | 137 SkColor* colors; |
| 138 SkScalar* pos; | 138 SkScalar* pos; |
| 139 SkShader::TileMode mode; | 139 SkShader::TileMode mode; |
| 140 if (!initGradientParams(fuzz, &count, &colors, &pos, &mode)) { | 140 if (!initGradientParams(fuzz, &count, &colors, &pos, &mode)) { |
| 141 return; | 141 return; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 171 | 171 |
| 172 void fuzzTwoPointConicalGradient(Fuzz* fuzz) { | 172 void fuzzTwoPointConicalGradient(Fuzz* fuzz) { |
| 173 SkScalar a, b, startRadius, c, d, endRadius; | 173 SkScalar a, b, startRadius, c, d, endRadius; |
| 174 bool useLocalMatrix, useGlobalMatrix; | 174 bool useLocalMatrix, useGlobalMatrix; |
| 175 if (!fuzz->next<SkScalar>(&a) || | 175 if (!fuzz->next<SkScalar>(&a) || |
| 176 !fuzz->next<SkScalar>(&b) || | 176 !fuzz->next<SkScalar>(&b) || |
| 177 !fuzz->next<SkScalar>(&startRadius) || | 177 !fuzz->next<SkScalar>(&startRadius) || |
| 178 !fuzz->next<SkScalar>(&c) || | 178 !fuzz->next<SkScalar>(&c) || |
| 179 !fuzz->next<SkScalar>(&d) || | 179 !fuzz->next<SkScalar>(&d) || |
| 180 !fuzz->next<SkScalar>(&endRadius) || | 180 !fuzz->next<SkScalar>(&endRadius) || |
| 181 !fuzz->next<bool>(&useLocalMatrix) || | 181 !fuzz->next(&useLocalMatrix) || |
| 182 !fuzz->next<bool>(&useGlobalMatrix)) { | 182 !fuzz->next(&useGlobalMatrix)) { |
| 183 return; | 183 return; |
| 184 } | 184 } |
| 185 SkPoint start = SkPoint::Make(a, b); | 185 SkPoint start = SkPoint::Make(a, b); |
| 186 SkPoint end = SkPoint::Make(c, d); | 186 SkPoint end = SkPoint::Make(c, d); |
| 187 | 187 |
| 188 uint32_t count; | 188 uint32_t count; |
| 189 SkColor* colors; | 189 SkColor* colors; |
| 190 SkScalar* pos; | 190 SkScalar* pos; |
| 191 SkShader::TileMode mode; | 191 SkShader::TileMode mode; |
| 192 if (!initGradientParams(fuzz, &count, &colors, &pos, &mode)) { | 192 if (!initGradientParams(fuzz, &count, &colors, &pos, &mode)) { |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 218 } else { | 218 } else { |
| 219 surface->getCanvas()->drawPaint(p); | 219 surface->getCanvas()->drawPaint(p); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 void fuzzSweepGradient(Fuzz* fuzz) { | 223 void fuzzSweepGradient(Fuzz* fuzz) { |
| 224 SkScalar cx, cy; | 224 SkScalar cx, cy; |
| 225 bool useLocalMatrix, useGlobalMatrix; | 225 bool useLocalMatrix, useGlobalMatrix; |
| 226 if (!fuzz->next<SkScalar>(&cx) || | 226 if (!fuzz->next<SkScalar>(&cx) || |
| 227 !fuzz->next<SkScalar>(&cy) || | 227 !fuzz->next<SkScalar>(&cy) || |
| 228 !fuzz->next<bool>(&useLocalMatrix) || | 228 !fuzz->next(&useLocalMatrix) || |
| 229 !fuzz->next<bool>(&useGlobalMatrix)) { | 229 !fuzz->next(&useGlobalMatrix)) { |
| 230 return; | 230 return; |
| 231 } | 231 } |
| 232 | 232 |
| 233 uint32_t count; | 233 uint32_t count; |
| 234 SkColor* colors; | 234 SkColor* colors; |
| 235 SkScalar* pos; | 235 SkScalar* pos; |
| 236 SkShader::TileMode mode; | 236 SkShader::TileMode mode; |
| 237 if (!initGradientParams(fuzz, &count, &colors, &pos, &mode)) { | 237 if (!initGradientParams(fuzz, &count, &colors, &pos, &mode)) { |
| 238 return; | 238 return; |
| 239 } | 239 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 return; | 285 return; |
| 286 case 2: | 286 case 2: |
| 287 SkDebugf("TwoPointConicalGradient\n"); | 287 SkDebugf("TwoPointConicalGradient\n"); |
| 288 fuzzTwoPointConicalGradient(fuzz); | 288 fuzzTwoPointConicalGradient(fuzz); |
| 289 return; | 289 return; |
| 290 } | 290 } |
| 291 SkDebugf("SweepGradient\n"); | 291 SkDebugf("SweepGradient\n"); |
| 292 fuzzSweepGradient(fuzz); | 292 fuzzSweepGradient(fuzz); |
| 293 return; | 293 return; |
| 294 } | 294 } |
| OLD | NEW |