support SkCanvas as a real lua object
git-svn-id: http://skia.googlecode.com/svn/trunk@9208 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/lua/scrape.lua b/tools/lua/scrape.lua
index de0be08..739a2f7 100644
--- a/tools/lua/scrape.lua
+++ b/tools/lua/scrape.lua
@@ -19,14 +19,21 @@
return str
end
-canvas = {}
-total = 0
+total = {}
+
+function setcanvas(c)
+ canvas = c
+end
-- called with the parameters to each canvas.draw call
function accumulate(t)
- total = total + 1
- local n = canvas[t.verb] or 0
- canvas[t.verb] = n + 1
+ local n = total[t.verb] or 0
+ total[t.verb] = n + 1
+
+ if t.verb == "drawRect" then
+ local m = canvas:getTotalMatrix()
+ print("... ", tostr(m), "\n")
+ end
-- enable to dump all of the parameters we were sent
if false then
@@ -41,6 +48,6 @@
-- lua_pictures will call this function after all of the files have been
-- "accumulated"
function summarize()
- io.write("total ", total, "\n", tostr(canvas), "\n")
+ io.write("\n", tostr(total), "\n")
end