Add verb field in scraping scripts

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2150663002

Review-Url: https://codereview.chromium.org/2150663002
This commit is contained in:
fmenozzi 2016-07-14 07:44:50 -07:00 committed by Commit bot
parent 201364cb02
commit 016e51fb06
2 changed files with 14 additions and 3 deletions

View File

@ -7,6 +7,7 @@ function LuaDoubleNearlyEqual(a, b)
return math.abs(a-b) <= LuaDoubleNearlyZero
end
verbs = {}
gradients = {}
i = 1
@ -18,6 +19,12 @@ 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].colorCount = g.colorCount
@ -38,8 +45,10 @@ function sk_scrape_accumulate(t)
numHardStops = numHardStops + 1
end
end
gradients[i].numHardStops = numHardStops;
gradients[i].numHardStops = numHardStops
gradients[i].verb = t.verb
gradients[i].positions = {}
for j = 1, g.colorCount, 1 do
gradients[i].positions[j] = g.positions[j]
@ -61,12 +70,13 @@ function sk_scrape_summarize()
end
end
io.write(string.format("%d %s %s %d %d %s\n",
io.write(string.format("%d %s %s %d %d %s %s\n",
v.colorCount,
v.type,
v.tile,
tonumber(v.isEvenlySpaced and 1 or 0),
v.numHardStops,
v.verb,
pos))
end
end

View File

@ -17,6 +17,7 @@ def create_database(inpath, outpath):
TileMode TEXT,
EvenlySpaced INTEGER,
HardStopCount INTEGER,
Verb TEXT,
Positions TEXT
)''');
c.execute("DELETE FROM gradients");
@ -26,7 +27,7 @@ def create_database(inpath, outpath):
for line in [line.strip() for line in results]:
gradients.append(line.split());
c.executemany("INSERT INTO gradients VALUES (?, ?, ?, ?, ?, ?)",
c.executemany("INSERT INTO gradients VALUES (?, ?, ?, ?, ?, ?, ?)",
gradients);
conn.commit();