aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/GpuDrawPathTest.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-09-23 12:09:16 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-23 12:09:16 -0700
commitaa840647fc7f057715bce62489b96c4299385135 (patch)
tree882f53aff47ce041f0a43537d166451ab2a94e6a /tests/GpuDrawPathTest.cpp
parentbf41fa841b19ebab1eea7df573b3456dd6c5cac0 (diff)
Don't compute path keys for volatile paths in GrShape.
Otherwise, we will compute cache keys for internally transformed paths that don't repeat (e.g. clip paths transformed into device space with a changing view matrix). BUG=chromium:649562 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2369513002 Review-Url: https://codereview.chromium.org/2369513002
Diffstat (limited to 'tests/GpuDrawPathTest.cpp')
-rw-r--r--tests/GpuDrawPathTest.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/GpuDrawPathTest.cpp b/tests/GpuDrawPathTest.cpp
index 1a42a49efd..83641cb2ec 100644
--- a/tests/GpuDrawPathTest.cpp
+++ b/tests/GpuDrawPathTest.cpp
@@ -104,18 +104,15 @@ DEF_GPUTEST(GrPathKeys, reporter, /*factory*/) {
for (const GrStyle& style : styles) {
// Keys should not ignore conic weights.
SkPath path1, path2;
- path1.setIsVolatile(true);
- path2.setIsVolatile(true);
SkPoint p0 = SkPoint::Make(100, 0);
SkPoint p1 = SkPoint::Make(100, 100);
path1.conicTo(p0, p1, .5f);
path2.conicTo(p0, p1, .7f);
- bool isVolatile;
GrUniqueKey key1, key2;
- // Even though the paths are marked volatile, they should have keys based on the path data
- // because they have a small amount of data.
+ // We expect these small paths to be keyed based on their data.
+ bool isVolatile;
GrPath::ComputeKey(GrShape(path1, GrStyle::SimpleFill()), &key1, &isVolatile);
REPORTER_ASSERT(reporter, !isVolatile);
REPORTER_ASSERT(reporter, key1.isValid());
@@ -123,12 +120,19 @@ DEF_GPUTEST(GrPathKeys, reporter, /*factory*/) {
REPORTER_ASSERT(reporter, !isVolatile);
REPORTER_ASSERT(reporter, key1.isValid());
REPORTER_ASSERT(reporter, key1 != key2);
+ {
+ GrUniqueKey tempKey;
+ path1.setIsVolatile(true);
+ GrPath::ComputeKey(GrShape(path1, style), &key1, &isVolatile);
+ REPORTER_ASSERT(reporter, isVolatile);
+ REPORTER_ASSERT(reporter, !tempKey.isValid());
+ }
// Ensure that recreating the GrShape doesn't change the key.
{
GrUniqueKey tempKey;
- GrPath::ComputeKey(GrShape(path1, GrStyle::SimpleFill()), &tempKey, &isVolatile);
- REPORTER_ASSERT(reporter, key1 == tempKey);
+ GrPath::ComputeKey(GrShape(path2, GrStyle::SimpleFill()), &tempKey, &isVolatile);
+ REPORTER_ASSERT(reporter, key2 == tempKey);
}
// Try a large path that is too big to be keyed off its data.