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

Unified Diff: tools/lua/gradients.lua

Issue 2159853003: Add bounds info (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unnecessary verbs table 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/lua/gradients.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lua/gradients.lua
diff --git a/tools/lua/gradients.lua b/tools/lua/gradients.lua
index 833b8b9ca13f6a9f5d02aa0227a365a9569661ac..71e8c30d176f1c28e0a4d01c903baa968afe27fe 100644
--- a/tools/lua/gradients.lua
+++ b/tools/lua/gradients.lua
@@ -14,7 +14,13 @@ function LuaDoubleNearlyEqual(a, b)
return math.abs(a-b) <= LuaDoubleNearlyZero
end
-verbs = {}
+function bounds(rect)
+ local width = rect.right - rect.left
+ local height = rect.bottom - rect.top
+
+ return width, height
+end
+
gradients = {}
i = 1
@@ -26,16 +32,21 @@ function sk_scrape_accumulate(t)
if s then
local g = s:asAGradient()
if g then
- if verbs[t.verb] then
- verbs[t.verb] = verbs[t.verb] + 1
- else
- verbs[t.verb] = 1
- end
-
gradients[i] = {}
gradients[i].filename = filename
+ local width, height = -1, -1
+ if t.rect then
+ width, height = bounds(t.rect)
+ elseif t.rrect then
+ width, height = bounds(t.rrect:rect())
+ elseif t.path then
+ width, height = bounds(t.path:getBounds())
+ end
+ gradients[i].boundsWidth = width
+ gradients[i].boundsHeight = height
+
gradients[i].colorCount = g.colorCount
gradients[i].type = g.type
gradients[i].tile = g.tile
@@ -79,7 +90,7 @@ function sk_scrape_summarize()
end
end
- io.write(string.format("%s %d %s %s %d %d %s %s\n",
+ io.write(string.format("%s %d %s %s %d %d %s %d %d %s\n",
v.filename,
v.colorCount,
v.type,
@@ -87,6 +98,8 @@ function sk_scrape_summarize()
tonumber(v.isEvenlySpaced and 1 or 0),
v.numHardStops,
v.verb,
+ v.boundsWidth,
+ v.boundsHeight,
pos))
end
end
« no previous file with comments | « no previous file | tools/lua/gradients.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698