27#include <initializer_list>
33 0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x03, 0x00, 0x03, 0x00, 0xe3, 0x08,
34 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00,
35 0xff, 0x80, 0x80, 0x80, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
36 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
37 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
38 0xff, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x04,
39 0x07, 0x50, 0x1c, 0x43, 0x40, 0x41, 0x23, 0x44, 0x00, 0x3b
44 0x47, 0x49, 0x46, 0x38, 0x39, 0x61,
46 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
48 0x21, 0xf9, 0x04, 0x01, 0x0a, 0x00, 0x01, 0x00,
50 0x2c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
52 0x02, 0x02, 0x4c, 0x01, 0x00,
58 0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x09, 0x00, 0x09, 0x00, 0xe3, 0x08, 0x00,
59 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0xff, 0x80,
60 0x80, 0x80, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff,
61 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
62 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00,
63 0x00, 0x09, 0x00, 0x09, 0x00, 0x40, 0x04, 0x1b, 0x50, 0x1c, 0x23, 0xe9, 0x44,
64 0x23, 0x60, 0x9d, 0x09, 0x28, 0x1e, 0xf8, 0x6d, 0x64, 0x56, 0x9d, 0x53, 0xa8,
65 0x7e, 0xa8, 0x65, 0x94, 0x5c, 0xb0, 0x8a, 0x45, 0x04, 0x00, 0x3b
171 unsigned char badData[
sizeof(
gGIFData)];
222 ERRORF(r,
"Invalid gInterlacedGIF data");
234 unsigned char data[83];
331 for (
int i = 21;
i < 24;
i++) {
342 ERRORF(r,
"Invalid data gave non-nullptr codec");
348 ERRORF(r,
"Failed to create codec with partial data (truncated at %d)",
i);
389 ERRORF(r,
"Missing image");
398 ERRORF(r,
"Failed to allocate pixels");
413 ERRORF(r,
"did not initialize pixels! %i, %i is %x",
i, j, actual);
423 const char*
path =
"images/out-of-palette.gif";
432 ERRORF(r,
"Could not create codec from %s",
path);
452 for (
auto& pixel : pixels) {
453 auto actual = bm.
getColor(pixel.x, pixel.y);
455 "pixel (%i,%i) mismatch! expected: %x actual: %x",
456 pixel.x, pixel.y, pixel.expected, actual);
467 const char*
path =
"images/gif-transparent-index.gif";
476 ERRORF(r,
"Could not create codec from %s",
path);
481 if ((
info.width() != 4) || (
info.height() != 2) || (codec->getFrameInfo().size() != 2)) {
482 ERRORF(r,
"Unexpected image info");
486 for (
bool use565 : {
false,
true }) {
490 for (
int i = 0;
i < 2;
i++) {
498 SkColor expectedPixels[2][4] = {
499 { 0xFF800000, 0xFF900000, 0xFFA00000, 0xFFB00000 },
500 { 0xFFC00000, 0xFFD00000, 0xFFE00000, 0xFFF00000 },
505 expectedPixels[0][0] = 0xFF840000;
506 expectedPixels[0][1] = 0xFF940000;
507 expectedPixels[0][2] = 0xFFA50000;
508 expectedPixels[0][3] = 0xFFB50000;
509 expectedPixels[1][0] = 0xFFC60000;
510 expectedPixels[1][1] = 0xFFD60000;
511 expectedPixels[1][2] = 0xFFE70000;
512 expectedPixels[1][3] = 0xFFF70000;
520 expectedPixels[1][1] = use565 ? 0xFF0000FF : 0xFF0000FF;
521 expectedPixels[1][3] = use565 ? 0xFF000052 : 0xFF000055;
524 for (
int y = 0;
y < 2;
y++) {
525 for (
int x = 0;
x < 4;
x++) {
526 auto expected = expectedPixels[
y][
x];
529 "use565 %i, frame %i, pixel (%i,%i) "
530 "mismatch! expected: %x actual: %x",
531 (
int)use565,
i,
x,
y, expected, actual);
546 const char*
path =
"images/xOffsetTooBig.gif";
555 ERRORF(r,
"Could not create codec from %s",
path);
561 auto info = codec->getInfo();
566 for (
int i = 0;
i < 2;
i++) {
bool decode_memory(const void *mem, size_t size, SkBitmap *bm)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static unsigned char gGIFDataNoColormap[]
static void test_gif_data_no_colormap(skiatest::Reporter *r, void *data, size_t size)
static void test_interlaced_gif_data(skiatest::Reporter *r, void *data, size_t size)
static unsigned char gInterlacedGIF[]
static void test_gif_data(skiatest::Reporter *r, void *data, size_t size)
static unsigned char gGIFData[]
static void test_gif_data_short(skiatest::Reporter *r, void *data, size_t size)
static void test_gif_data_dims(skiatest::Reporter *r, void *data, size_t size, int width, int height)
sk_sp< SkData > GetResourceAsData(const char *resource)
SkString GetResourcePath(const char *resource)
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
constexpr SkColor SK_ColorTRANSPARENT
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorWHITE
#define REPORTER_ASSERT(r, cond,...)
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
const SkImageInfo & info() const
uint32_t * getAddr32(int x, int y) const
bool tryAllocPixels(const SkImageInfo &info, size_t rowBytes)
void eraseColor(SkColor4f) const
static std::unique_ptr< SkCodec > MakeFromData(sk_sp< SkData >, SkSpan< const SkCodecs::Decoder > decoders, SkPngChunkReader *=nullptr)
static const char * ResultToString(Result)
static constexpr int kNoFrame
static sk_sp< SkData > MakeSubset(const SkData *src, size_t offset, size_t length)
bool readPixels(GrDirectContext *context, const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY, CachingHint cachingHint=kAllow_CachingHint) const
static SkColor PMColorToColor(SkPMColor c)
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
sk_sp< const SkImage > image
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
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
static SkImageInfo MakeN32Premul(int width, int height)
std::shared_ptr< const fml::Mapping > data