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/GrCCPRTest.cpp b/tests/GrCCPRTest.cpp
index 1011f66..ab8b479 100644
--- a/tests/GrCCPRTest.cpp
+++ b/tests/GrCCPRTest.cpp
@@ -112,7 +112,7 @@
fCCPR->testingOnly_drawPathDirectly({
fCtx.get(), std::move(paint), &GrUserStencilSettings::kUnused, fRTC.get(), &noClip,
- &clipBounds, &matrix, &shape, GrAAType::kCoverage, false});
+ &clipBounds, &matrix, &shape, GrPathRenderer::AATypeFlags::kCoverage, false});
}
void clipFullscreenRect(SkPath clipPath, SkPMColor4f color = { 0, 1, 0, 1 }) {
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);
}
diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp
index b2499ed..9af45ee 100644
--- a/tests/TessellatingPathRendererTests.cpp
+++ b/tests/TessellatingPathRendererTests.cpp
@@ -633,11 +633,13 @@
return as_SB(shader)->asFragmentProcessor(args);
}
+using AATypeFlags = GrPathRenderer::AATypeFlags;
+
static void test_path(GrContext* ctx,
GrRenderTargetContext* renderTargetContext,
const SkPath& path,
const SkMatrix& matrix = SkMatrix::I(),
- GrAAType aaType = GrAAType::kNone,
+ AATypeFlags aaTypeFlags = AATypeFlags::kNone,
std::unique_ptr<GrFragmentProcessor> fp = nullptr) {
GrTessellatingPathRenderer tess;
@@ -660,7 +662,7 @@
&clipConservativeBounds,
&matrix,
&shape,
- aaType,
+ aaTypeFlags,
false};
tess.drawPath(args);
}
@@ -699,31 +701,31 @@
test_path(ctx, rtc.get(), create_path_16());
SkMatrix nonInvertibleMatrix = SkMatrix::MakeScale(0, 0);
std::unique_ptr<GrFragmentProcessor> fp(create_linear_gradient_processor(ctx));
- test_path(ctx, rtc.get(), create_path_17(), nonInvertibleMatrix, GrAAType::kCoverage,
+ test_path(ctx, rtc.get(), create_path_17(), nonInvertibleMatrix, AATypeFlags::kCoverage,
std::move(fp));
test_path(ctx, rtc.get(), create_path_18());
test_path(ctx, rtc.get(), create_path_19());
- test_path(ctx, rtc.get(), create_path_20(), SkMatrix(), GrAAType::kCoverage);
- test_path(ctx, rtc.get(), create_path_21(), SkMatrix(), GrAAType::kCoverage);
+ test_path(ctx, rtc.get(), create_path_20(), SkMatrix(), AATypeFlags::kCoverage);
+ test_path(ctx, rtc.get(), create_path_21(), SkMatrix(), AATypeFlags::kCoverage);
test_path(ctx, rtc.get(), create_path_23());
test_path(ctx, rtc.get(), create_path_24());
- test_path(ctx, rtc.get(), create_path_25(), SkMatrix(), GrAAType::kCoverage);
- test_path(ctx, rtc.get(), create_path_26(), SkMatrix(), GrAAType::kCoverage);
- test_path(ctx, rtc.get(), create_path_27(), SkMatrix(), GrAAType::kCoverage);
- test_path(ctx, rtc.get(), create_path_28(), SkMatrix(), GrAAType::kCoverage);
+ test_path(ctx, rtc.get(), create_path_25(), SkMatrix(), AATypeFlags::kCoverage);
+ test_path(ctx, rtc.get(), create_path_26(), SkMatrix(), AATypeFlags::kCoverage);
+ test_path(ctx, rtc.get(), create_path_27(), SkMatrix(), AATypeFlags::kCoverage);
+ test_path(ctx, rtc.get(), create_path_28(), SkMatrix(), AATypeFlags::kCoverage);
test_path(ctx, rtc.get(), create_path_29());
test_path(ctx, rtc.get(), create_path_30());
- test_path(ctx, rtc.get(), create_path_31(), SkMatrix(), GrAAType::kCoverage);
+ test_path(ctx, rtc.get(), create_path_31(), SkMatrix(), AATypeFlags::kCoverage);
test_path(ctx, rtc.get(), create_path_32());
test_path(ctx, rtc.get(), create_path_33());
test_path(ctx, rtc.get(), create_path_34());
test_path(ctx, rtc.get(), create_path_35());
test_path(ctx, rtc.get(), create_path_36());
test_path(ctx, rtc.get(), create_path_37());
- test_path(ctx, rtc.get(), create_path_38(), SkMatrix(), GrAAType::kCoverage);
+ test_path(ctx, rtc.get(), create_path_38(), SkMatrix(), AATypeFlags::kCoverage);
test_path(ctx, rtc.get(), create_path_39());
test_path(ctx, rtc.get(), create_path_40());
- test_path(ctx, rtc.get(), create_path_41(), SkMatrix(), GrAAType::kCoverage);
+ test_path(ctx, rtc.get(), create_path_41(), SkMatrix(), AATypeFlags::kCoverage);
test_path(ctx, rtc.get(), create_path_42());
- test_path(ctx, rtc.get(), create_path_43(), SkMatrix(), GrAAType::kCoverage);
+ test_path(ctx, rtc.get(), create_path_43(), SkMatrix(), AATypeFlags::kCoverage);
}