Flutter Engine
The Flutter Engine
SkJPEGWriteUtility.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2010 The Android Open Source Project
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8
10
13
14#include <csetjmp>
15#include <cstddef>
16
17extern "C" {
18 #include "jerror.h" // NO_G3_REWRITE
19 #include "jpeglib.h" // NO_G3_REWRITE
20}
21
22///////////////////////////////////////////////////////////////////////////////
23
24static void sk_init_destination(j_compress_ptr cinfo) {
26
27 dest->next_output_byte = dest->fBuffer;
29}
30
31static boolean sk_empty_output_buffer(j_compress_ptr cinfo) {
33
34// if (!dest->fStream->write(dest->fBuffer, skjpeg_destination_mgr::kBufferSize - dest->free_in_buffer))
35 if (!dest->fStream->write(dest->fBuffer,
37 ERREXIT(cinfo, JERR_FILE_WRITE);
38 return FALSE;
39 }
40
41 dest->next_output_byte = dest->fBuffer;
43 return TRUE;
44}
45
46static void sk_term_destination (j_compress_ptr cinfo) {
48
49 size_t size = skjpeg_destination_mgr::kBufferSize - dest->free_in_buffer;
50 if (size > 0) {
51 if (!dest->fStream->write(dest->fBuffer, size)) {
52 ERREXIT(cinfo, JERR_FILE_WRITE);
53 return;
54 }
55 }
56
57 dest->fStream->flush();
58}
59
61 this->init_destination = sk_init_destination;
62 this->empty_output_buffer = sk_empty_output_buffer;
63 this->term_destination = sk_term_destination;
64}
65
66void skjpeg_error_exit(j_common_ptr cinfo) {
67 skjpeg_error_mgr* error = static_cast<skjpeg_error_mgr*>(cinfo->err);
68
69 (*error->output_message)(cinfo);
70
71 /* Let the memory manager delete any temp files before we die */
72 jpeg_destroy(cinfo);
73
74 if (error->fStack[0] == nullptr) {
75 SK_ABORT("JPEG error with no jmp_buf set.");
76 }
77 longjmp(*error->fStack[0], -1);
78}
#define SK_ABORT(message,...)
Definition: SkAssert.h:70
void skjpeg_error_exit(j_common_ptr cinfo)
static void sk_term_destination(j_compress_ptr cinfo)
static boolean sk_empty_output_buffer(j_compress_ptr cinfo)
static void sk_init_destination(j_compress_ptr cinfo)
if(end==-1)
const uint8_t uint32_t uint32_t GError ** error
return 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
Definition: switches.h:259
dest
Definition: zip.py:79
skjpeg_destination_mgr(SkWStream *stream)