aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2015-01-26 06:53:05 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-26 06:53:05 -0800
commit87a6a8e18c7d5bbc94f478b44c53dc0e0549f927 (patch)
tree89f318fdb27268fea54a8ac2a3cd94be8cf635cd /src
parent0004e7db42713592fa16a0e6481c95fcf8b398c3 (diff)
Alter gpu veto
This CL unifies the treatment of the dashed and concave paths. Before: TP 28 FP 15 TN 8 FN 3 IND 3 After: TP 28 FP 18 TN 7 FN 2 IND 2 One of the TrueNegatives that became a FalsePositive was the motivation use case (the Chromium busy spinner). Review URL: https://codereview.chromium.org/875913002
Diffstat (limited to 'src')
-rw-r--r--src/core/SkPicture.cpp33
1 files changed, 12 insertions, 21 deletions
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index 871a62e8f3..c7e36e7ecd 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -239,31 +239,22 @@ SkPicture::Analysis::Analysis(const SkRecord& record) {
bool SkPicture::Analysis::suitableForGpuRasterization(const char** reason,
int sampleCount) const {
// TODO: the heuristic used here needs to be refined
- static const int kNumPaintWithPathEffectsUsesTol = 1;
- static const int kNumAAConcavePathsTol = 5;
+ static const int kNumSlowPathsTol = 6;
- int numNonDashedPathEffects = fNumPaintWithPathEffectUses -
- fNumFastPathDashEffects;
- bool suitableForDash = (0 == fNumPaintWithPathEffectUses) ||
- (numNonDashedPathEffects < kNumPaintWithPathEffectsUsesTol
- && 0 == sampleCount);
+ int numSlowPathDashedPaths = fNumPaintWithPathEffectUses;
+ if (0 == sampleCount) {
+ // The fast dashing path only works when MSAA is disabled
+ numSlowPathDashedPaths -= fNumFastPathDashEffects;
+ }
+
+ int numSlowPaths = fNumAAConcavePaths -
+ fNumAAHairlineConcavePaths -
+ fNumAADFEligibleConcavePaths;
- bool ret = suitableForDash &&
- (fNumAAConcavePaths - fNumAAHairlineConcavePaths - fNumAADFEligibleConcavePaths)
- < kNumAAConcavePathsTol;
+ bool ret = numSlowPathDashedPaths + numSlowPaths < kNumSlowPathsTol;
if (!ret && reason) {
- if (!suitableForDash) {
- if (0 != sampleCount) {
- *reason = "Can't use multisample on dash effect.";
- } else {
- *reason = "Too many non dashed path effects.";
- }
- } else if ((fNumAAConcavePaths - fNumAAHairlineConcavePaths - fNumAADFEligibleConcavePaths)
- >= kNumAAConcavePathsTol)
- *reason = "Too many anti-aliased concave paths.";
- else
- *reason = "Unknown reason for GPU unsuitability.";
+ *reason = "Too many slow paths (either concave or dashed).";
}
return ret;
}