aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-05-22 15:13:18 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-05-22 15:13:18 +0000
commit74ce6f046c8c8990172cebcfa830c8e5f5e42a1e (patch)
tree9b15c01abc9506c2e135b9eecc74df01bdb1653c /tools
parentbf711cf55228730c6c16193ec234457bb4e9fe01 (diff)
add dumpops.lua as a sample scraper that just dumps the arguments
add SkLua.h for common utilities BUG= R=rmistry@google.com Review URL: https://codereview.chromium.org/15737010 git-svn-id: http://skia.googlecode.com/svn/trunk@9242 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools')
-rw-r--r--tools/lua/dumpops.lua34
-rw-r--r--tools/lua/scrape.lua18
-rw-r--r--tools/lua/skia.lua3
3 files changed, 41 insertions, 14 deletions
diff --git a/tools/lua/dumpops.lua b/tools/lua/dumpops.lua
new file mode 100644
index 0000000000..1667e579fa
--- /dev/null
+++ b/tools/lua/dumpops.lua
@@ -0,0 +1,34 @@
+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
+
+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
+ io.write(tostr(t), "\n")
+end
+
+function sk_scrape_summarize() end
+
diff --git a/tools/lua/scrape.lua b/tools/lua/scrape.lua
index 92636121da..627018800a 100644
--- a/tools/lua/scrape.lua
+++ b/tools/lua/scrape.lua
@@ -1,4 +1,3 @@
--- just a helper function to dump the parameters, for debugging
function tostr(t)
local str = ""
for k, v in next, t do
@@ -52,9 +51,11 @@ function sk_scrape_accumulate(t)
local n = total[t.verb] or 0
total[t.verb] = n + 1
- if false and t.verb == "drawRect" then
- local m = canvas:getTotalMatrix()
- print("... ", tostr(m), "\n")
+ if false and t.verb == "drawRect" and t.paint:isAntiAlias() then
+ local r = t.rect;
+ local p = t.paint;
+ local c = p:getColor();
+ print("drawRect ", tostr(r), tostr(c), "\n")
end
if false and t.verb == "drawPath" then
@@ -67,15 +68,6 @@ function sk_scrape_accumulate(t)
"isRect", tostring(t.path:isRect()), tostr(t.path:getBounds()))
end
end
-
- -- enable to dump all of the parameters we were sent
- if false then
- -- 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
- io.write(tostr(t), "\n")
- end
end
--[[
diff --git a/tools/lua/skia.lua b/tools/lua/skia.lua
index 88c3223299..fe738d1880 100644
--- a/tools/lua/skia.lua
+++ b/tools/lua/skia.lua
@@ -1,3 +1,5 @@
+-- Experimental helpers for skia --
+
Sk = {}
function Sk.isFinite(x)
@@ -78,4 +80,3 @@ function Sk.Rect:inset(dx, dy)
end
-------------------------------------------------------------------------------
-