diff options
Diffstat (limited to 'src/core/SkPicture.cpp')
-rw-r--r-- | src/core/SkPicture.cpp | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp index c7e36e7ecd..871a62e8f3 100644 --- a/src/core/SkPicture.cpp +++ b/src/core/SkPicture.cpp @@ -239,22 +239,31 @@ 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 kNumSlowPathsTol = 6; + static const int kNumPaintWithPathEffectsUsesTol = 1; + static const int kNumAAConcavePathsTol = 5; - int numSlowPathDashedPaths = fNumPaintWithPathEffectUses; - if (0 == sampleCount) { - // The fast dashing path only works when MSAA is disabled - numSlowPathDashedPaths -= fNumFastPathDashEffects; - } - - int numSlowPaths = fNumAAConcavePaths - - fNumAAHairlineConcavePaths - - fNumAADFEligibleConcavePaths; + int numNonDashedPathEffects = fNumPaintWithPathEffectUses - + fNumFastPathDashEffects; + bool suitableForDash = (0 == fNumPaintWithPathEffectUses) || + (numNonDashedPathEffects < kNumPaintWithPathEffectsUsesTol + && 0 == sampleCount); - bool ret = numSlowPathDashedPaths + numSlowPaths < kNumSlowPathsTol; + bool ret = suitableForDash && + (fNumAAConcavePaths - fNumAAHairlineConcavePaths - fNumAADFEligibleConcavePaths) + < kNumAAConcavePathsTol; if (!ret && reason) { - *reason = "Too many slow paths (either concave or dashed)."; + 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."; } return ret; } |