diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkPictureAnalyzer.cpp | 21 | ||||
-rw-r--r-- | src/core/SkPictureCommon.h | 7 |
2 files changed, 27 insertions, 1 deletions
diff --git a/src/core/SkPictureAnalyzer.cpp b/src/core/SkPictureAnalyzer.cpp index 0ba420258b..49c4fce779 100644 --- a/src/core/SkPictureAnalyzer.cpp +++ b/src/core/SkPictureAnalyzer.cpp @@ -5,8 +5,11 @@ * found in the LICENSE file. */ +#include "SkPath.h" #include "SkPicture.h" #include "SkPictureAnalyzer.h" +#include "SkPictureCommon.h" +#include "SkRecords.h" #if SK_SUPPORT_GPU @@ -27,7 +30,7 @@ SkPictureGpuAnalyzer::SkPictureGpuAnalyzer(const sk_sp<SkPicture>& picture, this->analyze(picture.get()); } -void SkPictureGpuAnalyzer::analyze(const SkPicture* picture) { +void SkPictureGpuAnalyzer::analyzePicture(const SkPicture* picture) { if (!picture || veto_predicate(fNumSlowPaths)) { return; } @@ -35,6 +38,22 @@ void SkPictureGpuAnalyzer::analyze(const SkPicture* picture) { fNumSlowPaths += picture->numSlowPaths(); } +void SkPictureGpuAnalyzer::analyzeClipPath(const SkPath& path, SkRegion::Op op, bool doAntiAlias) { + if (veto_predicate(fNumSlowPaths)) { + return; + } + + const SkRecords::ClipPath clipOp = { + SkIRect::MakeEmpty(), // Willie don't care. + path, + SkRecords::RegionOpAndAA(op, doAntiAlias) + }; + + SkPathCounter counter; + counter(clipOp); + fNumSlowPaths += counter.fNumSlowPathsAndDashEffects; +} + void SkPictureGpuAnalyzer::reset() { fNumSlowPaths = 0; } diff --git a/src/core/SkPictureCommon.h b/src/core/SkPictureCommon.h index 16146be020..1c38b049fa 100644 --- a/src/core/SkPictureCommon.h +++ b/src/core/SkPictureCommon.h @@ -123,6 +123,13 @@ struct SkPathCounter { } } + void operator()(const SkRecords::ClipPath& op) { + // TODO: does the SkRegion op matter? + if (op.opAA.aa && !op.path.isConvex()) { + fNumSlowPathsAndDashEffects++; + } + } + void operator()(const SkRecords::SaveLayer& op) { this->checkPaint(AsPtr(op.paint)); } |