#include "src/codec/SkJpegUtility.h"
#include "include/core/SkStream.h"
#include "include/core/SkTypes.h"
#include "src/codec/SkCodecPriv.h"
#include "src/codec/SkJpegPriv.h"
#include <csetjmp>
#include <cstddef>
#include "jpeglib.h"
Go to the source code of this file.
◆ sk_fill_buffered_input_buffer()
static boolean sk_fill_buffered_input_buffer |
( |
j_decompress_ptr |
dinfo | ) |
|
|
static |
Definition at line 50 of file SkJpegUtility.cpp.
50 {
53
54
55 if (bytes == 0) {
56
57 src->next_input_byte =
nullptr;
58 src->bytes_in_buffer = 0;
59 return false;
60 }
61
62 src->next_input_byte = (
const JOCTET*)
src->fBuffer;
63 src->bytes_in_buffer = bytes;
64 return true;
65}
◆ sk_fill_mem_input_buffer()
static boolean sk_fill_mem_input_buffer |
( |
j_decompress_ptr |
cinfo | ) |
|
|
static |
◆ sk_init_buffered_source()
static void sk_init_buffered_source |
( |
j_decompress_ptr |
dinfo | ) |
|
|
static |
Definition at line 41 of file SkJpegUtility.cpp.
41 {
43 src->next_input_byte = (
const JOCTET*)
src->fBuffer;
44 src->bytes_in_buffer = 0;
45}
◆ sk_init_mem_source()
static void sk_init_mem_source |
( |
j_decompress_ptr |
dinfo | ) |
|
|
static |
◆ sk_skip_buffered_input_data()
static void sk_skip_buffered_input_data |
( |
j_decompress_ptr |
dinfo, |
|
|
long |
numBytes |
|
) |
| |
|
static |
Definition at line 70 of file SkJpegUtility.cpp.
70 {
72 size_t bytes = (size_t) numBytes;
73
74 if (bytes >
src->bytes_in_buffer) {
75 size_t bytesToSkip = bytes -
src->bytes_in_buffer;
76 if (bytesToSkip !=
src->fStream->skip(bytesToSkip)) {
78 dinfo->err->error_exit((j_common_ptr) dinfo);
79 return;
80 }
81
82 src->next_input_byte = (
const JOCTET*)
src->fBuffer;
83 src->bytes_in_buffer = 0;
84 } else {
85 src->next_input_byte += numBytes;
86 src->bytes_in_buffer -= numBytes;
87 }
88}
#define SkCodecPrintf(...)
◆ sk_skip_mem_input_data()
static void sk_skip_mem_input_data |
( |
j_decompress_ptr |
cinfo, |
|
|
long |
num_bytes |
|
) |
| |
|
static |
Definition at line 110 of file SkJpegUtility.cpp.
110 {
111 jpeg_source_mgr*
src = cinfo->src;
112 size_t bytes = static_cast<size_t>(num_bytes);
113 if(bytes >
src->bytes_in_buffer) {
114 src->next_input_byte =
nullptr;
115 src->bytes_in_buffer = 0;
116 } else {
117 src->next_input_byte += bytes;
118 src->bytes_in_buffer -= bytes;
119 }
120}
◆ sk_term_source()
static void sk_term_source |
( |
j_decompress_ptr |
dinfo | ) |
|
|
static |
◆ skjpeg_err_exit()
void skjpeg_err_exit |
( |
j_common_ptr |
dinfo | ) |
|
Definition at line 25 of file SkJpegUtility.cpp.
25 {
26
27
29 (*
error->output_message)(dinfo);
30 if (
error->fStack[0] ==
nullptr) {
31 SK_ABORT(
"JPEG error with no jmp_buf set.");
32 }
33 longjmp(*
error->fStack[0], 1);
34}
#define SK_ABORT(message,...)
const uint8_t uint32_t uint32_t GError ** error