45 for (
const char* file : {
"images/color_wheel.webp",
48 "images/color_wheel.gif",
50 "images/google_chrome.ico",
51 "images/mandrill.wbmp",
52#ifdef SK_CODEC_DECODES_RAW
53 "images/sample_1mp.dng",
58 ERRORF(r,
"Could not get %s", file);
64 ERRORF(r,
"Could not create codec for %s", file);
68 const auto dims = codec->getInfo().dimensions();
73 { (int32_t) (dims.width() * .25f), (int32_t) (dims.height() * .75f ) },
78 { dims.
width(), dims.height() - 1 },
80 for (
SkISize size : downscales) {
81 const auto requested = size;
82 const int computedSampleSize = codec->computeSampleSize(&size);
87 }
else if (computedSampleSize == 1) {
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(),
95 size.width(), size.height());
98 size.height() >= requested.height());
100 size.height() < dims.height());
107 for (
SkISize size : upscales) {
108 const int computedSampleSize = codec->computeSampleSize(&size);
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,
129 size.width(), size.height());
170 const char* path =
"images/purple-displayprofile.png";
173 ERRORF(r,
"Missing file %s", path);
179 ERRORF(r,
"Failed to create codec from %s", path);
183 auto info = codec->getInfo();
184 auto cs = codec->computeOutputColorSpace(
info.colorType(),
nullptr);
186 ERRORF(r,
"%s should have a color space", path);
194 cs->toXYZD50(&matrix);
197 { 0.426254272f, 0.369018555f, 0.168914795f },
198 { 0.226013184f, 0.685974121f, 0.0880126953f },
199 { 0.0116729736f, 0.0950927734f, 0.71812439f },