OLD | NEW |
---|---|
(Empty) | |
1 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.
| |
2 | |
3 function sk_scrape_endcanvas(c, fileName) end | |
4 | |
5 draws = 0 | |
6 drawPaths = 0 | |
7 drawPathsAnti = 0 | |
8 drawPathsConvex = 0 | |
9 drawPathsConvexAnti = 0 | |
10 | |
11 function string.starts(String,Start) | |
12 return string.sub(String,1,string.len(Start))==Start | |
13 end | |
14 | |
15 function updatePathVars(path, isAntiAlias) | |
16 if not path then | |
17 return | |
18 end | |
19 | |
20 if path:isEmpty() then | |
21 return | |
22 end | |
23 | |
24 if path:isRect() then | |
25 return | |
26 end | |
27 | |
28 drawPaths = drawPaths + 1 | |
29 if isAntiAlias then | |
30 drawPathsAnti = drawPathsAnti + 1 | |
31 end | |
32 | |
33 if path:isConvex() then | |
34 drawPathsConvex = drawPathsConvex + 1 | |
35 if isAntiAlias then | |
36 drawPathsConvexAnti = drawPathsConvexAnti + 1 | |
37 end | |
38 end | |
39 end | |
40 | |
41 function sk_scrape_accumulate(t) | |
42 if (string.starts(t.verb, "draw")) then | |
43 draws = draws + 1 | |
44 end | |
45 | |
robertphillips
2014/08/15 12:34:18
if (string.starts(t.verb, "clip")) then
clips
krajcevski
2014/08/15 15:13:52
Done.
| |
46 if t.verb == "clipPath" then | |
47 local path = t.path | |
48 local antiAlias = t.aa | |
49 updatePathVars(path, antiAlias) | |
50 end | |
51 | |
52 if t.verb == "drawPath" then | |
53 local paint = t.paint | |
54 local path = t.path | |
55 updatePathVars(path, paint:isAntiAlias()) | |
56 end | |
57 end | |
58 | |
59 function sk_scrape_summarize() | |
60 local swPaths = drawPathsAnti - drawPathsConvexAnti | |
61 io.write("\ndraws = draws + ", draws, "\n"); | |
62 io.write("\ndrawPaths = drawPaths + ", drawPaths, "\n"); | |
63 io.write("\nswPaths = swPaths + ", swPaths, "\n"); | |
64 end | |
OLD | NEW |