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

Side by Side Diff: src/core/SkRecordOpts.cpp

Issue 340403003: SaveFlags be-gone (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: One more baseurl attempt Created 6 years, 5 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 unified diff | Download patch
« no previous file with comments | « src/core/SkRecordDraw.cpp ('k') | src/core/SkRecorder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkRecordOpts.h" 8 #include "SkRecordOpts.h"
9 9
10 #include "SkRecordPattern.h" 10 #include "SkRecordPattern.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 struct SaveNoDrawsRestoreNooper { 77 struct SaveNoDrawsRestoreNooper {
78 // Star matches greedily, so we also have to exclude Save and Restore. 78 // Star matches greedily, so we also have to exclude Save and Restore.
79 typedef Pattern3<Is<Save>, 79 typedef Pattern3<Is<Save>,
80 Star<Not<Or3<Is<Save>, 80 Star<Not<Or3<Is<Save>,
81 Is<Restore>, 81 Is<Restore>,
82 IsDraw> > >, 82 IsDraw> > >,
83 Is<Restore> > 83 Is<Restore> >
84 Pattern; 84 Pattern;
85 85
86 bool onMatch(SkRecord* record, Pattern* pattern, unsigned begin, unsigned en d) { 86 bool onMatch(SkRecord* record, Pattern* pattern, unsigned begin, unsigned en d) {
87 // If restore doesn't revert both matrix and clip, this isn't safe to no op away.
88 if (pattern->first<Save>()->flags != SkCanvas::kMatrixClip_SaveFlag) {
89 return false;
90 }
91
92 // The entire span between Save and Restore (inclusively) does nothing. 87 // The entire span between Save and Restore (inclusively) does nothing.
93 for (unsigned i = begin; i < end; i++) { 88 for (unsigned i = begin; i < end; i++) {
94 record->replace<NoOp>(i); 89 record->replace<NoOp>(i);
95 } 90 }
96 return true; 91 return true;
97 } 92 }
98 }; 93 };
99 void SkRecordNoopSaveRestores(SkRecord* record) { 94 void SkRecordNoopSaveRestores(SkRecord* record) {
100 SaveOnlyDrawsRestoreNooper onlyDraws; 95 SaveOnlyDrawsRestoreNooper onlyDraws;
101 SaveNoDrawsRestoreNooper noDraws; 96 SaveNoDrawsRestoreNooper noDraws;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 }; 289 };
295 290
296 SkTDArray<Pair> fPushStack; 291 SkTDArray<Pair> fPushStack;
297 SkRecord* fRecord; 292 SkRecord* fRecord;
298 unsigned fIndex; 293 unsigned fIndex;
299 }; 294 };
300 void SkRecordAnnotateCullingPairs(SkRecord* record) { 295 void SkRecordAnnotateCullingPairs(SkRecord* record) {
301 CullAnnotator pass; 296 CullAnnotator pass;
302 pass.apply(record); 297 pass.apply(record);
303 } 298 }
OLDNEW
« no previous file with comments | « src/core/SkRecordDraw.cpp ('k') | src/core/SkRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698