40static bool approx_eq(
float x,
float y,
float epsilon) {
44 if (numerator / denominator > epsilon) {
55template <
typename Reporter>
69 if (
a.fGainmapMathColorSpace) {
72 a.fGainmapMathColorSpace->transferFn(&a_fn);
73 a.fGainmapMathColorSpace->toXYZD50(&a_m);
76 b.fGainmapMathColorSpace->transferFn(&b_fn);
77 b.fGainmapMathColorSpace->toXYZD50(&b_m);
89 const float kMatrixEpsilon = 1e-2f;
90 for (
int i = 0;
i < 3; ++
i) {
91 for (
int j = 0; j < 3; ++j) {
108 , fSeekable(
type !=
Type::kUnseekable)
109 , fMemoryMapped(
type ==
Type::kMemoryMapped) {}
110 ~TestStream()
override {}
114 bool isAtEnd()
const override {
return fStream->isAtEnd(); }
119 return fStream->rewind();
125 return fStream->hasPosition();
131 return fStream->hasPosition();
133 bool seek(
size_t position)
override {
137 return fStream->seek(position);
143 return fStream->move(
offset);
146 if (!fMemoryMapped) {
149 return fStream->hasLength();
152 if (!fMemoryMapped) {
155 return fStream->getLength();
158 if (!fMemoryMapped) {
161 return fStream->getMemoryBase();
166 bool fSeekable =
false;
167 bool fMemoryMapped =
false;
175 size_t sosSegmentCount;
176 size_t eoiSegmentCount;
177 size_t testSegmentIndex;
178 uint8_t testSegmentMarker;
179 size_t testSegmentOffset;
180 uint16_t testSegmentParameterLength;
182 {
"images/wide_gamut_yellow_224_224_64.jpeg", 11, 15, 10, 0xda, 9768, 12},
183 {
"images/CMYK.jpg", 7, 8, 1, 0xee, 2, 14},
184 {
"images/b78329453.jpeg", 10, 23, 3, 0xe2, 154, 540},
185 {
"images/brickwork-texture.jpg", 8, 28, 12, 0xc4, 34183, 42},
186 {
"images/brickwork_normal-map.jpg", 8, 28, 27, 0xd9, 180612, 0},
187 {
"images/cmyk_yellow_224_224_32.jpg", 19, 23, 2, 0xed, 854, 2828},
188 {
"images/color_wheel.jpg", 10, 11, 2, 0xdb, 20, 67},
189 {
"images/cropped_mandrill.jpg", 10, 11, 4, 0xc0, 158, 17},
190 {
"images/dog.jpg", 10, 11, 5, 0xc4, 177, 28},
191 {
"images/ducky.jpg", 12, 13, 10, 0xc4, 3718, 181},
192 {
"images/exif-orientation-2-ur.jpg", 11, 12, 2, 0xe1, 20, 130},
193 {
"images/flutter_logo.jpg", 9, 27, 21, 0xda, 5731, 8},
194 {
"images/grayscale.jpg", 6, 16, 9, 0xda, 327, 8},
195 {
"images/icc-v2-gbr.jpg", 12, 25, 24, 0xd9, 43832, 0},
196 {
"images/mandrill_512_q075.jpg", 10, 11, 7, 0xc4, 393, 31},
197 {
"images/mandrill_cmyk.jpg", 19, 35, 16, 0xdd, 574336, 4},
198 {
"images/mandrill_h1v1.jpg", 10, 11, 1, 0xe0, 2, 16},
199 {
"images/mandrill_h2v1.jpg", 10, 11, 0, 0xd8, 0, 0},
200 {
"images/randPixels.jpg", 10, 11, 6, 0xc4, 200, 30},
201 {
"images/wide_gamut_yellow_224_224_64.jpeg", 11, 15, 10, 0xda, 9768, 12},
204 for (
const auto& rec : recs) {
212 const auto& segments = sourceMgr->getAllSegments();
218 for (
size_t i = 0;
i < segments.size(); ++
i) {
226 const auto& segment = segments[rec.testSegmentIndex];
229 REPORTER_ASSERT(r, rec.testSegmentParameterLength == segment.parameterLength);
234 std::unique_ptr<SkJpegMultiPictureParameters>* outMpParams,
237 for (
const auto& segment : sourceMgr->getAllSegments()) {
241 auto parameterData = sourceMgr->getSegmentParameters(segment);
242 if (!parameterData) {
247 *outMpParamsSegment = segment;
257 const uint8_t bytes[] = {
258 0x4d, 0x50, 0x46, 0x00, 0x49, 0x49, 0x2a, 0x00, 0x08, 0x00, 0x00, 0x00, 0x03,
259 0x00, 0x00, 0xb0, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x30, 0x31, 0x30, 0x30,
260 0x01, 0xb0, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02,
261 0xb0, 0x07, 0x00, 0x20, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00,
262 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x20, 0xcf, 0x49, 0x00, 0x00, 0x00, 0x00,
263 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0x28, 0x01, 0x00,
264 0xf9, 0xb7, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00,
278 const uint8_t bytes[] = {
279 0x4d, 0x50, 0x46, 0x00, 0x4d, 0x4d, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x08, 0x00,
280 0x03, 0xb0, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x30, 0x31, 0x30, 0x30,
281 0xb0, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0xb0,
282 0x02, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00,
283 0x00, 0x00, 0x20, 0x03, 0x00, 0x00, 0x00, 0x56, 0xda, 0x2f, 0x00, 0x00, 0x00,
284 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0xc6, 0x01,
285 0x00, 0x55, 0x7c, 0x1f, 0x00, 0x00, 0x00, 0x00,
299 const uint8_t bytes[] = {
300 0x4d, 0x50, 0x46, 0x00, 0x4d, 0x4d, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x08, 0x00,
301 0x03, 0xb0, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x30, 0x31, 0x30, 0x30,
302 0xb0, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0xb0,
303 0x02, 0x00, 0x07, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00,
304 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1f, 0x1c, 0xc2, 0x00, 0x00, 0x00,
305 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x05, 0xb0,
306 0x00, 0x1f, 0x12, 0xec, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
307 0x00, 0x96, 0x6b, 0x00, 0x22, 0x18, 0x9c, 0x00, 0x00, 0x00, 0x00,
323 const uint8_t bytes[] = {
324 0x4d, 0x50, 0x46, 0x00,
325 0x4d, 0x4d, 0x00, 0x2a,
326 0x00, 0x00, 0x00, 0x08,
330 0x00, 0x00, 0x00, 0x04,
331 0x30, 0x31, 0x30, 0x30,
334 0x00, 0x00, 0x00, 0x01,
335 0x00, 0x00, 0x00, 0x02,
338 0x00, 0x00, 0x00, 0x20,
339 0x00, 0x00, 0x00, 0x32,
340 0x00, 0x00, 0x00, 0x00,
341 0x20, 0x03, 0x00, 0x00,
342 0x00, 0x56, 0xda, 0x2f,
343 0x00, 0x00, 0x00, 0x00,
344 0x00, 0x00, 0x00, 0x00,
345 0x00, 0x00, 0x00, 0x00,
346 0x00, 0x14, 0xc6, 0x01,
347 0x00, 0x55, 0x7c, 0x1f,
348 0x00, 0x00, 0x00, 0x00,
362 reinterpret_cast<uint8_t*
>(bytesInvalid->writable_data())[25] =
'1';
370 reinterpret_cast<uint8_t*
>(bytesInvalid->writable_data())[29] = 0x07;
378 reinterpret_cast<uint8_t*
>(bytesInvalid->writable_data())[49] = 0xFE;
386 reinterpret_cast<uint8_t*
>(bytesInvalid->writable_data())[45] = 0x1F;
393 const char*
path =
"images/iphone_13_pro.jpeg";
398 std::unique_ptr<SkJpegMultiPictureParameters> mpParams;
404 auto mpParamsSerialized = mpParams->serialize(0);
408 REPORTER_ASSERT(r, mpParamsRoundTripped->images.size() == mpParams->images.size());
409 for (
size_t i = 0;
i < mpParamsRoundTripped->images.size(); ++
i) {
410 REPORTER_ASSERT(r, mpParamsRoundTripped->images[
i].size == mpParams->images[
i].size);
413 mpParamsRoundTripped->images[
i].dataOffset == mpParams->images[
i].dataOffset);
418 const TestStream::Type streamType;
419 const bool skipFirstImage;
420 const size_t bufferSize;
422 {TestStream::Type::kMemoryMapped,
false, 1024},
423 {TestStream::Type::kMemoryMapped,
true, 1024},
424 {TestStream::Type::kSeekable,
false, 1024},
425 {TestStream::Type::kSeekable,
true, 1024},
426 {TestStream::Type::kSeekable,
false, 7},
427 {TestStream::Type::kSeekable,
true, 13},
428 {TestStream::Type::kSeekable,
true, 1024 * 1024 * 16},
429 {TestStream::Type::kUnseekable,
false, 1024},
430 {TestStream::Type::kUnseekable,
true, 1024},
431 {TestStream::Type::kUnseekable,
false, 1},
432 {TestStream::Type::kUnseekable,
true, 1},
433 {TestStream::Type::kUnseekable,
false, 7},
434 {TestStream::Type::kUnseekable,
true, 13},
435 {TestStream::Type::kUnseekable,
false, 1024 * 1024 * 16},
436 {TestStream::Type::kUnseekable,
true, 1024 * 1024 * 16},
438 for (
const auto& rec : recs) {
440 TestStream testStream(rec.streamType,
stream.get());
444 size_t numberOfImages = mpParams->images.size();
445 std::vector<SkBitmap> bitmaps(numberOfImages);
446 for (
size_t i = 0;
i < numberOfImages; ++
i) {
451 if (
i == 1 && rec.skipFirstImage) {
454 auto imageData = sourceMgr->getSubsetData(
456 mpParams->images[
i].dataOffset, mpParamsSegment.
offset),
457 mpParams->images[
i].size);
460 std::unique_ptr<SkCodec> codec =
473 if (!rec.skipFirstImage) {
485template <
typename Reporter>
487 std::unique_ptr<SkStream>
stream,
500 std::unique_ptr<SkAndroidCodec> androidCodec =
505 std::unique_ptr<SkStream> gainmapStream;
506 REPORTER_ASSERT(r, androidCodec->getAndroidGainmap(&gainmapInfo, &gainmapStream));
514 gainmapBitmap.
allocPixels(gainmapCodec->getInfo());
529 {
"images/iphone_13_pro.jpeg",
533 {{1.f, 1.f, 1.f, 1.f},
534 {3.482202f, 3.482202f, 3.482202f, 1.f},
535 {1.f, 1.f, 1.f, 1.f},
536 {0.f, 0.f, 0.f, 1.f},
537 {0.f, 0.f, 0.f, 1.f},
543 {
"images/iphone_15.jpeg",
547 {{1.f, 1.f, 1.f, 1.f},
548 {3.755272f, 3.755272f, 3.755272f, 1.f},
549 {1.f, 1.f, 1.f, 1.f},
550 {0.f, 0.f, 0.f, 1.f},
551 {0.f, 0.f, 0.f, 1.f},
557 {
"images/gainmap_gcontainer_only.jpg",
561 {{25.f, 0.5f, 1.f, 1.f},
562 {2.f, 4.f, 8.f, 1.f},
563 {0.5, 1.f, 2.f, 1.f},
564 {0.01f, 0.001f, 0.0001f, 1.f},
565 {0.0001f, 0.001f, 0.01f, 1.f},
571 {
"images/gainmap_iso21496_1_adobe_gcontainer.jpg",
575 {{25.f, 0.5f, 1.f, 1.f},
576 {2.f, 4.f, 8.f, 1.f},
577 {0.5, 1.f, 2.f, 1.f},
578 {0.01f, 0.001f, 0.0001f, 1.f},
579 {0.0001f, 0.001f, 0.01f, 1.f},
585 {
"images/gainmap_iso21496_1.jpg",
589 {{25.f, 0.5f, 1.f, 1.f},
590 {2.f, 4.f, 8.f, 1.f},
591 {0.5, 1.f, 2.f, 1.f},
592 {0.01f, 0.001f, 0.0001f, 1.f},
593 {0.0001f, 0.001f, 0.01f, 1.f},
601 TestStream::Type kStreamTypes[] = {
602 TestStream::Type::kUnseekable,
603 TestStream::Type::kSeekable,
604 TestStream::Type::kMemoryMapped,
606 for (
const auto& streamType : kStreamTypes) {
607 bool useFileStream = streamType != TestStream::Type::kMemoryMapped;
608 for (
const auto& rec : recs) {
611 auto testStream = std::make_unique<TestStream>(streamType,
stream.get());
616 decode_all(r, std::move(testStream), baseBitmap, gainmapBitmap, gainmapInfo);
623 gainmapBitmap.
getColor(rec.dimensions.fWidth - 1, rec.dimensions.fHeight - 1) ==
627 expect_approx_eq_info(r, rec.info, gainmapInfo);
635 const char*
path =
"images/icc-v2-gbr.jpg";
637 TestStream::Type kStreamTypes[] = {
638 TestStream::Type::kUnseekable,
639 TestStream::Type::kSeekable,
640 TestStream::Type::kMemoryMapped,
642 for (
const auto& streamType : kStreamTypes) {
643 bool useFileStream = streamType != TestStream::Type::kMemoryMapped;
646 auto testStream = std::make_unique<TestStream>(streamType,
stream.get());
650 std::unique_ptr<SkCodec> baseCodec =
660 std::unique_ptr<SkAndroidCodec> androidCodec =
666 std::unique_ptr<SkStream> gainmapStream;
667 REPORTER_ASSERT(r, !androidCodec->getAndroidGainmap(&gainmapInfo, &gainmapStream));
671#if !defined(SK_ENABLE_NDK_IMAGES)
676 constexpr size_t kNumTests = 4;
691 {{1.f, 2.f, 4.f, 1.f},
692 {8.f, 16.f, 32.f, 1.f},
693 {64.f, 128.f, 256.f, 1.f},
694 {1 / 10.f, 1 / 11.f, 1 / 12.f, 1.f},
695 {1 / 13.f, 1 / 14.f, 1 / 15.f, 1.f},
702 {{1.f, 2.f, 4.f, 1.f},
703 {8.f, 16.f, 32.f, 1.f},
704 {64.f, 128.f, 256.f, 1.f},
705 {1 / 10.f, 1 / 11.f, 1 / 12.f, 1.f},
706 {1 / 13.f, 1 / 14.f, 1 / 15.f, 1.f},
713 {{1.f, 1.f, 1.f, 1.f},
714 {8.f, 8.f, 8.f, 1.f},
715 {64.f, 64.f, 64.f, 1.f},
716 {1 / 128.f, 1 / 128.f, 1 / 128.f, 1.f},
717 {1 / 256.f, 1 / 256.f, 1 / 256.f, 1.f},
724 {{1.f, 1.f, 1.f, 1.f},
725 {8.f, 8.f, 8.f, 1.f},
726 {64.f, 64.f, 64.f, 1.f},
727 {1 / 128.f, 1 / 128.f, 1 / 128.f, 1.f},
728 {1 / 256.f, 1 / 256.f, 1 / 256.f, 1.f},
736 for (
size_t i = 0;
i < kNumTests; ++
i) {
750 auto decodeStream = std::make_unique<SkMemoryStream>(encodeStream.
detachAsData());
752 std::move(decodeStream),
754 decodedGainmapBitmap,
758 expect_approx_eq_info(r, infos[
i], decodedGainmapInfo);
764 float renderHdrRatio,
772 float scaleX = gainmapBitmap.
width() /
static_cast<float>(baseBitmap.
width());
773 float scaleY = gainmapBitmap.
height() /
static_cast<float>(baseBitmap.
height());
775 baseRect.
y() * scaleY,
776 baseRect.
width() * scaleX,
777 baseRect.
height() * scaleY);
795 result.allocPixels(renderInfo);
800 paint.setShader(shader);
820 testPixelInfo, renderHdrRatio, baseBitmap, gainmapBitmap, gainmapInfo,
x,
y);
825 const char*
path =
"images/iphone_13_pro.jpeg";
843 baseBitmap[0].pixmap(),
845 gainmapBitmap[0].pixmap(),
852 auto decodeStream = std::make_unique<SkMemoryStream>(encodeData);
853 decode_all(r, std::move(decodeStream), baseBitmap[1], gainmapBitmap[1], gainmapInfo[1]);
856 expect_approx_eq_info(r, gainmapInfo[0], gainmapInfo[1]);
873 for (
const auto& rec : recs) {
881 gainmapBitmap0 = gainmapBitmap[0];
885 .makeColorType(rec.forcedColorType)
891 rec.hdrRatio, baseBitmap[0], gainmapBitmap0, gainmapInfo[0], rec.x, rec.y);
893 rec.hdrRatio, baseBitmap[1], gainmapBitmap[1], gainmapInfo[1], rec.x, rec.y);
904 std::unique_ptr<SkJpegMultiPictureParameters> mpParams;
912 mpParams->images[imageNumber].dataOffset, mpParamsSegment.
offset),
913 mpParams->images[imageNumber].size);
916static std::unique_ptr<SkTiff::ImageFileDirectory>
get_ifd(
920 for (
const auto& segment : sourceMgr->getAllSegments()) {
921 if (segment.marker !=
marker) {
924 auto parameterData = sourceMgr->getSegmentParameters(segment);
925 if (!parameterData) {
928 if (parameterData->size() < sigSize || memcmp(sig, parameterData->data(), sigSize) != 0) {
932 parameterData.get(), sigSize + pad, parameterData->size() - (sigSize + pad));
934 bool littleEndian =
false;
935 uint32_t ifdOffset = 0;
990 std::make_unique<SkMemoryStream>(inputData),
1051 const uint8_t versionData[] = {
1057 const uint8_t
data[] = {
1061 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1062 0x00, 0x01, 0x45, 0x3e, 0x00, 0x00, 0x80, 0x00,
1063 0xfc, 0x23, 0x05, 0x14, 0x40, 0x00, 0x00, 0x00,
1064 0x00, 0x01, 0x1f, 0xe1, 0x00, 0x00, 0x80, 0x00,
1065 0x10, 0x4b, 0x9f, 0x0a, 0x40, 0x00, 0x00, 0x00,
1066 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
1067 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
1068 0xfd, 0xdb, 0x68, 0x04, 0x40, 0x00, 0x00, 0x00,
1069 0x00, 0x01, 0x11, 0x68, 0x00, 0x00, 0x80, 0x00,
1070 0x10, 0x28, 0xf9, 0x53, 0x40, 0x00, 0x00, 0x00,
1071 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
1072 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
1073 0xf7, 0x16, 0x7b, 0x90, 0x40, 0x00, 0x00, 0x00,
1074 0x00, 0x01, 0x0f, 0x9a, 0x00, 0x00, 0x80, 0x00,
1075 0x12, 0x95, 0xa8, 0x3f, 0x40, 0x00, 0x00, 0x00,
1076 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
1077 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
1079 SkGainmapInfo kExpectedInfo = {{0.959023f, 0.977058f, 0.907989f, 1.f},
1080 {4.753710f, 4.395375f, 4.352630f, 1.f},
1081 {3.927490f, 3.960382f, 3.443712f, 1.f},
1082 {0.015625f, 0.015625f, 0.015625f, 1.f},
1083 {0.015625f, 0.015625f, 0.015625f, 1.f},
1089 SkGainmapInfo kSingleChannelInfo = {{0.1234567e-4f, 0.1234567e-4f, 0.1234567e-4f, 1.f},
1090 {-0.1234567e-4f, -0.1234567e-4f, -0.1234567e-4f, 1.f},
1091 {0.1234567e+0f, 0.1234567e+0f, 0.1234567e+0f, 1.f},
1092 {0.1234567e+4f, 0.1234567e+4f, 0.1234567e+4f, 1.f},
1093 {0.1234567e+4f, 0.1234567e+4f, 0.1234567e+4f, 1.f},
1109 expect_approx_eq_info(r,
info, kExpectedInfo);
1115 auto dataInfo =
info.serialize();
1118 expect_approx_eq_info(r,
info, infoRoundTrip);
1121 auto dataSingleChannelInfo = kSingleChannelInfo.
serialize();
1126 expect_approx_eq_info(r, singleChannelInfoRoundTrip, kSingleChannelInfo);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static bool approx_eq(float x, float y, float epsilon)
static sk_sp< SkData > get_mp_image(sk_sp< SkData > imageData, size_t imageNumber)
DEF_TEST(Codec_jpegSegmentScan, r)
void decode_all(Reporter &r, std::unique_ptr< SkStream > stream, SkBitmap &baseBitmap, SkBitmap &gainmapBitmap, SkGainmapInfo &gainmapInfo)
static SkBitmap render_gainmap(const SkImageInfo &renderInfo, float renderHdrRatio, const SkBitmap &baseBitmap, const SkBitmap &gainmapBitmap, const SkGainmapInfo &gainmapInfo, int x, int y)
static bool find_mp_params_segment(SkStream *stream, std::unique_ptr< SkJpegMultiPictureParameters > *outMpParams, SkJpegSegment *outMpParamsSegment)
static std::unique_ptr< SkTiff::ImageFileDirectory > get_exif_ifd(sk_sp< SkData > imageData)
static SkColor4f render_gainmap_pixel(float renderHdrRatio, const SkBitmap &baseBitmap, const SkBitmap &gainmapBitmap, const SkGainmapInfo &gainmapInfo, int x, int y)
static std::unique_ptr< SkTiff::ImageFileDirectory > get_ifd(sk_sp< SkData > imageData, uint8_t marker, const void *sig, size_t sigSize, size_t pad)
static std::unique_ptr< SkTiff::ImageFileDirectory > get_mpf_ifd(sk_sp< SkData > imageData)
static const char marker[]
std::unique_ptr< SkStreamAsset > GetResourceAsStream(const char *resource, bool useFileStream)
sk_sp< SkData > GetResourceAsData(const char *resource)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ 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
@ kUnknown_SkColorType
uninitialized
constexpr SkColor SK_ColorTRANSPARENT
static constexpr double kEpsilon
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static constexpr uint32_t kExifMarker
static constexpr uint32_t kMpfMarker
static constexpr uint8_t kMpfSig[]
static constexpr uint8_t kJpegMarkerStartOfScan
constexpr uint8_t kExifSig[]
#define REPORTER_ASSERT(r, cond,...)
static std::unique_ptr< SkAndroidCodec > MakeFromCodec(std::unique_ptr< SkCodec >)
void allocPixels(const SkImageInfo &info, size_t rowBytes)
bool installPixels(const SkImageInfo &info, void *pixels, size_t rowBytes, void(*releaseProc)(void *addr, void *context), void *context)
SkISize dimensions() const
SkColor getColor(int x, int y) const
const SkPixmap & pixmap() const
SkColor4f getColor4f(int x, int y) const
const SkImageInfo & info() const
void drawRect(const SkRect &rect, const SkPaint &paint)
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, SkSpan< const SkCodecs::Decoder > decoders, Result *=nullptr, SkPngChunkReader *=nullptr, SelectionPolicy selectionPolicy=SelectionPolicy::kPreferStillImage)
static sk_sp< SkColorSpace > MakeSRGB()
static sk_sp< SkColorSpace > MakeRGB(const skcms_TransferFunction &transferFn, const skcms_Matrix3x3 &toXYZ)
static sk_sp< SkData > MakeWithoutCopy(const void *data, size_t length)
const uint8_t * bytes() const
static sk_sp< SkData > MakeWithCopy(const void *data, size_t length)
static sk_sp< SkData > MakeSubset(const SkData *src, size_t offset, size_t length)
sk_sp< SkData > detachAsData()
static sk_sp< SkShader > Make(const sk_sp< const SkImage > &baseImage, const SkRect &baseRect, const SkSamplingOptions &baseSamplingOptions, const sk_sp< const SkImage > &gainmapImage, const SkRect &gainmapRect, const SkSamplingOptions &gainmapSamplingOptions, const SkGainmapInfo &gainmapInfo, const SkRect &dstRect, float dstHdrRatio, sk_sp< SkColorSpace > dstColorSpace)
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, Result *)
static bool EncodeHDRGM(SkWStream *dst, const SkPixmap &base, const SkJpegEncoder::Options &baseOptions, const SkPixmap &gainmap, const SkJpegEncoder::Options &gainmapOptions, const SkGainmapInfo &gainmapInfo)
static std::unique_ptr< SkJpegSourceMgr > Make(SkStream *stream, size_t bufferSize=1024)
static std::unique_ptr< SkMemoryStream > Make(sk_sp< SkData > data)
virtual size_t peek(void *, size_t) const
virtual bool hasPosition() const
virtual size_t getPosition() const
virtual bool isAtEnd() const =0
virtual bool seek(size_t)
virtual size_t getLength() const
virtual const void * getMemoryBase()
virtual bool hasLength() const
virtual size_t read(void *buffer, size_t size)=0
static bool ParseHeader(const SkData *data, bool *outLittleEndian, uint32_t *outIfdOffset)
static std::unique_ptr< ImageFileDirectory > MakeFromOffset(sk_sp< SkData > data, bool littleEndian, uint32_t ifdOffset, bool allowTruncated=false)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
constexpr uint16_t kSubIFDOffsetTag
SK_API sk_sp< SkImage > RasterFromBitmap(const SkBitmap &bitmap)
static constexpr skcms_Matrix3x3 kRec2020
static constexpr skcms_Matrix3x3 kDisplayP3
static constexpr skcms_TransferFunction kSRGB
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 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
const myers::Point & get(const myers::Segment &)
SkSamplingOptions(SkFilterMode::kLinear))
SIN Vec< N, float > abs(const Vec< N, float > &x)
sk_sp< SkData > serialize() const
static bool ParseVersion(const SkData *data)
static bool Parse(const SkData *data, SkGainmapInfo &info)
static sk_sp< SkData > SerializeVersion()
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo MakeN32Premul(int width, int height)
sk_sp< SkColorSpace > refColorSpace() const
SkISize dimensions() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static size_t GetImageAbsoluteOffset(uint32_t dataOffset, size_t mpSegmentOffset)
static std::unique_ptr< SkJpegMultiPictureParameters > Make(const sk_sp< const SkData > &segmentParameters)
static SkRect Make(const SkISize &size)
constexpr float x() const
constexpr float y() const
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
constexpr float height() const
constexpr float width() const
std::shared_ptr< const fml::Mapping > data