79 {
83 if (nullptr == img.get()) {
84 SkDebugf(
"invalid image, could not decode\n");
85 return;
86 }
88 SkDebugf(
"Too big (%d x %d)\n", img->width(), img->height());
89 return;
90 }
91 std::vector<int32_t> dstPixels;
92 int rowBytes = img->width() * 4;
93 dstPixels.resize(img->height() * rowBytes);
95 &dstPixels.front(), rowBytes);
96 if (!img->readPixels(nullptr, pm, 0, 0)) {
98 return;
99 }
100
103 s.appendU32(rand.
nextU());
106 SkDebugf(
"Can't initialize file\n");
107 return;
108 }
109 auto total = pm.info().bytesPerPixel() * pm.width() * pm.height();
110 SkDebugf(
"Writing %d (%d x %d) bytes\n", total, pm.width(), pm.height());
111
112
113 uint32_t
w = pm.width();
115 uint32_t
h = pm.height();
119}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
FILE * sk_fopen(const char path[], SkFILE_Flags)
size_t sk_fwrite(const void *buffer, size_t byteCount, FILE *)
static sk_sp< SkData > MakeWithoutCopy(const void *data, size_t length)
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
static SkImageInfo MakeN32Premul(int width, int height)