| Index: tools/lua/filter-counter.lua
|
| diff --git a/tools/lua/scrape.lua b/tools/lua/filter-counter.lua
|
| similarity index 66%
|
| copy from tools/lua/scrape.lua
|
| copy to tools/lua/filter-counter.lua
|
| index 4f4adbf3db5c861e6f6c62384186f54cbf736f76..f678bbd5237126808ed6c3f496dc2492d74233e3 100644
|
| --- a/tools/lua/scrape.lua
|
| +++ b/tools/lua/filter-counter.lua
|
| @@ -18,7 +18,6 @@ function tostr(t)
|
| return str
|
| end
|
|
|
| -local total = {} -- accumulate() stores its data in here
|
| local canvas -- holds the current canvas (from startcanvas())
|
|
|
| --[[
|
| @@ -47,26 +46,27 @@ 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
|
|
|
| - 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")
|
| +local gCF_Count = 0
|
| +local gIF_Count = 0
|
| +local gBOTH_Count = 0
|
| +
|
| +function sk_scrape_accumulate(t)
|
| + if not t.paint then
|
| + return
|
| end
|
|
|
| - if false and t.verb == "drawPath" then
|
| - local pred, r1, r2, d1, d2 = t.path:isNestedFillRects()
|
| -
|
| - if pred then
|
| - print("drawRect_Nested", tostr(r1), tostr(r2), d1, d2)
|
| - else
|
| - print("drawPath", "isEmpty", tostring(t.path:isEmpty()),
|
| - "isRect", tostring(t.path:isRect()), tostr(t.path:getBounds()))
|
| - end
|
| + local colorFilter = t.paint:getColorFilter()
|
| + local imageFilter = t.paint:getImageFilter()
|
| +
|
| + if colorFilter then
|
| + gCF_Count = gCF_Count + 1
|
| + end
|
| + if imageFilter then
|
| + gIF_Count = gIF_Count + 1
|
| + end
|
| + if colorFilter and imageFilter then
|
| + gBOTH_Count = gBOTH_Count + 1
|
| end
|
| end
|
|
|
| @@ -75,6 +75,17 @@ end
|
| "accumulated".
|
| ]]
|
| function sk_scrape_summarize()
|
| - io.write("\n{ ", tostr(total), " }\n")
|
| + io.write("colorfilters ", gCF_Count, ", imagefilters ", gIF_Count, ", both_filters ", gBOTH_Count, "\n")
|
| +
|
| +--[[
|
| + io.write("\n\nFirst glyph spread\n\n")
|
| + for k, v in next, gFirstGlyphs do
|
| + io.write("glyph, ", k, ",count, ", v, "\n")
|
| + end
|
| +]]
|
| +end
|
| +
|
| +function test_summary()
|
| + io.write("just testing test_summary\n")
|
| end
|
|
|
|
|