aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/lua/chars-vs-glyphs.lua
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-12 19:53:49 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-12 19:53:49 +0000
commit312e9a2f4c2fb819904de31adc1ed154417cfd09 (patch)
treec0b6daf0d7f3662a413ec73e8545cfa23e25c564 /tools/lua/chars-vs-glyphs.lua
parente4d11becb5027e8e63d9d5f9d2e84cfbc2772136 (diff)
add script to count glyph -vs- char draw calls
git-svn-id: http://skia.googlecode.com/svn/trunk@9548 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools/lua/chars-vs-glyphs.lua')
-rw-r--r--tools/lua/chars-vs-glyphs.lua35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/lua/chars-vs-glyphs.lua b/tools/lua/chars-vs-glyphs.lua
new file mode 100644
index 0000000000..4098387ec1
--- /dev/null
+++ b/tools/lua/chars-vs-glyphs.lua
@@ -0,0 +1,35 @@
+local canvas
+
+function sk_scrape_startcanvas(c, fileName)
+ canvas = c
+end
+
+function sk_scrape_endcanvas(c, fileName)
+ canvas = nil
+end
+
+local glyph_calls = 0
+local unichar_calls = 0
+
+local isTextVerbs = {
+ drawPosText = true,
+ drawPosTextH = true,
+ drawText = true,
+ drawTextOnPath = true,
+}
+
+function sk_scrape_accumulate(t)
+ if isTextVerbs[t.verb] then
+ if t.glyphs then
+ glyph_calls = glyph_calls + 1
+ else
+ unichar_calls = unichar_calls + 1
+ end
+ end
+end
+
+function sk_scrape_summarize()
+ io.write("glyph calls = ", glyph_calls,
+ ", unichar calls = ", unichar_calls, "\n");
+end
+