aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar fmalita <fmalita@chromium.org>2016-05-25 11:31:04 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-25 11:31:04 -0700
commitb5fc58e1de6c2428f786034262a2ecdc8388d21d (patch)
treea3c81e24d8118339a5ca9590797c12317582d886 /src
parentf34cd632d777e8f8be2ec1f4f3a0c363a7a6214d (diff)
Complex clipPath accounting
Add a clipPath heuristic to SkPathCounter, and extend SkPictureGpuAnalyzer to support external clipPath() op accounting. BUG=skia:5347 R=reed@google.com,mtklein@google.com,senorblanco@chromium.org,bsalomon@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2000423005 Review-Url: https://codereview.chromium.org/2000423005
Diffstat (limited to 'src')
-rw-r--r--src/core/SkPictureAnalyzer.cpp21
-rw-r--r--src/core/SkPictureCommon.h7
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));
}