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

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

Issue 2103973002: Changes to Lua gradient scraping (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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
OLDNEW
1
2 function sk_scrape_startcanvas(c, fileName) end 1 function sk_scrape_startcanvas(c, fileName) end
3
4 function sk_scrape_endcanvas(c, fileName) end 2 function sk_scrape_endcanvas(c, fileName) end
5 3
6 count3 = 0 4 gradients = {}
7 count3sym = 0 5
6 i = 1
8 7
9 function sk_scrape_accumulate(t) 8 function sk_scrape_accumulate(t)
10 local p = t.paint 9 local p = t.paint
11 if p then 10 if p then
12 local s = p:getShader() 11 local s = p:getShader()
13 if s then 12 if s then
14 local g = s:asAGradient() 13 local g = s:asAGradient()
15 if g then 14 if g then
16 --io.write(g.type, " gradient with ", g.colorCount, " colors\n") 15 gradients[i] = {}
17 16 gradients[i].colorCount = g.colorCount
18 if g.colorCount == 3 then 17 gradients[i].type = g.type;
19 count3 = count3 + 1 18 gradients[i].tile = g.tile;
19 gradients[i].isEvenlySpaced = g.isEvenlySpaced
20 gradients[i].containsHardStops = g.containsHardStops
20 21
21 if (g.midPos >= 0.499 and g.midPos <= 0.501) then 22 i = i + 1
22 count3sym = count3sym + 1
23 end
24 end
25 end 23 end
26 end 24 end
27 end 25 end
28 end 26 end
29 27
30 function sk_scrape_summarize() 28 function sk_scrape_summarize()
31 io.write("Number of 3 color gradients: ", count3, "\n"); 29 for k, v in pairs(gradients) do
32 io.write("Number of 3 color symmetric gradients: ", count3sym, "\n"); 30 io.write(string.format("%d %s %s %d %d\n",
31 v.colorCount,
32 v.type,
33 v.tile,
34 tonumber(v.isEvenlySpaced and 1 or 0),
35 tonumber(v.containsHardStops and 1 or 0)));
36 end
33 end 37 end
34 38
OLDNEW
« src/utils/SkLua.cpp ('K') | « src/utils/SkLua.cpp ('k') | tools/lua/gradients.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698