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

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: Count number of hard stops 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
« no previous file with comments | « src/utils/SkLua.cpp ('k') | tools/lua/gradients.py » ('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 sk_scrape_startcanvas(c, fileName) end 1 function sk_scrape_startcanvas(c, fileName) end
2 function sk_scrape_endcanvas(c, fileName) end 2 function sk_scrape_endcanvas(c, fileName) end
3 3
4 gradients = {} 4 gradients = {}
5 5
6 i = 1 6 i = 1
7 7
8 function sk_scrape_accumulate(t) 8 function sk_scrape_accumulate(t)
9 local p = t.paint 9 local p = t.paint
10 if p then 10 if p then
11 local s = p:getShader() 11 local s = p:getShader()
12 if s then 12 if s then
13 local g = s:asAGradient() 13 local g = s:asAGradient()
14 if g then 14 if g then
15 gradients[i] = {} 15 gradients[i] = {}
16 gradients[i].colorCount = g.colorCount 16 gradients[i].colorCount = g.colorCount
17 gradients[i].type = g.type 17 gradients[i].type = g.type
18 gradients[i].tile = g.tile 18 gradients[i].tile = g.tile
19 gradients[i].isEvenlySpaced = g.isEvenlySpaced 19 gradients[i].isEvenlySpaced = g.isEvenlySpaced
20 gradients[i].containsHardStops = g.containsHardStops 20 gradients[i].numHardStops = g.numHardStops
21 21
22 gradients[i].positions = {} 22 gradients[i].positions = {}
23 for j = 1, g.colorCount, 1 do 23 for j = 1, g.colorCount, 1 do
24 gradients[i].positions[j] = g.positions[j] 24 gradients[i].positions[j] = g.positions[j]
25 end 25 end
26 26
27 i = i + 1 27 i = i + 1
28 end 28 end
29 end 29 end
30 end 30 end
31 end 31 end
32 32
33 function sk_scrape_summarize() 33 function sk_scrape_summarize()
34 for k, v in pairs(gradients) do 34 for k, v in pairs(gradients) do
35 local pos = "" 35 local pos = ""
36 for j = 1, v.colorCount , 1 do 36 for j = 1, v.colorCount , 1 do
37 pos = pos .. v.positions[j] 37 pos = pos .. v.positions[j]
38 if j ~= v.colorCount then 38 if j ~= v.colorCount then
39 pos = pos .. "," 39 pos = pos .. ","
40 end 40 end
41 end 41 end
42 42
43 io.write(string.format("%d %s %s %d %d %s\n", 43 io.write(string.format("%d %s %s %d %d %s\n",
44 v.colorCount, 44 v.colorCount,
45 v.type, 45 v.type,
46 v.tile, 46 v.tile,
47 tonumber(v.isEvenlySpaced and 1 or 0), 47 tonumber(v.isEvenlySpaced and 1 or 0),
48 tonumber(v.containsHardStops and 1 or 0), 48 v.numHardStops,
49 pos)) 49 pos))
50 end 50 end
51 end 51 end
52 52
OLDNEW
« no previous file with comments | « src/utils/SkLua.cpp ('k') | tools/lua/gradients.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698