aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/lua
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-10 21:23:49 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-10 21:23:49 +0000
commit29563879168ed58a8295520fbb4381d0ceff9f2f (patch)
treecb1b226b18fa244d00154b6ce06ddeb9f3ec3cab /tools/lua
parent7b320703d47ff2b242ae74faba5e4b0af3560d71 (diff)
add paint:getEffects to return table of bools of a given effect is present on the paint
git-svn-id: http://skia.googlecode.com/svn/trunk@9978 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools/lua')
-rw-r--r--tools/lua/count_effects.lua50
1 files changed, 50 insertions, 0 deletions
diff --git a/tools/lua/count_effects.lua b/tools/lua/count_effects.lua
new file mode 100644
index 0000000000..5bd489977e
--- /dev/null
+++ b/tools/lua/count_effects.lua
@@ -0,0 +1,50 @@
+function tostr(t)
+ local str = ""
+ for k, v in next, t do
+ if #str > 0 then
+ str = str .. ", "
+ end
+ if type(k) == "number" then
+ str = str .. "[" .. k .. "] = "
+ else
+ str = str .. tostring(k) .. " = "
+ end
+ if type(v) == "table" then
+ str = str .. "{ " .. tostr(v) .. " }"
+ else
+ str = str .. tostring(v)
+ end
+ end
+ return str
+end
+
+function sk_scrape_startcanvas(c, fileName) end
+
+function sk_scrape_endcanvas(c, fileName) end
+
+local effects = {}
+
+function count_fields(t)
+ for k, v in next, t do
+ effects[k] = (effects[k] or 0) + 1
+ end
+end
+
+local total_paints = 0;
+
+function sk_scrape_accumulate(t)
+ -- dump the params in t, specifically showing the verb first, which we
+ -- then nil out so it doesn't appear in tostr()
+ io.write(t.verb, " ")
+ t.verb = nil
+ if (t.paint) then
+ total_paints = total_paints + 1
+ count_fields(t.paint:getEffects())
+ end
+ io.write(tostr(t), "\n")
+end
+
+function sk_scrape_summarize()
+ io.write("total paints ", total_paints, " ", tostr(effects), "\n");
+end
+