| Index: src/gpu/GrTestUtils.cpp
|
| diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp
|
| index 86a84ceb0a3afe02c4b9f87d5146b959007904a7..c5b22801c05335a3c6a523ef98850fd6a4db30dd 100644
|
| --- a/src/gpu/GrTestUtils.cpp
|
| +++ b/src/gpu/GrTestUtils.cpp
|
| @@ -5,12 +5,12 @@
|
| * found in the LICENSE file.
|
| */
|
|
|
| -#include "GrStrokeInfo.h"
|
| #include "GrTestUtils.h"
|
| +#include "GrStyle.h"
|
| #include "SkMatrix.h"
|
| -#include "SkPathEffect.h"
|
| #include "SkPath.h"
|
| #include "SkRRect.h"
|
| +#include "SkTemplates.h"
|
|
|
| #ifdef GR_TEST_UTILS
|
|
|
| @@ -237,24 +237,25 @@ SkStrokeRec TestStrokeRec(SkRandom* random) {
|
| return rec;
|
| }
|
|
|
| -GrStrokeInfo TestStrokeInfo(SkRandom* random) {
|
| - SkStrokeRec::InitStyle style =
|
| +void TestStyle(SkRandom* random, GrStyle* style) {
|
| + SkStrokeRec::InitStyle initStyle =
|
| SkStrokeRec::InitStyle(random->nextULessThan(SkStrokeRec::kFill_InitStyle + 1));
|
| - GrStrokeInfo strokeInfo(style);
|
| - randomize_stroke_rec(&strokeInfo, random);
|
| - SkPathEffect::DashInfo dashInfo;
|
| - dashInfo.fCount = random->nextRangeU(1, 50) * 2;
|
| - dashInfo.fIntervals = new SkScalar[dashInfo.fCount];
|
| - SkScalar sum = 0;
|
| - for (int i = 0; i < dashInfo.fCount; i++) {
|
| - dashInfo.fIntervals[i] = random->nextRangeScalar(SkDoubleToScalar(0.01),
|
| - SkDoubleToScalar(10.0));
|
| - sum += dashInfo.fIntervals[i];
|
| + SkStrokeRec stroke(initStyle);
|
| + randomize_stroke_rec(&stroke, random);
|
| + sk_sp<SkPathEffect> pe;
|
| + if (random->nextBool()) {
|
| + int cnt = random->nextRangeU(1, 50) * 2;
|
| + SkAutoTDeleteArray<SkScalar> intervals(new SkScalar[cnt]);
|
| + SkScalar sum = 0;
|
| + for (int i = 0; i < cnt; i++) {
|
| + intervals[i] = random->nextRangeScalar(SkDoubleToScalar(0.01),
|
| + SkDoubleToScalar(10.0));
|
| + sum += intervals[i];
|
| + }
|
| + SkScalar phase = random->nextRangeScalar(0, sum);
|
| + pe = TestDashPathEffect::Make(intervals.get(), cnt, phase);
|
| }
|
| - dashInfo.fPhase = random->nextRangeScalar(0, sum);
|
| - strokeInfo.setDashInfo(dashInfo);
|
| - delete[] dashInfo.fIntervals;
|
| - return strokeInfo;
|
| + *style = GrStyle(stroke, pe.get());
|
| }
|
|
|
| };
|
|
|