| OLD | NEW |
| 1 -- just a helper function to dump the parameters, for debugging | 1 -- just a helper function to dump the parameters, for debugging |
| 2 function tostr(t) | 2 function tostr(t) |
| 3 local str = "" | 3 local str = "" |
| 4 for k, v in next, t do | 4 for k, v in next, t do |
| 5 if #str > 0 then | 5 if #str > 0 then |
| 6 str = str .. ", " | 6 str = str .. ", " |
| 7 end | 7 end |
| 8 if type(k) == "number" then | 8 if type(k) == "number" then |
| 9 str = str .. "[" .. k .. "] = " | 9 str = str .. "[" .. k .. "] = " |
| 10 else | 10 else |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 ]] | 50 ]] |
| 51 function sk_scrape_accumulate(t) | 51 function sk_scrape_accumulate(t) |
| 52 local n = total[t.verb] or 0 | 52 local n = total[t.verb] or 0 |
| 53 total[t.verb] = n + 1 | 53 total[t.verb] = n + 1 |
| 54 | 54 |
| 55 if false and t.verb == "drawRect" then | 55 if false and t.verb == "drawRect" then |
| 56 local m = canvas:getTotalMatrix() | 56 local m = canvas:getTotalMatrix() |
| 57 print("... ", tostr(m), "\n") | 57 print("... ", tostr(m), "\n") |
| 58 end | 58 end |
| 59 | 59 |
| 60 if false and t.verb == "drawPath" then |
| 61 local pred, r1, r2, d1, d2 = t.path:isNestedRects() |
| 62 |
| 63 if pred then |
| 64 print("drawRect_Nested", tostr(r1), tostr(r2), d1, d2) |
| 65 else |
| 66 print("drawPath", "isEmpty", tostring(t.path:isEmpty()), |
| 67 "isRect", tostring(t.path:isRect()), tostr(t.path:getBounds(
))) |
| 68 end |
| 69 end |
| 70 |
| 60 -- enable to dump all of the parameters we were sent | 71 -- enable to dump all of the parameters we were sent |
| 61 if false then | 72 if false then |
| 62 -- dump the params in t, specifically showing the verb first, which we | 73 -- dump the params in t, specifically showing the verb first, which we |
| 63 -- then nil out so it doesn't appear in tostr() | 74 -- then nil out so it doesn't appear in tostr() |
| 64 io.write(t.verb, " ") | 75 io.write(t.verb, " ") |
| 65 t.verb = nil | 76 t.verb = nil |
| 66 io.write(tostr(t), "\n") | 77 io.write(tostr(t), "\n") |
| 67 end | 78 end |
| 68 end | 79 end |
| 69 | 80 |
| 70 --[[ | 81 --[[ |
| 71 lua_pictures will call this function after all of the pictures have been | 82 lua_pictures will call this function after all of the pictures have been |
| 72 "accumulated". | 83 "accumulated". |
| 73 ]] | 84 ]] |
| 74 function sk_scrape_summarize() | 85 function sk_scrape_summarize() |
| 75 io.write("\n{ ", tostr(total), " }\n") | 86 io.write("\n{ ", tostr(total), " }\n") |
| 76 end | 87 end |
| 77 | 88 |
| OLD | NEW |