FM, a dumber new testing tool
FM's a bit like DM, and a bit like the old GM tool, maybe closer to GM.
FM always does one serial run through of a list of GM, image, or .skp
sources (-s/--sources) into one drawing configuration, set at a high
level with -b/--backend, fine-tuned by flags like --ct, --at, --gamut,
--samples, etc.
FM prints all available GMs when run with no arguments, part of
how it integrates well with external parallelization like xargs:
out/fm | time xargs -n4 -P32 out/fm -b cpu ... -s
out/fm | time xargs -n32 -P8 out/fm -b gl ... -s
ls *.skp | xargs ... out/fm ... -s
...
TODO later:
vector backends: --backend pdf, svg, xps, skp
--source *.svg, *.json (Skottie)
Create/update a dm.json file
Change-Id: Idacbd2785deaf6f1d33674c66c4d984fa91dbd85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203520
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-25 17:57:58 +00:00
|
|
|
// Copyright 2019 Google LLC.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkICC.h"
|
|
|
|
#include "include/core/SkString.h"
|
|
|
|
#include "tools/HashAndEncode.h"
|
2021-11-23 14:08:05 +00:00
|
|
|
|
|
|
|
#include <png.h>
|
FM, a dumber new testing tool
FM's a bit like DM, and a bit like the old GM tool, maybe closer to GM.
FM always does one serial run through of a list of GM, image, or .skp
sources (-s/--sources) into one drawing configuration, set at a high
level with -b/--backend, fine-tuned by flags like --ct, --at, --gamut,
--samples, etc.
FM prints all available GMs when run with no arguments, part of
how it integrates well with external parallelization like xargs:
out/fm | time xargs -n4 -P32 out/fm -b cpu ... -s
out/fm | time xargs -n32 -P8 out/fm -b gl ... -s
ls *.skp | xargs ... out/fm ... -s
...
TODO later:
vector backends: --backend pdf, svg, xps, skp
--source *.svg, *.json (Skottie)
Create/update a dm.json file
Change-Id: Idacbd2785deaf6f1d33674c66c4d984fa91dbd85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203520
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-25 17:57:58 +00:00
|
|
|
|
|
|
|
static sk_sp<SkColorSpace> rec2020() {
|
2019-05-24 14:13:36 +00:00
|
|
|
return SkColorSpace::MakeRGB(SkNamedTransferFn::kRec2020, SkNamedGamut::kRec2020);
|
FM, a dumber new testing tool
FM's a bit like DM, and a bit like the old GM tool, maybe closer to GM.
FM always does one serial run through of a list of GM, image, or .skp
sources (-s/--sources) into one drawing configuration, set at a high
level with -b/--backend, fine-tuned by flags like --ct, --at, --gamut,
--samples, etc.
FM prints all available GMs when run with no arguments, part of
how it integrates well with external parallelization like xargs:
out/fm | time xargs -n4 -P32 out/fm -b cpu ... -s
out/fm | time xargs -n32 -P8 out/fm -b gl ... -s
ls *.skp | xargs ... out/fm ... -s
...
TODO later:
vector backends: --backend pdf, svg, xps, skp
--source *.svg, *.json (Skottie)
Create/update a dm.json file
Change-Id: Idacbd2785deaf6f1d33674c66c4d984fa91dbd85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203520
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-25 17:57:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HashAndEncode::HashAndEncode(const SkBitmap& bitmap) : fSize(bitmap.info().dimensions()) {
|
|
|
|
skcms_AlphaFormat srcAlpha;
|
|
|
|
switch (bitmap.alphaType()) {
|
2019-03-27 18:52:35 +00:00
|
|
|
case kUnknown_SkAlphaType: return;
|
FM, a dumber new testing tool
FM's a bit like DM, and a bit like the old GM tool, maybe closer to GM.
FM always does one serial run through of a list of GM, image, or .skp
sources (-s/--sources) into one drawing configuration, set at a high
level with -b/--backend, fine-tuned by flags like --ct, --at, --gamut,
--samples, etc.
FM prints all available GMs when run with no arguments, part of
how it integrates well with external parallelization like xargs:
out/fm | time xargs -n4 -P32 out/fm -b cpu ... -s
out/fm | time xargs -n32 -P8 out/fm -b gl ... -s
ls *.skp | xargs ... out/fm ... -s
...
TODO later:
vector backends: --backend pdf, svg, xps, skp
--source *.svg, *.json (Skottie)
Create/update a dm.json file
Change-Id: Idacbd2785deaf6f1d33674c66c4d984fa91dbd85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203520
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-25 17:57:58 +00:00
|
|
|
|
|
|
|
case kOpaque_SkAlphaType:
|
|
|
|
case kUnpremul_SkAlphaType: srcAlpha = skcms_AlphaFormat_Unpremul; break;
|
|
|
|
case kPremul_SkAlphaType: srcAlpha = skcms_AlphaFormat_PremulAsEncoded; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
skcms_PixelFormat srcFmt;
|
|
|
|
switch (bitmap.colorType()) {
|
2019-09-19 20:05:48 +00:00
|
|
|
case kUnknown_SkColorType: return;
|
FM, a dumber new testing tool
FM's a bit like DM, and a bit like the old GM tool, maybe closer to GM.
FM always does one serial run through of a list of GM, image, or .skp
sources (-s/--sources) into one drawing configuration, set at a high
level with -b/--backend, fine-tuned by flags like --ct, --at, --gamut,
--samples, etc.
FM prints all available GMs when run with no arguments, part of
how it integrates well with external parallelization like xargs:
out/fm | time xargs -n4 -P32 out/fm -b cpu ... -s
out/fm | time xargs -n32 -P8 out/fm -b gl ... -s
ls *.skp | xargs ... out/fm ... -s
...
TODO later:
vector backends: --backend pdf, svg, xps, skp
--source *.svg, *.json (Skottie)
Create/update a dm.json file
Change-Id: Idacbd2785deaf6f1d33674c66c4d984fa91dbd85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203520
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-25 17:57:58 +00:00
|
|
|
|
2020-07-17 18:52:41 +00:00
|
|
|
case kAlpha_8_SkColorType: srcFmt = skcms_PixelFormat_A_8; break;
|
|
|
|
case kRGB_565_SkColorType: srcFmt = skcms_PixelFormat_BGR_565; break;
|
|
|
|
case kARGB_4444_SkColorType: srcFmt = skcms_PixelFormat_ABGR_4444; break;
|
|
|
|
case kRGBA_8888_SkColorType: srcFmt = skcms_PixelFormat_RGBA_8888; break;
|
|
|
|
case kBGRA_8888_SkColorType: srcFmt = skcms_PixelFormat_BGRA_8888; break;
|
2021-08-10 18:39:18 +00:00
|
|
|
case kSRGBA_8888_SkColorType: srcFmt = skcms_PixelFormat_RGBA_8888_sRGB; break;
|
2020-07-17 18:52:41 +00:00
|
|
|
case kRGBA_1010102_SkColorType: srcFmt = skcms_PixelFormat_RGBA_1010102; break;
|
|
|
|
case kBGRA_1010102_SkColorType: srcFmt = skcms_PixelFormat_BGRA_1010102; break;
|
|
|
|
case kGray_8_SkColorType: srcFmt = skcms_PixelFormat_G_8; break;
|
|
|
|
case kRGBA_F16Norm_SkColorType: srcFmt = skcms_PixelFormat_RGBA_hhhh; break;
|
|
|
|
case kRGBA_F16_SkColorType: srcFmt = skcms_PixelFormat_RGBA_hhhh; break;
|
|
|
|
case kRGBA_F32_SkColorType: srcFmt = skcms_PixelFormat_RGBA_ffff; break;
|
|
|
|
case kR16G16B16A16_unorm_SkColorType: srcFmt = skcms_PixelFormat_RGBA_16161616LE; break;
|
FM, a dumber new testing tool
FM's a bit like DM, and a bit like the old GM tool, maybe closer to GM.
FM always does one serial run through of a list of GM, image, or .skp
sources (-s/--sources) into one drawing configuration, set at a high
level with -b/--backend, fine-tuned by flags like --ct, --at, --gamut,
--samples, etc.
FM prints all available GMs when run with no arguments, part of
how it integrates well with external parallelization like xargs:
out/fm | time xargs -n4 -P32 out/fm -b cpu ... -s
out/fm | time xargs -n32 -P8 out/fm -b gl ... -s
ls *.skp | xargs ... out/fm ... -s
...
TODO later:
vector backends: --backend pdf, svg, xps, skp
--source *.svg, *.json (Skottie)
Create/update a dm.json file
Change-Id: Idacbd2785deaf6f1d33674c66c4d984fa91dbd85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203520
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-25 17:57:58 +00:00
|
|
|
|
2019-09-19 20:05:48 +00:00
|
|
|
case kRGB_888x_SkColorType: srcFmt = skcms_PixelFormat_RGBA_8888;
|
|
|
|
srcAlpha = skcms_AlphaFormat_Opaque; break;
|
|
|
|
case kRGB_101010x_SkColorType: srcFmt = skcms_PixelFormat_RGBA_1010102;
|
|
|
|
srcAlpha = skcms_AlphaFormat_Opaque; break;
|
2020-02-11 18:19:08 +00:00
|
|
|
case kBGR_101010x_SkColorType: srcFmt = skcms_PixelFormat_BGRA_1010102;
|
|
|
|
srcAlpha = skcms_AlphaFormat_Opaque; break;
|
2020-07-17 18:52:41 +00:00
|
|
|
|
2019-09-19 20:05:48 +00:00
|
|
|
case kR8G8_unorm_SkColorType: return;
|
|
|
|
case kR16G16_unorm_SkColorType: return;
|
|
|
|
case kR16G16_float_SkColorType: return;
|
|
|
|
case kA16_unorm_SkColorType: return;
|
|
|
|
case kA16_float_SkColorType: return;
|
FM, a dumber new testing tool
FM's a bit like DM, and a bit like the old GM tool, maybe closer to GM.
FM always does one serial run through of a list of GM, image, or .skp
sources (-s/--sources) into one drawing configuration, set at a high
level with -b/--backend, fine-tuned by flags like --ct, --at, --gamut,
--samples, etc.
FM prints all available GMs when run with no arguments, part of
how it integrates well with external parallelization like xargs:
out/fm | time xargs -n4 -P32 out/fm -b cpu ... -s
out/fm | time xargs -n32 -P8 out/fm -b gl ... -s
ls *.skp | xargs ... out/fm ... -s
...
TODO later:
vector backends: --backend pdf, svg, xps, skp
--source *.svg, *.json (Skottie)
Create/update a dm.json file
Change-Id: Idacbd2785deaf6f1d33674c66c4d984fa91dbd85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203520
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-25 17:57:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
skcms_ICCProfile srcProfile = *skcms_sRGB_profile();
|
|
|
|
if (auto cs = bitmap.colorSpace()) {
|
|
|
|
cs->toProfile(&srcProfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Our common format that can represent anything we draw and encode as a PNG:
|
|
|
|
// - 16-bit big-endian RGBA
|
|
|
|
// - unpremul
|
|
|
|
// - Rec. 2020 gamut and transfer function
|
|
|
|
skcms_PixelFormat dstFmt = skcms_PixelFormat_RGBA_16161616BE;
|
|
|
|
skcms_AlphaFormat dstAlpha = skcms_AlphaFormat_Unpremul;
|
|
|
|
skcms_ICCProfile dstProfile;
|
|
|
|
rec2020()->toProfile(&dstProfile);
|
|
|
|
|
|
|
|
int N = fSize.width() * fSize.height();
|
|
|
|
fPixels.reset(new uint64_t[N]);
|
|
|
|
|
2021-02-03 00:48:34 +00:00
|
|
|
const void* src = bitmap.getPixels();
|
|
|
|
void* dst = fPixels.get();
|
|
|
|
while (N > 0) {
|
|
|
|
int todo = std::min(N, 1<<27); // Keep todo*8 <= 1B; skcms requires N*bpp < MAX_INT.
|
|
|
|
if (!skcms_Transform(src, srcFmt, srcAlpha, &srcProfile,
|
|
|
|
dst, dstFmt, dstAlpha, &dstProfile, todo)) {
|
|
|
|
SkASSERT(false);
|
|
|
|
fPixels.reset(nullptr);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
src = (char*)src + todo*SkColorTypeBytesPerPixel(bitmap.colorType());
|
|
|
|
dst = (char*)dst + todo*sizeof(uint64_t);
|
|
|
|
N -= todo;
|
FM, a dumber new testing tool
FM's a bit like DM, and a bit like the old GM tool, maybe closer to GM.
FM always does one serial run through of a list of GM, image, or .skp
sources (-s/--sources) into one drawing configuration, set at a high
level with -b/--backend, fine-tuned by flags like --ct, --at, --gamut,
--samples, etc.
FM prints all available GMs when run with no arguments, part of
how it integrates well with external parallelization like xargs:
out/fm | time xargs -n4 -P32 out/fm -b cpu ... -s
out/fm | time xargs -n32 -P8 out/fm -b gl ... -s
ls *.skp | xargs ... out/fm ... -s
...
TODO later:
vector backends: --backend pdf, svg, xps, skp
--source *.svg, *.json (Skottie)
Create/update a dm.json file
Change-Id: Idacbd2785deaf6f1d33674c66c4d984fa91dbd85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203520
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-25 17:57:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-07 15:11:50 +00:00
|
|
|
void HashAndEncode::feedHash(SkWStream* st) const {
|
FM, a dumber new testing tool
FM's a bit like DM, and a bit like the old GM tool, maybe closer to GM.
FM always does one serial run through of a list of GM, image, or .skp
sources (-s/--sources) into one drawing configuration, set at a high
level with -b/--backend, fine-tuned by flags like --ct, --at, --gamut,
--samples, etc.
FM prints all available GMs when run with no arguments, part of
how it integrates well with external parallelization like xargs:
out/fm | time xargs -n4 -P32 out/fm -b cpu ... -s
out/fm | time xargs -n32 -P8 out/fm -b gl ... -s
ls *.skp | xargs ... out/fm ... -s
...
TODO later:
vector backends: --backend pdf, svg, xps, skp
--source *.svg, *.json (Skottie)
Create/update a dm.json file
Change-Id: Idacbd2785deaf6f1d33674c66c4d984fa91dbd85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203520
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-25 17:57:58 +00:00
|
|
|
st->write(&fSize, sizeof(fSize));
|
|
|
|
if (const uint64_t* px = fPixels.get()) {
|
|
|
|
st->write(px, sizeof(*px) * fSize.width() * fSize.height());
|
|
|
|
}
|
|
|
|
|
|
|
|
// N.B. changing salt will change the hash of all images produced by DM,
|
|
|
|
// and will cause tens of thousands of new images to be uploaded to Gold.
|
|
|
|
int salt = 1;
|
|
|
|
st->write(&salt, sizeof(salt));
|
|
|
|
}
|
|
|
|
|
2020-10-07 15:11:50 +00:00
|
|
|
// NOTE: HashAndEncode uses libpng directly rather than through an abstraction
|
|
|
|
// like SkPngEncoder to make sure we get stable, portable results independent
|
|
|
|
// of any changes to Skia production encoder.
|
FM, a dumber new testing tool
FM's a bit like DM, and a bit like the old GM tool, maybe closer to GM.
FM always does one serial run through of a list of GM, image, or .skp
sources (-s/--sources) into one drawing configuration, set at a high
level with -b/--backend, fine-tuned by flags like --ct, --at, --gamut,
--samples, etc.
FM prints all available GMs when run with no arguments, part of
how it integrates well with external parallelization like xargs:
out/fm | time xargs -n4 -P32 out/fm -b cpu ... -s
out/fm | time xargs -n32 -P8 out/fm -b gl ... -s
ls *.skp | xargs ... out/fm ... -s
...
TODO later:
vector backends: --backend pdf, svg, xps, skp
--source *.svg, *.json (Skottie)
Create/update a dm.json file
Change-Id: Idacbd2785deaf6f1d33674c66c4d984fa91dbd85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203520
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-25 17:57:58 +00:00
|
|
|
|
2020-10-07 15:11:50 +00:00
|
|
|
bool HashAndEncode::encodePNG(SkWStream* st,
|
|
|
|
const char* md5,
|
|
|
|
CommandLineFlags::StringArray key,
|
|
|
|
CommandLineFlags::StringArray properties) const {
|
|
|
|
if (!fPixels) {
|
FM, a dumber new testing tool
FM's a bit like DM, and a bit like the old GM tool, maybe closer to GM.
FM always does one serial run through of a list of GM, image, or .skp
sources (-s/--sources) into one drawing configuration, set at a high
level with -b/--backend, fine-tuned by flags like --ct, --at, --gamut,
--samples, etc.
FM prints all available GMs when run with no arguments, part of
how it integrates well with external parallelization like xargs:
out/fm | time xargs -n4 -P32 out/fm -b cpu ... -s
out/fm | time xargs -n32 -P8 out/fm -b gl ... -s
ls *.skp | xargs ... out/fm ... -s
...
TODO later:
vector backends: --backend pdf, svg, xps, skp
--source *.svg, *.json (Skottie)
Create/update a dm.json file
Change-Id: Idacbd2785deaf6f1d33674c66c4d984fa91dbd85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203520
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-25 17:57:58 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
|
|
|
if (!png) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
png_infop info = png_create_info_struct(png);
|
|
|
|
if (!info) {
|
|
|
|
png_destroy_write_struct(&png, &info);
|
|
|
|
return false;
|
|
|
|
}
|
2020-10-07 15:11:50 +00:00
|
|
|
auto write_to_stream = +[](png_structp png, png_bytep ptr, png_size_t len) {
|
|
|
|
auto st = (SkWStream*)png_get_io_ptr(png);
|
|
|
|
if (!st->write(ptr, len)) {
|
|
|
|
png_error(png, "HashAndEncode::encodePNG() failed writing stream");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
png_set_write_fn(png, st, write_to_stream, nullptr);
|
FM, a dumber new testing tool
FM's a bit like DM, and a bit like the old GM tool, maybe closer to GM.
FM always does one serial run through of a list of GM, image, or .skp
sources (-s/--sources) into one drawing configuration, set at a high
level with -b/--backend, fine-tuned by flags like --ct, --at, --gamut,
--samples, etc.
FM prints all available GMs when run with no arguments, part of
how it integrates well with external parallelization like xargs:
out/fm | time xargs -n4 -P32 out/fm -b cpu ... -s
out/fm | time xargs -n32 -P8 out/fm -b gl ... -s
ls *.skp | xargs ... out/fm ... -s
...
TODO later:
vector backends: --backend pdf, svg, xps, skp
--source *.svg, *.json (Skottie)
Create/update a dm.json file
Change-Id: Idacbd2785deaf6f1d33674c66c4d984fa91dbd85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203520
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-25 17:57:58 +00:00
|
|
|
|
|
|
|
SkString description;
|
|
|
|
description.append("Key: ");
|
|
|
|
for (int i = 0; i < key.count(); i++) {
|
|
|
|
description.appendf("%s ", key[i]);
|
|
|
|
}
|
|
|
|
description.append("Properties: ");
|
|
|
|
for (int i = 0; i < properties.count(); i++) {
|
|
|
|
description.appendf("%s ", properties[i]);
|
|
|
|
}
|
|
|
|
description.appendf("MD5: %s", md5);
|
|
|
|
|
|
|
|
png_text text[2];
|
|
|
|
text[0].key = (png_charp)"Author";
|
|
|
|
text[0].text = (png_charp)"DM unified Rec.2020";
|
|
|
|
text[0].compression = PNG_TEXT_COMPRESSION_NONE;
|
|
|
|
text[1].key = (png_charp)"Description";
|
|
|
|
text[1].text = (png_charp)description.c_str();
|
|
|
|
text[1].compression = PNG_TEXT_COMPRESSION_NONE;
|
|
|
|
png_set_text(png, info, text, SK_ARRAY_COUNT(text));
|
|
|
|
|
|
|
|
png_set_IHDR(png, info, (png_uint_32)fSize.width()
|
|
|
|
, (png_uint_32)fSize.height()
|
|
|
|
, 16/*bits per channel*/
|
|
|
|
, PNG_COLOR_TYPE_RGB_ALPHA
|
|
|
|
, PNG_INTERLACE_NONE
|
|
|
|
, PNG_COMPRESSION_TYPE_DEFAULT
|
|
|
|
, PNG_FILTER_TYPE_DEFAULT);
|
|
|
|
|
|
|
|
// Fastest encoding and decoding, at slight file size cost is no filtering, compression 1.
|
|
|
|
png_set_filter(png, PNG_FILTER_TYPE_BASE, PNG_FILTER_NONE);
|
2019-03-27 17:36:11 +00:00
|
|
|
png_set_compression_level(png, 1);
|
FM, a dumber new testing tool
FM's a bit like DM, and a bit like the old GM tool, maybe closer to GM.
FM always does one serial run through of a list of GM, image, or .skp
sources (-s/--sources) into one drawing configuration, set at a high
level with -b/--backend, fine-tuned by flags like --ct, --at, --gamut,
--samples, etc.
FM prints all available GMs when run with no arguments, part of
how it integrates well with external parallelization like xargs:
out/fm | time xargs -n4 -P32 out/fm -b cpu ... -s
out/fm | time xargs -n32 -P8 out/fm -b gl ... -s
ls *.skp | xargs ... out/fm ... -s
...
TODO later:
vector backends: --backend pdf, svg, xps, skp
--source *.svg, *.json (Skottie)
Create/update a dm.json file
Change-Id: Idacbd2785deaf6f1d33674c66c4d984fa91dbd85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203520
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-25 17:57:58 +00:00
|
|
|
|
2019-05-24 14:13:36 +00:00
|
|
|
static const sk_sp<SkData> profile =
|
|
|
|
SkWriteICCProfile(SkNamedTransferFn::kRec2020, SkNamedGamut::kRec2020);
|
FM, a dumber new testing tool
FM's a bit like DM, and a bit like the old GM tool, maybe closer to GM.
FM always does one serial run through of a list of GM, image, or .skp
sources (-s/--sources) into one drawing configuration, set at a high
level with -b/--backend, fine-tuned by flags like --ct, --at, --gamut,
--samples, etc.
FM prints all available GMs when run with no arguments, part of
how it integrates well with external parallelization like xargs:
out/fm | time xargs -n4 -P32 out/fm -b cpu ... -s
out/fm | time xargs -n32 -P8 out/fm -b gl ... -s
ls *.skp | xargs ... out/fm ... -s
...
TODO later:
vector backends: --backend pdf, svg, xps, skp
--source *.svg, *.json (Skottie)
Create/update a dm.json file
Change-Id: Idacbd2785deaf6f1d33674c66c4d984fa91dbd85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203520
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-25 17:57:58 +00:00
|
|
|
png_set_iCCP(png, info,
|
|
|
|
"Rec.2020",
|
|
|
|
0/*compression type... no idea what options are available here*/,
|
|
|
|
(png_const_bytep)profile->data(),
|
|
|
|
(png_uint_32) profile->size());
|
|
|
|
|
|
|
|
png_write_info(png, info);
|
|
|
|
for (int y = 0; y < fSize.height(); y++) {
|
|
|
|
png_write_row(png, (png_bytep)(fPixels.get() + y*fSize.width()));
|
|
|
|
}
|
|
|
|
png_write_end(png, info);
|
|
|
|
|
|
|
|
png_destroy_write_struct(&png, &info);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|