263 {
264
265 if (srcYUVA) {
268 return nullptr;
269 }
270 } else {
273 return nullptr;
274 }
275 }
276
278
280 if (setjmp(jmp)) {
281 return nullptr;
282 }
283
284 if (srcYUVA) {
286 return nullptr;
287 }
288 } else {
289 if (!encoderMgr->setParams(
src->info(),
options)) {
290 return nullptr;
291 }
292 }
293
294 jpeg_set_quality(encoderMgr->cinfo(),
options.fQuality,
TRUE);
295 jpeg_start_compress(encoderMgr->cinfo(),
TRUE);
296
297
298
303 auto data =
s.detachAsData();
305 }
306
307
308
309
312 options.fICCProfileDescription);
313 if (icc) {
314
316 uint8_t* ptr = (uint8_t*)markerData->writable_data();
319 *ptr++ = 1;
320 *ptr++ = 1;
321 memcpy(ptr, icc->data(), icc->size());
322
323 jpeg_write_marker(encoderMgr->cinfo(),
kICCMarker, markerData->bytes(), markerData->size());
324 }
325
326 if (srcYUVA) {
327 return std::make_unique<SkJpegEncoderImpl>(std::move(encoderMgr), srcYUVA);
328 }
329 return std::make_unique<SkJpegEncoderImpl>(std::move(encoderMgr), *src);
330}
static sk_sp< SkData > icc_from_color_space(const SkColorSpace *cs, const skcms_ICCProfile *profile, const char *profile_description)
static bool SkPixmapIsValid(const SkPixmap &src)
static constexpr uint8_t kICCSig[]
static constexpr uint32_t kICCMarker
static constexpr uint32_t kXMPMarker
static constexpr uint8_t kXMPStandardSig[]
static constexpr uint32_t kICCMarkerHeaderSize
static sk_sp< SkData > MakeUninitialized(size_t length)
static std::unique_ptr< SkJpegEncoderMgr > Make(SkWStream *stream)
SkYUVAPixmapInfo pixmapsInfo() const
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data