41 {
43 return;
44 }
45 for (const char* file : { "images/color_wheel.webp",
46 "images/ship.png",
47 "images/dog.jpg",
48 "images/color_wheel.gif",
49 "images/rle.bmp",
50 "images/google_chrome.ico",
51 "images/mandrill.wbmp",
52#ifdef SK_CODEC_DECODES_RAW
53 "images/sample_1mp.dng",
54#endif
55 }) {
57 if (!data) {
58 ERRORF(r,
"Could not get %s", file);
59 continue;
60 }
61
63 if (!codec) {
64 ERRORF(r,
"Could not create codec for %s", file);
65 continue;
66 }
67
68 const auto dims = codec->getInfo().dimensions();
73 { (int32_t) (dims.width() * .25f), (int32_t) (dims.height() * .75f ) },
74 { 1, 1 },
75 { 1, 2 },
76 { 2, 1 },
77 { 0, -1 },
78 { dims.
width(), dims.height() - 1 },
79 };
80 for (
SkISize size : downscales) {
81 const auto requested =
size;
82 const int computedSampleSize = codec->computeSampleSize(&size);
85
87 } else if (computedSampleSize == 1) {
89 } else {
91 if (
size.width() >= dims.width() ||
size.height() >= dims.height()) {
92 ERRORF(r,
"File %s's computed sample size (%i) is bigger than"
93 " original? original: %i x %i\tsampled: %i x %i",
94 file, computedSampleSize, dims.width(), dims.height(),
96 }
98 size.height() >= requested.height());
100 size.height() < dims.height());
101 }
102 }
103
106 };
107 for (
SkISize size : upscales) {
108 const int computedSampleSize = codec->computeSampleSize(&size);
111 }
112
113
114
115
116
117
118
119 for (int sampleSize : { 1, 2, 3, 4, 8, 16, 32 }) {
120 const SkISize sampledDims = codec->getSampledDimensions(sampleSize);
122 const int computedSampleSize = codec->computeSampleSize(&size);
123 if (sampledDims != size) {
124 ERRORF(r,
"File '%s'->getSampledDimensions(%i) yields computed"
125 " sample size of %i\n\tsampledDimensions: %i x %i\t"
126 "computed dimensions: %i x %i",
127 file, sampleSize, computedSampleSize,
130 }
131 }
132 }
133}
static SkISize plus(const SkISize &size, int term)
static bool invalid(const SkISize &size)
static SkISize times(const SkISize &size, float factor)
sk_sp< SkData > GetResourceAsData(const char *resource)
SkString GetResourcePath(const char *resource)
#define REPORTER_ASSERT(r, cond,...)
static std::unique_ptr< SkAndroidCodec > MakeFromCodec(std::unique_ptr< SkCodec >)
static std::unique_ptr< SkCodec > MakeFromData(sk_sp< SkData >, SkSpan< const SkCodecs::Decoder > decoders, SkPngChunkReader *=nullptr)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
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 width() const
constexpr int32_t height() const