lua accumulate now receives a table of the draw parameters
git-svn-id: http://skia.googlecode.com/svn/trunk@9158 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/lua/scrape.lua b/tools/lua/scrape.lua
index 1d9cda9..839d3fe 100644
--- a/tools/lua/scrape.lua
+++ b/tools/lua/scrape.lua
@@ -1,15 +1,43 @@
+function tostr(t)
+ local str = ""
+ for k, v in next, t do
+ str = str .. tostring(k) .. " "
+ if type(v) == "table" then
+ str = str .. "{ " .. tostr(v) .. "} "
+ else
+ str = str .. tostring(v) .. " "
+ end
+ end
+ return str
+end
+
canvas = {}
total = 0
-function accumulate(verb)
- total = total + 1
- n = canvas[verb] or 0
- n = n + 1
- canvas[verb] = n
+
+function accumulate(t)
+ local verb = t.verb
+ t.verb = nil
+
+ total = total + 1
+ local n = canvas[verb] or 0
+ n = n + 1
+ canvas[verb] = n
+
+ io.write(verb, " ")
+ io.write(tostr(t), "\n")
end
+
function summarize()
- io.write('total='..total..' ')
- for k, v in next, canvas do
- io.write(k..'='..v..' ')
- end
+ io.write("total ", total, "\n", tostr(canvas), "\n")
end
+--[[
+function drawsomething()
+ local s = skia_newsurface(100, 100)
+ local c = s:getcanvas();
+ c:setColor(1, 0, 0, 1)
+ c:drawRect(10, 10, 50, 50)
+ s:saveImage("image.png")
+end
+--]]
+