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

Unified 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, 6 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 side-by-side diff with in-line comments
Download patch
Index: tools/lua/gradients.lua
diff --git a/tools/lua/gradients.lua b/tools/lua/gradients.lua
index b2d8cf773490ed8bac61bd791088209fd6ad7981..3b6eca7919facfda167dc294e798c8f2257888d7 100644
--- a/tools/lua/gradients.lua
+++ b/tools/lua/gradients.lua
@@ -1,10 +1,9 @@
-
function sk_scrape_startcanvas(c, fileName) end
-
function sk_scrape_endcanvas(c, fileName) end
-count3 = 0
-count3sym = 0
+gradients = {}
+
+i = 1
function sk_scrape_accumulate(t)
local p = t.paint
@@ -13,22 +12,27 @@ function sk_scrape_accumulate(t)
if s then
local g = s:asAGradient()
if g then
- --io.write(g.type, " gradient with ", g.colorCount, " colors\n")
-
- if g.colorCount == 3 then
- count3 = count3 + 1
+ gradients[i] = {}
+ gradients[i].colorCount = g.colorCount
+ gradients[i].type = g.type;
+ gradients[i].tile = g.tile;
+ gradients[i].isEvenlySpaced = g.isEvenlySpaced
+ gradients[i].containsHardStops = g.containsHardStops
- if (g.midPos >= 0.499 and g.midPos <= 0.501) then
- count3sym = count3sym + 1
- end
- end
+ i = i + 1
end
end
end
end
-function sk_scrape_summarize()
- io.write("Number of 3 color gradients: ", count3, "\n");
- io.write("Number of 3 color symmetric gradients: ", count3sym, "\n");
+function sk_scrape_summarize()
+ for k, v in pairs(gradients) do
+ io.write(string.format("%d %s %s %d %d\n",
+ v.colorCount,
+ v.type,
+ v.tile,
+ tonumber(v.isEvenlySpaced and 1 or 0),
+ tonumber(v.containsHardStops and 1 or 0)));
+ end
end
« 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