1166 {
1169
1171 if (!FLAGS_dryRun) {
1177 if (!
log.isEmpty()) {
1183 }
1187 return;
1188 }
1196 }
1197
1198
1201 std::unique_ptr<SkStreamAsset> ownedData(
data);
1202
1203 std::unique_ptr<HashAndEncode> hashAndEncode;
1204
1206 if (!FLAGS_writePath.isEmpty() || !FLAGS_readPath.isEmpty()) {
1208 if (
data->getLength()) {
1211 } else {
1212 hashAndEncode = std::make_unique<HashAndEncode>(
bitmap);
1213 hashAndEncode->feedHash(&
hash);
1214 }
1215 md5 =
hash.finish().toLowercaseHexString();
1216 }
1217
1218 if (!FLAGS_readPath.isEmpty() &&
1227 FLAGS_readPath[0]));
1228 }
1229
1230
1231 const char*
ext = task.
sink->fileExtension();
1232 if (
ext && !FLAGS_writePath.isEmpty()) {
1233 #if defined(SK_BUILD_FOR_MAC)
1236
1238
1239 SkUniqueCFRef<CGDataProviderRef> provider{
1240 CGDataProviderCreateWithData(nullptr,
1243 nullptr)};
1244
1245 SkUniqueCFRef<CGPDFDocumentRef> pdf{
1246 CGPDFDocumentCreateWithProvider(provider.get())};
1247
1248 CGPDFPageRef
page = CGPDFDocumentGetPage(pdf.get(), 1);
1249
1250 CGRect
bounds = CGPDFPageGetBoxRect(
page, kCGPDFMediaBox);
1253
1258
1259 SkUniqueCFRef<CGColorSpaceRef> cs{CGColorSpaceCreateDeviceRGB()};
1260 CGBitmapInfo
info = kCGBitmapByteOrder32Big |
1261 (CGBitmapInfo)kCGImageAlphaPremultipliedLast;
1262
1263 SkUniqueCFRef<CGContextRef> ctx{CGBitmapContextCreate(
1265 CGContextDrawPDFPage(ctx.get(),
page);
1266
1267
1268 hashAndEncode = std::make_unique<HashAndEncode>(rasterized);
1269 WriteToDisk(task,
md5,
"png",
nullptr,0, &rasterized, hashAndEncode.get());
1270 } else
1271 #endif
1272 if (
data->getLength()) {
1275 }
else if (!
bitmap.drawsNothing()) {
1277 }
1278 }
1279
1282 bitmap.peekPixels(&pm)) {
1283 bool unclamped = false;
1284 for (
int y = 0;
y < pm.
height() && !unclamped; ++
y)
1285 for (
int x = 0;
x < pm.
width() && !unclamped; ++
x) {
1289 SkDebugf(
"[%s] F16Norm pixel [%d, %d] unclamped: (%g, %g, %g, %g)\n",
1291 unclamped = true;
1292 }
1293 }
1294 }
1295 });
1296 }
1298 }
static SkMD5::Digest md5(const SkBitmap &bm)
static void done(const char *config, const char *src, const char *srcOptions, const char *name)
static THashSet< Gold, Gold::Hash > * gGold
static void start(const char *config, const char *src, const char *srcOptions, const char *name)
static void fail(const SkString &err)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static SkTaskGroup * gDefinitelyThreadSafeWork
static const uint32_t rgba[kNumPixels]
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kRGBA_F16Norm_SkColorType
pixel with half floats in [0,1] for red, green, blue, alpha;
constexpr SkColor SK_ColorWHITE
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static uint32_t hash(const SkShaderBase::GradientInfo &v)
bool equals(SkDrawable *a, SkDrawable *b)
void allocPixels(const SkImageInfo &info, size_t rowBytes)
void eraseColor(SkColor4f) const
const void * data() const
static sk_sp< SkData > MakeFromStream(SkStream *, size_t size)
const uint64_t * addr64() const
const char * c_str() const
void add(std::function< void(void)> fn)
Optional< SkRect > bounds
DEF_SWITCHES_START aot vmservice shared library name
SIN Vec< N, float > from_half(const Vec< N, uint16_t > &x)
SIT bool any(const Vec< 1, T > &x)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static void WriteToDisk(const Task &task, SkString md5, const char *ext, SkStream *data, size_t len, const SkBitmap *bitmap, const HashAndEncode *hashAndEncode)
static SKVX_ALWAYS_INLINE Vec Load(const void *ptr)
std::shared_ptr< const fml::Mapping > data