Add bounds info
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2159853003
Review-Url: https://codereview.chromium.org/2159853003
diff --git a/tools/lua/gradients.lua b/tools/lua/gradients.lua
index 833b8b9..71e8c30 100644
--- a/tools/lua/gradients.lua
+++ b/tools/lua/gradients.lua
@@ -14,7 +14,13 @@
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 @@
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 @@
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 @@
tonumber(v.isEvenlySpaced and 1 or 0),
v.numHardStops,
v.verb,
+ v.boundsWidth,
+ v.boundsHeight,
pos))
end
end
diff --git a/tools/lua/gradients.py b/tools/lua/gradients.py
index 65ced5e..5807817 100755
--- a/tools/lua/gradients.py
+++ b/tools/lua/gradients.py
@@ -19,6 +19,8 @@
EvenlySpaced INTEGER,
HardStopCount INTEGER,
Verb TEXT,
+ BoundsWidth INTEGER,
+ BoundsHeight INTEGER,
Positions TEXT
)''');
c.execute("DELETE FROM gradients");
@@ -29,7 +31,7 @@
gradients.append(line.split());
c.executemany(
- "INSERT INTO gradients VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
+ "INSERT INTO gradients VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
gradients);
conn.commit();