Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: tools/lua/scrape.lua

Issue 15511006: add startcanvas/endcanvas entry-points for the script. rename all "official" entry-points to use "s… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/lua/lua_pictures.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lua/scrape.lua
diff --git a/tools/lua/scrape.lua b/tools/lua/scrape.lua
index cbdbc8d1c5e7cebad1d2596248880791979c9818..e4a38ae92d4596544ec5fc6715db2888c7d3a243 100644
--- a/tools/lua/scrape.lua
+++ b/tools/lua/scrape.lua
@@ -19,14 +19,36 @@ function tostr(t)
return str
end
-total = {}
+local total = {} -- accumulate() stores its data in here
+local canvas -- holds the current canvas (from startcanvas())
-function setcanvas(c)
+--[[
+ startcanvas() is called at the start of each picture file, passing the
+ canvas that we will be drawing into, and the name of the file.
+
+ Following this call, there will be some number of calls to accumulate(t)
+ where t is a table of parameters that were passed to that draw-op.
+
+ t.verb is a string holding the name of the draw-op (e.g. "drawRect")
+
+ when a given picture is done, we call endcanvas(canvas, fileName)
+]]
+function sk_scrape_startcanvas(c, fileName)
canvas = c
end
--- called with the parameters to each canvas.draw call
-function accumulate(t)
+--[[
+ Called when the current canvas is done drawing.
+]]
+function sk_scrape_endcanvas(c, fileName)
+ canvas = nil
+end
+
+--[[
+ Called with the parameters to each canvas.draw call, where canvas is the
+ current canvas as set by startcanvas()
+]]
+function sk_scrape_accumulate(t)
local n = total[t.verb] or 0
total[t.verb] = n + 1
@@ -45,9 +67,11 @@ function accumulate(t)
end
end
--- lua_pictures will call this function after all of the files have been
--- "accumulated"
-function summarize()
- io.write("\n", tostr(total), "\n")
+--[[
+ lua_pictures will call this function after all of the pictures have been
+ "accumulated".
+]]
+function sk_scrape_summarize()
+ io.write("\n{ ", tostr(total), " }\n")
end
« no previous file with comments | « tools/lua/lua_pictures.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698