52#ifdef SK_ENABLE_ANDROID_UTILS
63#include <initializer_list>
70#if PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR < 5
74 #define SK_PNG_DISABLE_TESTS
105template<
typename Codec>
127 }
while (
rect.isEmpty());
154 const int numStripes = 4;
156 if (numStripes >
height) {
161 const int stripeHeight =
height / numStripes;
164 for (
int oddEven = 1; oddEven >= 0; oddEven--) {
165 for (
int y = oddEven * stripeHeight;
y <
height;
y += 2 * stripeHeight) {
172 ERRORF(r,
"failed to start incremental decode!\ttop: %i\tbottom%i\n",
177 ERRORF(r,
"failed incremental decode starting from line %i\n",
y);
186template<
typename Codec>
213 auto actualResult = codec->getPixels(info565, bm565.
getPixels(), bm565.
rowBytes());
214 if (actualResult == expectedResult) {
220 test_info(r, codec, info565, expectedResult, &digest565);
223 ERRORF(r,
"Decoding %s to 565 failed with result \"%s\"\n\t\t\t\texpected:\"%s\"",
247 test_info(r, codec, grayInfo, expectedResult, &grayDigest);
261 expectedResult, digest);
263 expectedResult, digest);
275 test_info(r, codec,
info.makeAlphaType(otherAt), expectedResult,
nullptr);
281 static const char*
const exts[] = {
282 "jpg",
"jpeg",
"png",
"webp",
283 "JPG",
"JPEG",
"PNG",
"WEBP"
300 bool supportsScanlineDecoding,
301 bool supportsIncomplete,
302 bool supportsNewScanlineDecoding) {
311 if (supportsNewScanlineDecoding && !supportsIncomplete) {
325 if (supportsScanlineDecoding) {
330 for (
int y = 0;
y <
info.height();
y++) {
332 if (!supportsIncomplete) {
350 if (!supportsIncomplete) {
374 if (!supportsIncomplete) {
388 bool supportsSubsetDecoding,
389 bool supportsIncomplete) {
393 if (
size.width() *
size.height() == 1) {
401 for (
int i = 0;
i < 5;
i++) {
412 if (supportsSubsetDecoding) {
413 if (!supportsIncomplete) {
427 std::unique_ptr<SkCodec> codec,
432 bool supportsScanlineDecoding,
433 bool supportsSubsetDecoding,
434 bool supportsIncomplete,
435 bool supportsNewScanlineDecoding) {
436 if (supportsScanlineDecoding || supportsSubsetDecoding || supportsNewScanlineDecoding) {
456 bool supportsIncomplete) {
458 if (!supportsIncomplete) {
461 std::unique_ptr<SkImageGenerator>
gen(
468#if !defined(SK_PNG_DISABLE_TESTS) && defined(SK_ENABLE_ANDROID_UTILS)
485 bool supportsScanlineDecoding,
486 bool supportsSubsetDecoding,
487 bool supportsIncomplete,
488 bool supportsNewScanlineDecoding =
false) {
490 if (supportsIncomplete) {
491 check(r,
path,
size, supportsScanlineDecoding, supportsSubsetDecoding,
492 false, supportsNewScanlineDecoding);
501 std::unique_ptr<SkCodec> codec;
502 if (supportsIncomplete) {
513 const SkImageInfo info = codec->getInfo().makeColorType(kN32_SkColorType);
518 supportsIncomplete, supportsNewScanlineDecoding);
523 supportsScanlineDecoding, supportsSubsetDecoding, supportsIncomplete,
524 supportsNewScanlineDecoding);
550 check(r,
"images/google_chrome.ico",
SkISize::Make(256, 256),
false,
false,
false,
true);
555 check(r,
"images/color_wheel.gif",
SkISize::Make(128, 128),
false,
false,
true,
true);
573 check(r,
"images/color_wheel.png",
SkISize::Make(128, 128),
false,
false,
true,
true);
575 check(r,
"images/half-transparent-white-pixel.png",
SkISize::Make(1, 1),
false,
false,
false,
true);
576 check(r,
"images/mandrill_128.png",
SkISize::Make(128, 128),
false,
false,
true,
true);
579 check(r,
"images/mandrill_256.png",
SkISize::Make(256, 256),
false,
false,
true,
true);
581 check(r,
"images/mandrill_512.png",
SkISize::Make(512, 512),
false,
false,
true,
true);
584 check(r,
"images/plane_interlaced.png",
SkISize::Make(250, 126),
false,
false,
true,
true);
586 check(r,
"images/yellow_rose.png",
SkISize::Make(400, 301),
false,
false,
true,
true);
590#if defined(SK_CODEC_DECODES_RAW) && (!defined(_WIN32))
593 check(r,
"images/sample_1mp_rotated.dng",
SkISize::Make(600, 338),
false,
false,
false);
601 std::make_unique<SkMemoryStream>(
stream,
len,
false)));
603 std::make_unique<SkMemoryStream>(
stream,
len,
false)));
610 const char nonSupportedStream[] =
"hello world";
613 const unsigned char emptyPng[] = { 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a };
614 const unsigned char emptyJpeg[] = { 0xFF, 0xD8, 0xFF };
615 const char emptyWebp[] =
"RIFF1234WEBPVP";
616 const char emptyBmp[] = {
'B',
'M' };
617 const char emptyIco[] = {
'\x00',
'\x00',
'\x01',
'\x00' };
618 const char emptyGif[] =
"GIFVER";
644 ERRORF(r,
"Unable to create codec '%s'",
path);
649 for (
int sampleSize = 1; sampleSize < 32; sampleSize++) {
651 SkISize scaledDims = codec->getSampledDimensions(sampleSize);
662 options.fSampleSize = sampleSize;
664 codec->getAndroidPixels(scaledInfo, pixels.
get(), rowBytes, &
options);
666 ERRORF(r,
"Failed to decode %s with sample size %i; error: %s",
path, sampleSize,
697#if defined(SK_CODEC_DECODES_RAW) && (!defined(_WIN32))
734#if defined(SK_CODEC_DECODES_RAW) && (!defined(_WIN32))
743#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
745#ifndef SK_PNG_DISABLE_TESTS
748static void codex_test_write_fn(png_structp png_ptr, png_bytep
data, png_size_t
len) {
751 png_error(png_ptr,
"sk_write_fn Error!");
768 png_structp
png = png_create_write_struct(PNG_LIBPNG_VER_STRING,
nullptr,
nullptr,
nullptr);
774 png_infop
info = png_create_info_struct(png);
777 png_destroy_write_struct(&png,
nullptr);
781 if (setjmp(png_jmpbuf(png))) {
782 ERRORF(r,
"failed writing png");
783 png_destroy_write_struct(&png, &
info);
788 png_set_write_fn(png, (
void*) (&wStream), codex_test_write_fn,
nullptr);
790 png_set_IHDR(png,
info, (png_uint_32)
w, (png_uint_32)
h, 8,
791 PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
792 PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
794#define PNG_BYTES(str) reinterpret_cast<png_byte*>(const_cast<char*>(str))
797 static png_unknown_chunk gUnknowns[] = {
798 {
"npOl", PNG_BYTES(
"outline"),
sizeof(
"outline"), PNG_HAVE_IHDR },
799 {
"npLb", PNG_BYTES(
"layoutBounds"),
sizeof(
"layoutBounds"), PNG_HAVE_IHDR },
800 {
"npTc", PNG_BYTES(
"ninePatchData"),
sizeof(
"ninePatchData"), PNG_HAVE_IHDR },
803 png_set_keep_unknown_chunks(png, PNG_HANDLE_CHUNK_ALWAYS, PNG_BYTES(
"npOl\0npLb\0npTc\0"), 3);
804 png_set_unknown_chunks(png,
info, gUnknowns,
std::size(gUnknowns));
805#if PNG_LIBPNG_VER < 10600
807 png_set_unknown_chunk_location(png,
info, 0, PNG_HAVE_IHDR);
808 png_set_unknown_chunk_location(png,
info, 1, PNG_HAVE_IHDR);
811 png_write_info(png,
info);
813 for (
int j = 0; j <
h; j++) {
814 png_bytep row = (png_bytep)(bm.
getAddr(0, j));
815 png_write_rows(png, &row, 1);
817 png_write_end(png,
info);
818 png_destroy_write_struct(&png, &
info);
830 if (!strcmp(tag, (
const char*) gUnknowns[
i].
name)) {
838 (
const char*) gUnknowns[
i].
data));
842 ERRORF(fReporter,
"Saw an unexpected unknown chunk.");
846 bool allHaveBeenSeen() {
848 for (
auto seen : fSeen) {
863 ChunkReader chunkReader(r);
874 decodedBm.
setInfo(codec->getInfo());
911 size_t peek(
void* buf,
size_t bytes)
const override {
914 size_t read(
void* buf,
size_t bytes)
override {
915 return fStream.
read(buf, bytes);
929#if defined(SK_CODEC_DECODES_RAW) && (!defined(_WIN32))
933 constexpr char path[] =
"images/dng_with_preview.dng";
941 std::make_unique<NotAssetMemStream>(std::move(
data))));
951 constexpr char path[] =
"images/baby_tux.webp";
960 std::make_unique<LimitedPeekingMemStream>(
data, 25)));
977 const char*
path =
"images/mandrill.wbmp";
985 uint8_t* writeableData =
static_cast<uint8_t*
>(
data->writable_data());
986 writeableData[1] =
static_cast<uint8_t
>(~0x9F);
1003 const unsigned char maxSizeWbmp[] = { 0x00, 0x00,
1017 const unsigned char tooBigWbmp[] = { 0x00, 0x00,
1020 stream = std::make_unique<SkMemoryStream>(tooBigWbmp,
sizeof(tooBigWbmp),
false);
1027 const char*
path =
"images/mandrill_512_q075.jpg";
1036 ERRORF(r,
"Unable to create codec '%s'.",
path);
1040 const int width = codec->getInfo().width();
1041 const int height = codec->getInfo().height();
1048 auto sampledInfo = codec->getInfo().makeWH(
width / 12,
height / 12);
1049 auto result = codec->getAndroidPixels(sampledInfo, pixelStorage.
get(), rowBytes, &opts);
1053 result = codec->getPixels(codec->getInfo(), pixelStorage.
get(), rowBytes);
1061 result = codec->getAndroidPixels(codec->getInfo().makeWH(100, 100), pixelStorage.
get(),
1072 result = codec->getAndroidPixels(codec->getInfo(), pixelStorage.
get(), rowBytes, &opts);
1081 const int subsetWidth = codec->getInfo().width() / 2;
1082 const int subsetHeight = codec->getInfo().height() / 2;
1086 const int dstWidth = subsetWidth / opts.
fSampleSize;
1087 const int dstHeight = subsetHeight / opts.
fSampleSize;
1105 switch (origColorType) {
1111 return origColorType == codecColorType;
1116 switch (origAlphaType) {
1122 return origAlphaType == codecAlphaType;
1190 bool supportsScanlineDecoder,
1191 bool supportsIncrementalDecoder) {
1199 ERRORF(r,
"failed to create a codec for %s",
path);
1210 result = codec->startScanlineDecode(infoF16);
1211 if (supportsScanlineDecoder) {
1219 if (supportsIncrementalDecoder) {
1229 result = codec->startScanlineDecode(infoF16);
1230 if (supportsScanlineDecoder) {
1237 if (supportsIncrementalDecoder) {
1264 auto path =
"images/test640x479.gif";
1276 ERRORF(r,
"Failed to create codec for %s",
path);
1281 const size_t sizePosition =
stream->getPosition();
1286 const size_t positionAfterFirstFrame =
stream->getPosition();
1288 && positionAfterFirstFrame < stream->getLength());
1291 auto frameInfo = codec->getFrameInfo();
1299 static std::unique_ptr<SkStream>
Make(
const char path[],
size_t limit) {
1308 const size_t bytes = fStream->read(
buffer,
size);
1314 return fStream->isAtEnd();
1318 if (fPosition <= fLimit && fStream->
rewind()) {
1327 std::unique_ptr<SkStream> fStream;
1328 const size_t fLimit;
1348 "images/color_wheel.ico",
1349 "images/mandrill.wbmp",
1350 "images/randPixels.bmp",
1352 for (
auto file : files) {
1355 SkDebugf(
"Missing resources (%s). Set --resourcePath.\n",
file);
1361 ERRORF(r,
"Failed to create codec for %s,",
file);
1371 ERRORF(r,
"Is scanline decoding now implemented for %s?",
file);
1386 SkDebugf(
"Missing resources (%s). Set --resourcePath.\n",
file);
1392 ERRORF(r,
"Failed to create codec for %s,",
file);
1398 (void) codec->getFrameCount();
1410 const char*
file =
"images/flightAnim.gif";
1414#if defined(SK_ENABLE_ANDROID_UTILS)
1432 ERRORF(r,
"Failed to create codec\n");
1439 auto info = codec->getInfo().makeDimensions(
size).makeColorType(kN32_SkColorType);
1445 info = codec->getInfo().makeColorType(kN32_SkColorType);
1453 auto file =
"images/plane_interlaced.png";
1462 ERRORF(r,
"Failed to create codec\n");
1466 auto info = codec->getInfo().makeColorType(kN32_SkColorType);
1474 int rowsDecoded = 77;
1475 result = codec->incrementalDecode(&rowsDecoded);
1490 test_info(r, codec.get(), codec->getInfo().makeColorType(kN32_SkColorType), expectedResult,
1605 auto path =
"invalid_images/skbug6046.gif";
1617 const auto info = codec->getInfo().makeColorType(kN32_SkColorType);
1621 auto frameInfos = codec->getFrameInfo();
1623 for (
int i = 0;
static_cast<size_t>(
i) < frameInfos.size();
i++) {
1625 const auto reqFrame = frameInfos[
i].fRequiredFrame;
1630 ERRORF(r,
"Failed to start decoding frame %i (out of %zu) with error %i\n",
i,
1631 frameInfos.size(),
result);
1635 codec->incrementalDecode();
1678 REPORTER_ASSERT(r, p3Codec->getInfo().colorSpace()->gammaCloseToSRGB());
1680 bool success = p3->
toXYZD50(&mat0);
1682 success = p3Codec->getInfo().colorSpace()->toXYZD50(&mat1);
1685 for (
int i = 0;
i < 3;
i++) {
1686 for (
int j = 0; j < 3; j++) {
1699 const char*
path =
"images/baby_tux.webp";
1707 size_t truncatedSize = 5000;
1711 ERRORF(r,
"Failed to create a codec for %s truncated to only %zu bytes",
1712 path, truncatedSize);
1748 const char*
file =
"invalid_images/ossfuzz6274.gif";
1752 ERRORF(r,
"Invalid data gave non-nullptr image");
1761 const char*
file =
"images/b78329453.jpeg";
1770 ERRORF(r,
"failed to create codec from %s",
file);
1777 constexpr int kSampleSize = 19;
1778 const auto size = codec->getSampledDimensions(kSampleSize);
1779 auto info = codec->getInfo().makeDimensions(
size);
1785 options.fSampleSize = kSampleSize;
1797 const char*
file =
"images/mandrill_cmyk.jpg";
1816 const char*
file =
"images/crbug807324.png";
1838 for (
int j = 0; j <
kHeight; ++j) {
1840 ERRORF(r,
"image should not be transparent! %i, %i is 0",
i, j);
1847 const char*
path =
"images/color_wheel.png";
1855 .makeColorSpace(
nullptr);
1867 {
"images/cmyk_yellow_224_224_32.jpg", 0xFFD8FC04 },
1868 {
"images/wide_gamut_yellow_224_224_64.jpeg",0xFFE0E040 },
1871 for (
const auto& rec : recs) {
1879 ERRORF(r,
"Failed to create a codec from %s", rec.name);
1883 const auto*
profile = codec->getICCProfile();
1885 ERRORF(r,
"Expected %s to have a profile", rec.name);
1896 ERRORF(r,
"Failed to decode %s", rec.name);
1903DEF_TEST(Codec_kBGR_101010x_XR_SkColorType_supported, r) {
1922 constexpr char path[] =
"images/flightAnim.gif";
1936 const auto info = codec->getInfo();
1955 constexpr char path[] =
"images/flightAnim.gif";
1972 const auto info = codec->getInfo();
1998 constexpr char path[] =
"images/flightAnim.gif";
2011 auto [
image, res] = codec->getImage();
2022 constexpr char path[] =
"images/flightAnim.gif";
2040 "AlphaType is wrong %d",
2052DEF_TEST(Codec_jpeg_can_return_data_from_original_stream, r) {
2053 constexpr char path[] =
"images/dog.jpg";
2060 size_t expectedBytes =
stream->getLength();
2073 "AlphaType is wrong %d",
static void test_invalid(skiatest::Reporter *r, const char path[])
static void test_dimensions(skiatest::Reporter *r, const char path[])
static void check_scanline_decode(skiatest::Reporter *r, SkCodec *codec, SkMD5::Digest *codecDigest, const SkImageInfo &info, const char path[], SkISize size, bool supportsScanlineDecoding, bool supportsIncomplete, bool supportsNewScanlineDecoding)
SkIRect generate_random_subset(SkRandom *rand, int w, int h)
static void check_round_trip(skiatest::Reporter *r, SkCodec *origCodec, const SkImageInfo &info)
static void test_conversion_possible(skiatest::Reporter *r, const char *path, bool supportsScanlineDecoder, bool supportsIncrementalDecoder)
static SkMD5::Digest md5(const SkBitmap &bm)
static bool supports_partial_scanlines(const char path[])
static void check_codec_image_generator(skiatest::Reporter *r, const SkMD5::Digest &codecDigest, const SkImageInfo &info, const char path[], bool supportsIncomplete)
static void test_incremental_decode(skiatest::Reporter *r, SkCodec *codec, const SkImageInfo &info, const SkMD5::Digest &goodDigest)
static void decode_frame(skiatest::Reporter *r, SkCodec *codec, size_t frame)
static void test_in_stripes(skiatest::Reporter *r, SkCodec *codec, const SkImageInfo &info, const SkMD5::Digest &goodDigest)
static void check_color_xform(skiatest::Reporter *r, const char *path)
static void test_invalid_header(skiatest::Reporter *r, const char *path)
static bool alpha_type_match(SkAlphaType origAlphaType, SkAlphaType codecAlphaType)
static void check_subset_decode(skiatest::Reporter *r, SkCodec *codec, const SkImageInfo &info, SkISize size, bool supportsSubsetDecoding, bool supportsIncomplete)
static void compare_to_good_digest(skiatest::Reporter *r, const SkMD5::Digest &goodDigest, const SkBitmap &bm)
static bool color_type_match(SkColorType origColorType, SkColorType codecColorType)
static void encode_format(SkDynamicMemoryWStream *stream, const SkPixmap &pixmap, SkEncodedImageFormat format)
static void test_codec(skiatest::Reporter *r, const char *path, Codec *codec, SkBitmap &bm, const SkImageInfo &info, const SkISize &size, SkCodec::Result expectedResult, SkMD5::Digest *digest, const SkMD5::Digest *goodDigest)
static void check_android_codec(skiatest::Reporter *r, std::unique_ptr< SkCodec > codec, const SkMD5::Digest &codecDigest, const SkImageInfo &info, const char path[], SkISize size, bool supportsScanlineDecoding, bool supportsSubsetDecoding, bool supportsIncomplete, bool supportsNewScanlineDecoding)
static void test_encode_icc(skiatest::Reporter *r, SkEncodedImageFormat format)
static void test_invalid_images(skiatest::Reporter *r, const char *path, SkCodec::Result expectedResult)
static void seek_and_decode(const char *file, std::unique_ptr< SkStream > stream, skiatest::Reporter *r)
static void test_invalid_stream(skiatest::Reporter *r, const void *stream, size_t len)
static void check(skiatest::Reporter *r, const char path[], SkISize size, bool supportsScanlineDecoding, bool supportsSubsetDecoding, bool supportsIncomplete, bool supportsNewScanlineDecoding=false)
static void test_info(skiatest::Reporter *r, Codec *codec, const SkImageInfo &info, SkCodec::Result expectedResult, const SkMD5::Digest *goodDigest)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
sk_bzero(glyphs, sizeof(glyphs))
std::unique_ptr< SkStreamAsset > GetResourceAsStream(const char *resource, bool useFileStream)
sk_sp< SkData > GetResourceAsData(const char *resource)
SkString GetResourcePath(const char *resource)
static constexpr bool SkIsAlign2(T x)
@ kOpaque_SkAlphaType
pixel is opaque
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
#define SkASSERT_RELEASE(cond)
static bool color_space_almost_equal(float a, float b)
SkColorSpace * sk_srgb_singleton()
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kBGR_101010x_XR_SkColorType
pixel with 10 bits each for blue, green, red; in 32-bit word, extended range
constexpr SkColor SK_ColorYELLOW
constexpr SkColor SK_ColorTRANSPARENT
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorBLACK
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
sk_sp< SkData > SkCopyStreamToData(SkStream *stream)
bool SkStrEndsWith(const char string[], const char suffixStr[])
#define REPORTER_ASSERT(r, cond,...)
size_t peek(void *buf, size_t bytes) const override
bool isAtEnd() const override
LimitedPeekingMemStream(sk_sp< SkData > data, size_t limit)
size_t read(void *buf, size_t bytes) override
bool isAtEnd() const override
size_t read(void *buffer, size_t size) override
static std::unique_ptr< SkStream > Make(const char path[], size_t limit)
static std::unique_ptr< SkAndroidCodec > MakeFromData(sk_sp< SkData >, SkPngChunkReader *=nullptr)
static std::unique_ptr< SkAndroidCodec > MakeFromCodec(std::unique_ptr< SkCodec >)
static std::unique_ptr< SkAndroidCodec > MakeFromStream(std::unique_ptr< SkStream >, SkPngChunkReader *=nullptr)
void allocPixels(const SkImageInfo &info, size_t rowBytes)
SkColor getColor(int x, int y) const
const SkPixmap & pixmap() const
void * getAddr(int x, int y) const
SkColorType colorType() const
const SkImageInfo & info() const
bool peekPixels(SkPixmap *pixmap) const
bool setInfo(const SkImageInfo &imageInfo, size_t rowBytes=0)
uint32_t * getAddr32(int x, int y) const
bool tryAllocPixels(const SkImageInfo &info, size_t rowBytes)
void swap(SkBitmap &other)
void eraseColor(SkColor4f) const
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
static std::unique_ptr< SkImageGenerator > MakeFromEncodedCodec(sk_sp< SkData >, std::optional< SkAlphaType >=std::nullopt)
int getScanlines(void *dst, int countLines, size_t rowBytes)
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, SkSpan< const SkCodecs::Decoder > decoders, Result *=nullptr, SkPngChunkReader *=nullptr, SelectionPolicy selectionPolicy=SelectionPolicy::kPreferStillImage)
bool getValidSubset(SkIRect *desiredSubset) const
static std::unique_ptr< SkCodec > MakeFromData(sk_sp< SkData >, SkSpan< const SkCodecs::Decoder > decoders, SkPngChunkReader *=nullptr)
Result startScanlineDecode(const SkImageInfo &dstInfo, const Options *options)
static constexpr size_t MinBufferedBytesNeeded()
@ kTopDown_SkScanlineOrder
Result getPixels(const SkImageInfo &info, void *pixels, size_t rowBytes, const Options *)
SkScanlineOrder getScanlineOrder() const
Result startIncrementalDecode(const SkImageInfo &dstInfo, void *dst, size_t rowBytes, const Options *)
Result incrementalDecode(int *rowsDecoded=nullptr)
static const char * ResultToString(Result)
static constexpr int kNoFrame
bool skipScanlines(int countLines)
SkImageInfo getInfo() const
bool toXYZD50(skcms_Matrix3x3 *toXYZD50) const
sk_sp< SkColorSpace > makeLinearGamma() const
static sk_sp< SkColorSpace > MakeSRGB()
static sk_sp< SkColorSpace > MakeRGB(const skcms_TransferFunction &transferFn, const skcms_Matrix3x3 &toXYZ)
static sk_sp< SkColorSpace > Make(const skcms_ICCProfile &)
const uint8_t * bytes() const
const void * data() const
static sk_sp< SkData > MakeSubset(const SkData *src, size_t offset, size_t length)
static sk_sp< SkData > MakeFromStream(SkStream *, size_t size)
sk_sp< SkData > detachAsData()
SkAlphaType alphaType() const
sk_sp< SkData > refEncodedData() const
bool isAtEnd() const override
size_t read(void *buffer, size_t size) override
static std::unique_ptr< SkMemoryStream > Make(sk_sp< SkData > data)
size_t peek(void *buffer, size_t size) const override
void setColorSpace(sk_sp< SkColorSpace > colorSpace)
virtual bool readChunk(const char tag[], const void *data, size_t length)=0
uint32_t nextRangeU(uint32_t min, uint32_t max)
virtual bool write(const void *buffer, size_t size)=0
static std::unique_ptr< SkStreamRewindable > Make(std::unique_ptr< SkStream > stream, size_t minBufferSize)
uint32_t uint32_t * format
static float min(float r, float g, float b)
SK_API sk_sp< SkImage > DeferredImage(std::unique_ptr< SkCodec > codec, std::optional< SkAlphaType > alphaType=std::nullopt)
SK_API std::unique_ptr< SkCodec > Decode(std::unique_ptr< SkStream >, SkCodec::Result *, SkCodecs::DecodeContext=nullptr)
SK_API bool IsJpeg(const void *, size_t)
SK_API std::unique_ptr< SkCodec > Decode(std::unique_ptr< SkStream >, SkCodec::Result *, SkCodecs::DecodeContext=nullptr)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
static constexpr skcms_Matrix3x3 kAdobeRGB
static constexpr skcms_Matrix3x3 kDisplayP3
static constexpr skcms_TransferFunction k2Dot2
static constexpr skcms_TransferFunction kSRGB
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
sk_sp< const SkImage > image
sk_sp< SkBlender > blender SkRect rect
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
DEF_SWITCHES_START aot vmservice shared library name
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
constexpr int32_t top() const
static constexpr SkIRect MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b)
constexpr SkISize size() const
constexpr int32_t bottom() const
int32_t fTop
smaller y-axis bounds
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
int32_t fLeft
smaller x-axis bounds
static constexpr SkISize Make(int32_t w, int32_t h)
constexpr int32_t width() const
SkImageInfo makeWH(int newWidth, int newHeight) const
SkImageInfo makeAlphaType(SkAlphaType newAlphaType) const
static SkImageInfo MakeN32Premul(int width, int height)
size_t minRowBytes() const
static SkImageInfo MakeS32(int width, int height, SkAlphaType at)
size_t computeByteSize(size_t rowBytes) const
SkImageInfo makeDimensions(SkISize newSize) const
SkColorSpace * colorSpace() const
int bytesPerPixel() const
SkImageInfo makeColorSpace(sk_sp< SkColorSpace > cs) const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
SkImageInfo makeColorType(SkColorType newColorType) const
std::shared_ptr< const fml::Mapping > data