blob: 839d3fe868d59eb5b945abea25f69fd8ff6627fa [file] [log] [blame]
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +00001function tostr(t)
2 local str = ""
3 for k, v in next, t do
4 str = str .. tostring(k) .. " "
5 if type(v) == "table" then
6 str = str .. "{ " .. tostr(v) .. "} "
7 else
8 str = str .. tostring(v) .. " "
9 end
10 end
11 return str
12end
13
reed@google.comdff7e112013-05-15 19:34:20 +000014canvas = {}
15total = 0
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +000016
17function accumulate(t)
18 local verb = t.verb
19 t.verb = nil
20
21 total = total + 1
22 local n = canvas[verb] or 0
23 n = n + 1
24 canvas[verb] = n
25
26 io.write(verb, " ")
27 io.write(tostr(t), "\n")
reed@google.comdff7e112013-05-15 19:34:20 +000028end
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +000029
reed@google.comdff7e112013-05-15 19:34:20 +000030function summarize()
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +000031 io.write("total ", total, "\n", tostr(canvas), "\n")
reed@google.comdff7e112013-05-15 19:34:20 +000032end
33
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +000034--[[
35function drawsomething()
36 local s = skia_newsurface(100, 100)
37 local c = s:getcanvas();
38 c:setColor(1, 0, 0, 1)
39 c:drawRect(10, 10, 50, 50)
40 s:saveImage("image.png")
41end
42--]]
43