Index: tools/lua/paths.lua |
diff --git a/tools/lua/paths.lua b/tools/lua/paths.lua |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9ade7e55148ed2a6c7feb253e8c5be857b0ab956 |
--- /dev/null |
+++ b/tools/lua/paths.lua |
@@ -0,0 +1,64 @@ |
+function sk_scrape_startcanvas(c, fileName) end |
robertphillips
2014/08/15 12:34:18
Comment up here about what this tracks and why ??
krajcevski
2014/08/15 15:13:52
Done.
|
+ |
+function sk_scrape_endcanvas(c, fileName) end |
+ |
+draws = 0 |
+drawPaths = 0 |
+drawPathsAnti = 0 |
+drawPathsConvex = 0 |
+drawPathsConvexAnti = 0 |
+ |
+function string.starts(String,Start) |
+ return string.sub(String,1,string.len(Start))==Start |
+end |
+ |
+function updatePathVars(path, isAntiAlias) |
+ if not path then |
+ return |
+ end |
+ |
+ if path:isEmpty() then |
+ return |
+ end |
+ |
+ if path:isRect() then |
+ return |
+ end |
+ |
+ drawPaths = drawPaths + 1 |
+ if isAntiAlias then |
+ drawPathsAnti = drawPathsAnti + 1 |
+ end |
+ |
+ if path:isConvex() then |
+ drawPathsConvex = drawPathsConvex + 1 |
+ if isAntiAlias then |
+ drawPathsConvexAnti = drawPathsConvexAnti + 1 |
+ end |
+ end |
+end |
+ |
+function sk_scrape_accumulate(t) |
+ if (string.starts(t.verb, "draw")) then |
+ draws = draws + 1 |
+ end |
+ |
robertphillips
2014/08/15 12:34:18
if (string.starts(t.verb, "clip")) then
clips
krajcevski
2014/08/15 15:13:52
Done.
|
+ if t.verb == "clipPath" then |
+ local path = t.path |
+ local antiAlias = t.aa |
+ updatePathVars(path, antiAlias) |
+ end |
+ |
+ if t.verb == "drawPath" then |
+ local paint = t.paint |
+ local path = t.path |
+ updatePathVars(path, paint:isAntiAlias()) |
+ end |
+end |
+ |
+function sk_scrape_summarize() |
+ local swPaths = drawPathsAnti - drawPathsConvexAnti |
+ io.write("\ndraws = draws + ", draws, "\n"); |
+ io.write("\ndrawPaths = drawPaths + ", drawPaths, "\n"); |
+ io.write("\nswPaths = swPaths + ", swPaths, "\n"); |
+end |