aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
diff options
context:
space:
mode:
authorGravatar Yuqian Li <liyuqian@google.com>2017-01-11 10:58:31 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-12 17:17:32 +0000
commit89a0e72287e991cfa2f860f92fad545ca59defe1 (patch)
treeda5c494a32700a7438357bca4a50a1ac49237224 /samplecode
parent108f55ed5d0b63baf653e4e443cc469df887c811 (diff)
Implement Analytic AA for General Paths (with Guard against Chrome)
I've set up a SK_SUPPORT_LEGACY_AAA flag to guard against Chromium layout tests. I also set that flag in this CL so theoretically this CL won't trigger any GM changes. I'll use this to verify my guard, and remove that flag and actually enables concave AAA in a future CL. When enabled, for most simple concave paths (e.g., rectangle stroke, rrect stroke, sawtooth, stars...), the Analytic AA achieves 1.3x-2x speedup, and they look much prettier. And they probably are the majority in our use cases by number. But they probably are not the majority by time cost; a single complicated path may cost 10x-100x more time to render than a rectangle stroke... For those complicated paths, we fall back to supersampling by default as we're likely to be 1.1-1.2x slower and the quality improvement is not visually significant. However, one can use gSkForceAnalyticAA to disable that fallback. BUG=skia: Change-Id: If9549a3acc4a187cfaf7eb51890c148da3083d31 Reviewed-on: https://skia-review.googlesource.com/6091 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
Diffstat (limited to 'samplecode')
-rw-r--r--samplecode/SampleApp.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 8797c4d5ca..a1dabc2f65 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -1822,7 +1822,12 @@ bool SampleWindow::onHandleChar(SkUnichar uni) {
}
break;
case 'A':
- gSkUseAnalyticAA = !gSkUseAnalyticAA.load();
+ if (gSkUseAnalyticAA.load() && !gSkForceAnalyticAA.load()) {
+ gSkForceAnalyticAA = true;
+ } else {
+ gSkUseAnalyticAA = !gSkUseAnalyticAA.load();
+ gSkForceAnalyticAA = false;
+ }
this->inval(nullptr);
this->updateTitle();
break;
@@ -2176,7 +2181,11 @@ void SampleWindow::updateTitle() {
title.prepend(gDeviceTypePrefix[fDeviceType]);
if (gSkUseAnalyticAA) {
- title.prepend("<AAA> ");
+ if (gSkForceAnalyticAA) {
+ title.prepend("<FAAA> ");
+ } else {
+ title.prepend("<AAA> ");
+ }
}
if (fTilingMode != kNo_Tiling) {
title.prependf("<T: %s> ", gTilingInfo[fTilingMode].label);