aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTestUtils.cpp
diff options
context:
space:
mode:
authorGravatar senorblanco <senorblanco@chromium.org>2015-08-05 13:37:49 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-05 13:37:49 -0700
commit59cd36765c10f6451f72ffde446b9ae8ce5599c8 (patch)
treeb70c53cc015aef46a0af2d0d42c31f86de4c4464 /src/gpu/GrTestUtils.cpp
parent29e0d3f267a03546f236023347cdb4595ece2fd1 (diff)
Revert of Implement caching of stroked paths in the tessellated path renderer. (patchset #4 id:60001 of https://codereview.chromium.org/1275553002/ )
Reason for revert: Breaking/asserting in Debug on DM. Original issue's description: > Implement caching of stroked paths in the tessellated path renderer. > > This requires adding the stroke info to the cache key, and doing the > stroking and dashing before rendering as triangles. > > BUG=skia:3755 > > Committed: https://skia.googlesource.com/skia/+/29e0d3f267a03546f236023347cdb4595ece2fd1 TBR=bsalomon@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:3755 Review URL: https://codereview.chromium.org/1276633002
Diffstat (limited to 'src/gpu/GrTestUtils.cpp')
-rw-r--r--src/gpu/GrTestUtils.cpp37
1 files changed, 6 insertions, 31 deletions
diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp
index 9e1dbce691..b690d7e3cd 100644
--- a/src/gpu/GrTestUtils.cpp
+++ b/src/gpu/GrTestUtils.cpp
@@ -5,10 +5,8 @@
* found in the LICENSE file.
*/
-#include "GrStrokeInfo.h"
#include "GrTestUtils.h"
#include "SkMatrix.h"
-#include "SkPathEffect.h"
#include "SkPath.h"
#include "SkRRect.h"
@@ -218,44 +216,21 @@ const SkPath& TestPathConvex(SkRandom* random) {
return gPath[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gPath)))];
}
-static void randomize_stroke_rec(SkStrokeRec* rec, SkRandom* random) {
+SkStrokeRec TestStrokeRec(SkRandom* random) {
+ SkStrokeRec::InitStyle style =
+ SkStrokeRec::InitStyle(random->nextULessThan(SkStrokeRec::kFill_InitStyle + 1));
+ SkStrokeRec rec(style);
bool strokeAndFill = random->nextBool();
SkScalar strokeWidth = random->nextBool() ? 0.f : 1.f;
- rec->setStrokeStyle(strokeWidth, strokeAndFill);
+ rec.setStrokeStyle(strokeWidth, strokeAndFill);
SkPaint::Cap cap = SkPaint::Cap(random->nextULessThan(SkPaint::kCapCount));
SkPaint::Join join = SkPaint::Join(random->nextULessThan(SkPaint::kJoinCount));
SkScalar miterLimit = random->nextRangeScalar(1.f, 5.f);
- rec->setStrokeParams(cap, join, miterLimit);
-}
-
-SkStrokeRec TestStrokeRec(SkRandom* random) {
- SkStrokeRec::InitStyle style =
- SkStrokeRec::InitStyle(random->nextULessThan(SkStrokeRec::kFill_InitStyle + 1));
- SkStrokeRec rec(style);
- randomize_stroke_rec(&rec, random);
+ rec.setStrokeParams(cap, join, miterLimit);
return rec;
}
-GrStrokeInfo TestStrokeInfo(SkRandom* random) {
- SkStrokeRec::InitStyle style =
- SkStrokeRec::InitStyle(random->nextULessThan(SkStrokeRec::kFill_InitStyle + 1));
- GrStrokeInfo strokeInfo(style);
- randomize_stroke_rec(&strokeInfo, random);
- SkPathEffect::DashInfo dashInfo;
- dashInfo.fCount = random->nextRangeU(1, 100);
- dashInfo.fIntervals = SkNEW_ARRAY(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];
- }
- dashInfo.fPhase = random->nextRangeScalar(0, sum);
- strokeInfo.setDashInfo(dashInfo);
- return strokeInfo;
-}
-
};
#endif