44 {
45
46
48 return nullptr;
49 }
51 return nullptr;
52 }
56
57
58
59
60 bool littleEndian = false;
61 uint32_t ifdOffset = 0;
63 SkCodecPrintf(
"Failed to parse endian-ness and index IFD offset.\n");
64 return nullptr;
65 }
66
67
69 if (!ifd) {
71 return nullptr;
72 }
73
74
75
76 uint16_t tagCount = ifd->getNumEntries();
77
78
79 uint32_t numberOfImages = 0;
80
81
83
84
85
86 uint16_t previousTag = 0;
87 for (uint16_t idfEntryIndex = 0; idfEntryIndex < tagCount; ++idfEntryIndex) {
88 uint16_t tag = ifd->getEntryTag(idfEntryIndex);
89 if (previousTag >= tag) {
91 return nullptr;
92 }
93 previousTag = tag;
94
95 switch (tag) {
97
101 return nullptr;
102 }
105 return nullptr;
106 }
109 return nullptr;
110 }
111 break;
112 }
114
115 if (!ifd->getEntryUnsignedLong(idfEntryIndex, 1, &numberOfImages)) {
116 SkCodecPrintf(
"Number of Images was not 1 unsigned long.\n");
117 }
118 if (numberOfImages < 1) {
120 return nullptr;
121 }
122 break;
124
125 mpEntriesData = ifd->getEntryUndefinedData(idfEntryIndex);
126 if (!mpEntriesData) {
128 return nullptr;
129 }
131 SkCodecPrintf(
"MP entries data should be %ux%u bytes, was %u.\n",
133 numberOfImages,
134 static_cast<uint32_t
>(mpEntriesData->
size()));
135 return nullptr;
136 }
137 break;
138 }
140
141
142
146 return nullptr;
147 }
150 return nullptr;
151 }
152 break;
153 }
155
156 uint32_t totalNumCapturedFrames = 0;
157 if (!ifd->getEntryUnsignedLong(idfEntryIndex, 1, &totalNumCapturedFrames)) {
158 SkCodecPrintf(
"Total Number of Captures Frames was not 1 unsigned long.\n");
159 }
160 break;
161 }
162 default:
163 return nullptr;
164 }
165 }
166 if (!numberOfImages) {
167 SkCodecPrintf(
"Number of images must be greater than zero.\n");
168 return nullptr;
169 }
170 if (!mpEntriesData) {
172 return nullptr;
173 }
174
175
176 auto result = std::make_unique<SkJpegMultiPictureParameters>(numberOfImages);
177
178
179
180
181 for (uint32_t
i = 0;
i < numberOfImages; ++
i) {
183 const uint32_t attribute =
get_endian_int(mpEntryData + 0, littleEndian);
185 const uint32_t dataOffset =
get_endian_int(mpEntryData + 8, littleEndian);
186
187 const bool isPrimary =
189 const bool isJpeg =
191
192 if (isPrimary != (
i == 0)) {
193 SkCodecPrintf(
"Image must be primary iff it is the first image..\n");
194 return nullptr;
195 }
196 if (!isJpeg) {
198 return nullptr;
199 }
200
201 if (
i == 0 && dataOffset != 0) {
202 SkCodecPrintf(
"First individual Image offset must be NULL.\n");
203 return nullptr;
204 }
205
206 result->images[
i].dataOffset = dataOffset;
208 }
209
211}
static uint32_t get_endian_int(const uint8_t *data, bool littleEndian)
#define SkCodecPrintf(...)
static constexpr uint8_t kMpfSig[]
constexpr uint16_t kIndividualImageUniqueIDTag
constexpr uint8_t kVersionExpected[kVersionSize]
constexpr uint16_t kVersionTag
constexpr uint16_t kMPEntryTag
constexpr size_t kVersionSize
constexpr uint32_t kMPEntryAttributeFormatJpeg
constexpr uint32_t kMPEntryAttributeTypeMask
constexpr uint32_t kMPEntrySize
constexpr uint16_t kTotalNumberCapturedFramesTag
constexpr uint32_t kMPEntryAttributeFormatMask
constexpr uint32_t kMPEntryAttributeTypePrimary
constexpr uint16_t kNumberOfImagesTag
constexpr uint32_t kIndividualImageUniqueIDSize
const uint8_t * bytes() const
const void * data() const
static sk_sp< SkData > MakeSubset(const SkData *src, size_t offset, size_t length)
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)
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
std::shared_ptr< const fml::Mapping > data