25#include <initializer_list>
30 return { (
int) (
size.width() * factor), (
int) (
size.height() * factor) };
34 return {
size.width() + term,
size.height() + term };
38 return size.width() < 1 ||
size.height() < 1;
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",
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 },
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(),
98 size.height() >= requested.height());
100 size.height() < dims.height());
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,
140 const char*
path =
"images/wide-gamut.png";
149 ERRORF(r,
"Failed to create codec from %s",
path);
153 auto info = codec->getInfo();
154 auto cs = codec->computeOutputColorSpace(
info.colorType(),
nullptr);
156 ERRORF(r,
"%s should have a color space",
path);
170 const char*
path =
"images/purple-displayprofile.png";
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);
197 { 0.426254272f, 0.369018555f, 0.168914795f },
198 { 0.226013184f, 0.685974121f, 0.0880126953f },
199 { 0.0116729736f, 0.0950927734f, 0.71812439f },
209 const char*
path =
"images/red-hlg-profile.png";
218 ERRORF(r,
"Failed to create codec from %s",
path);
222 auto info = codec->getInfo();
223 auto cs = codec->computeOutputColorSpace(
info.colorType(),
nullptr);
225 ERRORF(r,
"%s should have a color space",
path);
245 const char*
path =
"images/red-pq-profile.png";
254 ERRORF(r,
"Failed to create codec from %s",
path);
258 auto info = codec->getInfo();
259 auto cs = codec->computeOutputColorSpace(
info.colorType(),
nullptr);
261 ERRORF(r,
"%s should have a color space",
path);
DEF_TEST(AndroidCodec_computeSampleSize, r)
static SkISize plus(const SkISize &size, int term)
static bool invalid(const SkISize &size)
static SkISize times(const SkISize &size, float factor)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
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)
static bool Equals(const SkColorSpace *, const SkColorSpace *)
static sk_sp< SkColorSpace > MakeSRGB()
static constexpr skcms_Matrix3x3 kRec2020
unsigned useCenter Optional< SkMatrix > matrix
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
bool skcms_TransferFunction_isHLGish(const skcms_TransferFunction *tf)
bool skcms_TransferFunction_isPQish(const skcms_TransferFunction *tf)
constexpr int32_t width() const
constexpr int32_t height() const
std::shared_ptr< const fml::Mapping > data