Write a Multi Picture Format containing the |imageCount| images specified by |images|.
284 {
285 if (imageCount < 1) {
286 return true;
287 }
288
289
292 if (!primaryScan.
isDone()) {
293 SkCodecPrintf(
"Failed to scan encoded primary image header.\n");
294 return false;
295 }
296
297
298
299 size_t bytesRead = 0;
300 size_t bytesWritten = 0;
301 for (const auto& segment : primaryScan.getSegments()) {
302
303 {
304 size_t ecdBytesToWrite = segment.offset - bytesRead;
305 if (!
dst->write(images[0]->bytes() + bytesRead, ecdBytesToWrite)) {
307 return false;
308 }
309 bytesWritten += ecdBytesToWrite;
310 bytesRead = segment.offset;
311 }
312
313
316 if (!
dst->write(images[0]->bytes() + bytesRead, bytesToWrite)) {
318 return false;
319 }
320 bytesWritten += bytesToWrite;
321 bytesRead += bytesToWrite;
322 continue;
323 }
324
325
326 const size_t bytesRemaining =
images[0]->size() - bytesRead;
327
328
330 {
331 mpParams.
images.resize(imageCount);
335 static_cast<uint32_t>(bytesWritten + mpSegmentSize + bytesRemaining);
339 for (size_t i = 1; i < imageCount; ++i) {
341 mpParams.
images[i].size =
static_cast<uint32_t
>(
images[i]->size());
343 }
344 }
345
346
348 if (!
dst->write(mpfSegment->data(), mpfSegment->size())) {
350 return false;
351 }
352
353
354 if (!
dst->write(images[0]->bytes() + bytesRead, bytesRemaining)) {
355 SkCodecPrintf(
"Failed to write remainder of primary image.\n");
356 return false;
357 }
358 bytesRead += bytesRemaining;
360 break;
361 }
362
363
364 for (size_t i = 1; i < imageCount; ++i) {
365 if (!
dst->write(images[i]->data(), images[i]->size())) {
367 }
368 }
369 return true;
370}
static constexpr uint8_t kMpfSig[]
static constexpr uint8_t kJpegMarkerStartOfScan
static constexpr size_t kJpegSegmentParameterLengthSize
static constexpr size_t kJpegMarkerCodeSize
static sk_sp< SkData > get_mpf_segment(const SkJpegMultiPictureParameters &mpParams)
void onBytes(const void *data, size_t size)
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
sk_sp< SkData > serialize() const
std::vector< Image > images