44 fuzz->nextRange(&opts.fZLibLevel, 0, 9);
54 fuzz->nextRange(&opts.fQuality, 0, 100);
64 fuzz->nextRange(&opts.fQuality, 0.0f, 100.0f);
83 if (
nullptr == img.get()) {
84 SkDebugf(
"invalid image, could not decode\n");
88 SkDebugf(
"Too big (%d x %d)\n", img->width(), img->height());
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)) {
103 s.appendU32(rand.
nextU());
106 SkDebugf(
"Can't initialize file\n");
static SkBitmap make_fuzzed_bitmap(Fuzz *fuzz)
DEF_FUZZ(PNGEncoder, fuzz)
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 *)
void nextRange(T *, Min, Max)
void nextN(T *ptr, int n)
bool tryAllocPixels(const SkImageInfo &info, size_t rowBytes)
static sk_sp< SkData > MakeWithoutCopy(const void *data, size_t length)
const SkImageInfo & info() const
const void * addr() const
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
static SkImageInfo MakeN32Premul(int width, int height)
int bytesPerPixel() const