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

Side by Side Diff: tools/lua/find_rotated_bitmaps.lua

Issue 19091006: add more stats to the bitmap matrix locator (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/lua/bitmap_statistics.lua ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 function string.startsWith(String,Start)
2 return string.sub(String,1,string.len(Start))==Start
3 end
4
5 function string.endsWith(String,End)
6 return End=='' or string.sub(String,-string.len(End))==End
7 end
8
9 function tostr(t)
10 local str = ""
11 for k, v in next, t do
12 if #str > 0 then
13 str = str .. ", "
14 end
15 if type(k) == "number" then
16 str = str .. "[" .. k .. "] = "
17 else
18 str = str .. tostring(k) .. " = "
19 end
20 if type(v) == "table" then
21 str = str .. "{ " .. tostr(v) .. " }"
22 else
23 str = str .. tostring(v)
24 end
25 end
26 return str
27 end
28
29 local canvas = nil
30 local num_perspective_bitmaps = 0
31 local num_affine_bitmaps = 0
32 local num_scaled_bitmaps = 0
33 local num_translated_bitmaps = 0
34 local num_identity_bitmaps = 0
35
36 function sk_scrape_startcanvas(c, fileName)
37 canvas = c
38 end
39
40 function sk_scrape_endcanvas(c, fileName)
41 canvas = nil
42 end
43
44 function sk_scrape_accumulate(t)
45 -- dump the params in t, specifically showing the verb first, which we
46 -- then nil out so it doesn't appear in tostr()
47 if (string.startsWith(t.verb,"drawBitmap")) then
48 matrix = canvas:getTotalMatrix()
49 matrixType = matrix:getType()
50 if matrixType.perspective then
51 num_perspective_bitmaps = num_perspective_bitmaps + 1
52 elseif matrixType.affine then
53 num_affine_bitmaps = num_affine_bitmaps + 1
54 elseif matrixType.scale then
55 num_scaled_bitmaps = num_scaled_bitmaps + 1
56 elseif matrixType.translate then
57 num_translated_bitmaps = num_translated_bitmaps + 1
58 else
59 num_identity_bitmaps = num_identity_bitmaps + 1
60 end
61 end
62 end
63
64 function sk_scrape_summarize()
65 io.write( "identity = ", num_identity_bitmaps,
66 ", translated = ", num_translated_bitmaps,
67 ", scaled = ", num_scaled_bitmaps,
68 ", affine = ", num_affine_bitmaps,
69 ", perspective = ", num_perspective_bitmaps,
70 "\n")
71 end
72
OLDNEW
« no previous file with comments | « tools/lua/bitmap_statistics.lua ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698