aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/lua/scrape.lua
diff options
context:
space:
mode:
authorGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-05-16 04:20:23 +0000
committerGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-05-16 04:20:23 +0000
commit1c5a94f5e01d0851bfeceb7d17ad7d693bdc899e (patch)
treea67bfad78e8a050ed271e18b9da144b24a90e90c /tools/lua/scrape.lua
parent1ef08bb53243fd6186e1344ecbf68bb4889a19ac (diff)
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
Diffstat (limited to 'tools/lua/scrape.lua')
-rw-r--r--tools/lua/scrape.lua46
1 files changed, 37 insertions, 9 deletions
diff --git a/tools/lua/scrape.lua b/tools/lua/scrape.lua
index 1d9cda91fe..839d3fe868 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
+--]]