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

Unified Diff: tools/filtermain.cpp

Issue 13261018: Add looping over optimizations to filter tool (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Fixed loop exit condition Created 7 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/filtermain.cpp
===================================================================
--- tools/filtermain.cpp (revision 8462)
+++ tools/filtermain.cpp (working copy)
@@ -536,12 +536,26 @@
debugCanvas.deleteDrawCommandAt(debugCanvas.getSize()-1);
}
- for (int i = 0; i < debugCanvas.getSize(); ++i) {
- for (size_t opt = 0; opt < SK_ARRAY_COUNT(gOptTable); ++opt) {
- if ((*gOptTable[opt].fCheck)(&debugCanvas, i)) {
- (*gOptTable[opt].fApply)(&debugCanvas, i);
- ++gOptTable[opt].fNumTimesApplied;
- ++localCount[opt];
+ bool changed = true;
+
+ while (changed) {
+ changed = false;
+ for (int i = 0; i < debugCanvas.getSize(); ++i) {
+ for (size_t opt = 0; opt < SK_ARRAY_COUNT(gOptTable); ++opt) {
+ if ((*gOptTable[opt].fCheck)(&debugCanvas, i)) {
+ (*gOptTable[opt].fApply)(&debugCanvas, i);
+
+ ++gOptTable[opt].fNumTimesApplied;
+ ++localCount[opt];
+
+ if (debugCanvas.getSize() == i) {
+ // the optimization removed all the remaining operations
+ break;
+ }
+
+ opt = 0; // try all the opts all over again
+ changed = true;
+ }
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698