Replace GrAAType with flags for path renderers
Replaces the single GrAAType with a set of flags indicating which AA
types are acceptable for the path renderer to use.
Bug: skia:
Change-Id: I773565c904a360355e771966b6cddba697e1165f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/200840
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/tests/PathRendererCacheTests.cpp b/tests/PathRendererCacheTests.cpp
index 505e5e3..b02517c 100644
--- a/tests/PathRendererCacheTests.cpp
+++ b/tests/PathRendererCacheTests.cpp
@@ -28,11 +28,13 @@
return path;
}
+using AATypeFlags = GrPathRenderer::AATypeFlags;
+
static void draw_path(GrContext* ctx,
GrRenderTargetContext* renderTargetContext,
const SkPath& path,
GrPathRenderer* pr,
- GrAAType aaType,
+ AATypeFlags aaTypeFlags,
const GrStyle& style) {
GrPaint paint;
paint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc));
@@ -53,7 +55,7 @@
&clipConservativeBounds,
&matrix,
&shape,
- aaType,
+ aaTypeFlags,
false};
pr->drawPath(args);
}
@@ -72,7 +74,7 @@
std::function<SkPath(void)> createPath,
std::function<GrPathRenderer*(GrContext*)> createPathRenderer,
int expected,
- GrAAType aaType = GrAAType::kNone,
+ AATypeFlags aaTypeFlags = AATypeFlags::kNone,
GrStyle style = GrStyle(SkStrokeRec::kFill_InitStyle)) {
sk_sp<GrContext> ctx = GrContext::MakeMock(nullptr);
// The cache needs to be big enough that nothing gets flushed, or our expectations can be wrong
@@ -96,7 +98,7 @@
REPORTER_ASSERT(reporter, cache_non_scratch_resources_equals(cache, 0));
// Draw the path, check that new resource count matches expectations
- draw_path(ctx.get(), rtc.get(), path, pathRenderer.get(), aaType, style);
+ draw_path(ctx.get(), rtc.get(), path, pathRenderer.get(), aaTypeFlags, style);
ctx->flush();
REPORTER_ASSERT(reporter, cache_non_scratch_resources_equals(cache, expected));
@@ -129,7 +131,8 @@
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(1);
GrStyle style(paint);
- test_path(reporter, create_concave_path, createPR, kExpectedResources, GrAAType::kNone, style);
+ test_path(
+ reporter, create_concave_path, createPR, kExpectedResources, AATypeFlags::kNone, style);
}
// Test that deleting the original path invalidates the textures cached by the SW path renderer
@@ -142,7 +145,7 @@
// only contains a single quad so GrFillRectOp doesn't need to use the shared index buffer.
const int kExpectedResources = 1;
- test_path(reporter, create_concave_path, createPR, kExpectedResources, GrAAType::kCoverage);
+ test_path(reporter, create_concave_path, createPR, kExpectedResources, AATypeFlags::kCoverage);
// Test with a style that alters the path geometry. This needs to attach the invalidation logic
// to the original path, not the modified path produced by the style.
@@ -150,6 +153,6 @@
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(1);
GrStyle style(paint);
- test_path(reporter, create_concave_path, createPR, kExpectedResources, GrAAType::kCoverage,
+ test_path(reporter, create_concave_path, createPR, kExpectedResources, AATypeFlags::kCoverage,
style);
}