Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1263)

Unified Diff: src/record/SkRecordOpts.cpp

Issue 277613002: Noop away PushCull/PopCull pairs with nothing between them. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/record/SkRecordOpts.h ('k') | tests/RecordOptsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/record/SkRecordOpts.cpp
diff --git a/src/record/SkRecordOpts.cpp b/src/record/SkRecordOpts.cpp
index bfc45bda5a4c425e097b01ba61c4eaa6bc4d6d17..1322c0f1e57eb295f2981f3e8d785cb2e7ce766f 100644
--- a/src/record/SkRecordOpts.cpp
+++ b/src/record/SkRecordOpts.cpp
@@ -15,8 +15,10 @@ using namespace SkRecords;
void SkRecordOptimize(SkRecord* record) {
// TODO(mtklein): fuse independent optimizations to reduce number of passes?
+ SkRecordNoopCulls(record);
SkRecordNoopSaveRestores(record);
SkRecordNoopSaveLayerDrawRestores(record);
+
SkRecordAnnotateCullingPairs(record);
SkRecordReduceDrawPosTextStrength(record); // Helpful to run this before BoundDrawPosTextH.
SkRecordBoundDrawPosTextH(record);
@@ -42,6 +44,21 @@ static bool apply(Pass* pass, SkRecord* record) {
return changed;
}
+struct CullNooper {
+ typedef Pattern3<Is<PushCull>, Star<Is<NoOp> >, Is<PopCull> > Pattern;
+
+ bool onMatch(SkRecord* record, Pattern* pattern, unsigned begin, unsigned end) {
+ record->replace<NoOp>(begin); // PushCull
+ record->replace<NoOp>(end-1); // PopCull
+ return true;
+ }
+};
+
+void SkRecordNoopCulls(SkRecord* record) {
+ CullNooper pass;
+ while (apply(&pass, record));
+}
+
// Turns the logical NoOp Save and Restore in Save-Draw*-Restore patterns into actual NoOps.
struct SaveOnlyDrawsRestoreNooper {
typedef Pattern3<Is<Save>,
« no previous file with comments | « src/record/SkRecordOpts.h ('k') | tests/RecordOptsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698