SkQP: model-creation improvements
- cut_release/find_commit: use cookies, handle errors. - tools/skqp/make_skqp_model.cpp: better error handling Change-Id: I702e9a13d3a2123c30e3a870fcb942759cfc47c3 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257682 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
This commit is contained in:
parent
f78aa16af1
commit
a06f9d0787
@ -19,6 +19,10 @@ assert '/' in [os.sep, os.altsep] and os.pardir == '..'
|
|||||||
ASSETS = 'platform_tools/android/apps/skqp/src/main/assets'
|
ASSETS = 'platform_tools/android/apps/skqp/src/main/assets'
|
||||||
BUCKET = 'skia-skqp-assets'
|
BUCKET = 'skia-skqp-assets'
|
||||||
|
|
||||||
|
def urlopen(url):
|
||||||
|
cookie = os.environ.get('SKIA_GOLD_COOKIE', '')
|
||||||
|
return urllib2.urlopen(urllib2.Request(url, headers={'Cookie': cookie}))
|
||||||
|
|
||||||
def make_skqp_model(arg):
|
def make_skqp_model(arg):
|
||||||
name, urls, exe = arg
|
name, urls, exe = arg
|
||||||
tmp = tempfile.mkdtemp()
|
tmp = tempfile.mkdtemp()
|
||||||
@ -46,7 +50,7 @@ def goldgetter(meta, exe):
|
|||||||
def gold(first_commit, last_commit):
|
def gold(first_commit, last_commit):
|
||||||
c1, c2 = (check_output(['git', 'rev-parse', c]).strip()
|
c1, c2 = (check_output(['git', 'rev-parse', c]).strip()
|
||||||
for c in (first_commit, last_commit))
|
for c in (first_commit, last_commit))
|
||||||
f = urllib2.urlopen('https://public-gold.skia.org/json/export?' + urllib.urlencode([
|
f = urlopen('https://public-gold.skia.org/json/export?' + urllib.urlencode([
|
||||||
('fbegin', c1),
|
('fbegin', c1),
|
||||||
('fend', c2),
|
('fend', c2),
|
||||||
('query', 'config=gles&config=vk&source_type=gm'),
|
('query', 'config=gles&config=vk&source_type=gm'),
|
||||||
|
@ -54,13 +54,22 @@ def gold_export_url(job, config, first_commit, last_commit):
|
|||||||
return 'https://public-gold.skia.org/json/export?' + urllib.urlencode(query)
|
return 'https://public-gold.skia.org/json/export?' + urllib.urlencode(query)
|
||||||
|
|
||||||
|
|
||||||
|
def urlopen(url):
|
||||||
|
cookie = os.environ.get('SKIA_GOLD_COOKIE', '')
|
||||||
|
return urllib2.urlopen(urllib2.Request(url, headers={'Cookie': cookie}))
|
||||||
|
|
||||||
|
|
||||||
def get_results_for_commit(commit, jobs):
|
def get_results_for_commit(commit, jobs):
|
||||||
sys.stderr.write('%s\n' % commit)
|
sys.stderr.write('%s\n' % commit)
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
CONFIGS = ['gles', 'vk']
|
CONFIGS = ['gles', 'vk']
|
||||||
passing_tests_for_all_jobs = []
|
passing_tests_for_all_jobs = []
|
||||||
def process(url):
|
def process(url):
|
||||||
testResults = json.load(urllib2.urlopen(url))
|
try:
|
||||||
|
testResults = json.load(urlopen(url))
|
||||||
|
except urllib2.URLError:
|
||||||
|
sys.stderr.write('\nerror "%s":\n' % url)
|
||||||
|
return
|
||||||
sys.stderr.write('.')
|
sys.stderr.write('.')
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
passing_tests = 0
|
passing_tests = 0
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "include/encode/SkPngEncoder.h"
|
#include "include/encode/SkPngEncoder.h"
|
||||||
#include "src/core/SkOSFile.h"
|
#include "src/core/SkOSFile.h"
|
||||||
|
|
||||||
static void update(SkBitmap* maxBitmap, SkBitmap* minBitmap, const SkBitmap& bm) {
|
static bool update(SkBitmap* maxBitmap, SkBitmap* minBitmap, const SkBitmap& bm) {
|
||||||
SkASSERT(!bm.drawsNothing());
|
SkASSERT(!bm.drawsNothing());
|
||||||
SkASSERT(4 == bm.bytesPerPixel());
|
SkASSERT(4 == bm.bytesPerPixel());
|
||||||
if (maxBitmap->drawsNothing()) {
|
if (maxBitmap->drawsNothing()) {
|
||||||
@ -15,6 +15,9 @@ static void update(SkBitmap* maxBitmap, SkBitmap* minBitmap, const SkBitmap& bm)
|
|||||||
minBitmap->allocPixels(bm.info());
|
minBitmap->allocPixels(bm.info());
|
||||||
minBitmap->eraseColor(0xFFFFFFFF);
|
minBitmap->eraseColor(0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
|
if (maxBitmap->dimensions() != bm.dimensions()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
SkASSERT_RELEASE(maxBitmap->info() == bm.info());
|
SkASSERT_RELEASE(maxBitmap->info() == bm.info());
|
||||||
const SkPixmap& pmin = minBitmap->pixmap();
|
const SkPixmap& pmin = minBitmap->pixmap();
|
||||||
const SkPixmap& pmax = maxBitmap->pixmap();
|
const SkPixmap& pmax = maxBitmap->pixmap();
|
||||||
@ -35,6 +38,7 @@ static void update(SkBitmap* maxBitmap, SkBitmap* minBitmap, const SkBitmap& bm)
|
|||||||
memcpy(maxPtr, maxColor, 4);
|
memcpy(maxPtr, maxColor, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SkBitmap decode_to_srgb_8888_unpremul(const char* path) {
|
static SkBitmap decode_to_srgb_8888_unpremul(const char* path) {
|
||||||
@ -72,11 +76,21 @@ int main(int argc, char** argv) {
|
|||||||
while (iter.next(&name)) {
|
while (iter.next(&name)) {
|
||||||
name.prependf("%s/", src_dir);
|
name.prependf("%s/", src_dir);
|
||||||
SkBitmap bm = decode_to_srgb_8888_unpremul(name.c_str());
|
SkBitmap bm = decode_to_srgb_8888_unpremul(name.c_str());
|
||||||
if (!bm.drawsNothing()) {
|
if (bm.drawsNothing()) {
|
||||||
update(&maxBitmap, &minBitmap, bm);
|
SkDebugf("'%s' failed to decode.\n", name.c_str());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!update(&maxBitmap, &minBitmap, bm)) {
|
||||||
|
SkDebugf("'%s' has unmatched dimensions.\n", name.c_str());
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SkASSERT_RELEASE(sk_mkdir(dst_dir));
|
SkASSERT_RELEASE(sk_mkdir(dst_dir));
|
||||||
|
if ((maxBitmap.drawsNothing()) || (maxBitmap.drawsNothing())) {
|
||||||
|
SkDebugf("Failure: '%s' '%s'\n", src_dir, dst_dir);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
encode_png(SkStringPrintf("%s/min.png", dst_dir).c_str(), minBitmap.pixmap());
|
encode_png(SkStringPrintf("%s/min.png", dst_dir).c_str(), minBitmap.pixmap());
|
||||||
encode_png(SkStringPrintf("%s/max.png", dst_dir).c_str(), maxBitmap.pixmap());
|
encode_png(SkStringPrintf("%s/max.png", dst_dir).c_str(), maxBitmap.pixmap());
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user