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

Side by Side Diff: tools/lua/bitmap_statistics.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 | « src/utils/SkLua.cpp ('k') | tools/lua/find_rotated_bitmaps.lua » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 function string.startsWith(String,Start) 1 function string.startsWith(String,Start)
2 return string.sub(String,1,string.len(Start))==Start 2 return string.sub(String,1,string.len(Start))==Start
3 end 3 end
4 4
5 function string.endsWith(String,End) 5 function string.endsWith(String,End)
6 return End=='' or string.sub(String,-string.len(End))==End 6 return End=='' or string.sub(String,-string.len(End))==End
7 end 7 end
8 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 9 local canvas = nil
30 local num_perspective_bitmaps = 0 10 local num_perspective_bitmaps = 0
31 local num_affine_bitmaps = 0 11 local num_affine_bitmaps = 0
32 local num_scaled_bitmaps = 0 12 local num_scaled_bitmaps = 0
33 local num_translated_bitmaps = 0 13 local num_translated_bitmaps = 0
34 local num_identity_bitmaps = 0 14 local num_identity_bitmaps = 0
15 local num_scaled_up = 0
16 local num_scaled_down = 0
35 17
36 function sk_scrape_startcanvas(c, fileName) 18 function sk_scrape_startcanvas(c, fileName)
37 canvas = c 19 canvas = c
38 end 20 end
39 21
40 function sk_scrape_endcanvas(c, fileName) 22 function sk_scrape_endcanvas(c, fileName)
41 canvas = nil 23 canvas = nil
42 end 24 end
43 25
44 function sk_scrape_accumulate(t) 26 function sk_scrape_accumulate(t)
45 -- dump the params in t, specifically showing the verb first, which we 27 -- dump the params in t, specifically showing the verb first, which we
46 -- then nil out so it doesn't appear in tostr() 28 -- then nil out so it doesn't appear in tostr()
47 if (string.startsWith(t.verb,"drawBitmap")) then 29 if (string.startsWith(t.verb,"drawBitmap")) then
48 matrix = canvas:getTotalMatrix() 30 matrix = canvas:getTotalMatrix()
49 matrixType = matrix:getType() 31 matrixType = matrix:getType()
50 if matrixType.perspective then 32 if matrixType.perspective then
51 num_perspective_bitmaps = num_perspective_bitmaps + 1 33 num_perspective_bitmaps = num_perspective_bitmaps + 1
52 elseif matrixType.affine then 34 elseif matrixType.affine then
53 num_affine_bitmaps = num_affine_bitmaps + 1 35 num_affine_bitmaps = num_affine_bitmaps + 1
54 elseif matrixType.scale then 36 elseif matrixType.scale then
55 num_scaled_bitmaps = num_scaled_bitmaps + 1 37 num_scaled_bitmaps = num_scaled_bitmaps + 1
38 if matrix:getScaleX() > 1 or matrix:getScaleY() > 1 then
39 num_scaled_up = num_scaled_up + 1
40 else
41 num_scaled_down = num_scaled_down + 1
42 end
56 elseif matrixType.translate then 43 elseif matrixType.translate then
57 num_translated_bitmaps = num_translated_bitmaps + 1 44 num_translated_bitmaps = num_translated_bitmaps + 1
58 else 45 else
59 num_identity_bitmaps = num_identity_bitmaps + 1 46 num_identity_bitmaps = num_identity_bitmaps + 1
60 end 47 end
61 end 48 end
62 end 49 end
63 50
64 function sk_scrape_summarize() 51 function sk_scrape_summarize()
65 io.write( "identity = ", num_identity_bitmaps, 52 io.write( "identity = ", num_identity_bitmaps,
66 ", translated = ", num_translated_bitmaps, 53 ", translated = ", num_translated_bitmaps,
67 ", scaled = ", num_scaled_bitmaps, 54 ", scaled = ", num_scaled_bitmaps, " (up = ", num_scaled_up, "; down = ", num_scaled_down, ")",
68 ", affine = ", num_affine_bitmaps, 55 ", affine = ", num_affine_bitmaps,
69 ", perspective = ", num_perspective_bitmaps, 56 ", perspective = ", num_perspective_bitmaps,
70 "\n") 57 "\n")
71 end 58 end
72 59
OLDNEW
« no previous file with comments | « src/utils/SkLua.cpp ('k') | tools/lua/find_rotated_bitmaps.lua » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698