Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
jpeg_common.c
Go to the documentation of this file.
1// Copyright 2020 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#include "core/fxcodec/jpeg/jpeg_common.h"
8
9// This is a thin C wrapper around the JPEG API to avoid calling setjmp() from
10// C++ code.
11
12boolean jpeg_common_create_decompress(JpegCommon* jpeg_common) {
13 if (setjmp(jpeg_common->jmpbuf) == -1) {
14 return FALSE;
15 }
16 jpeg_create_decompress(&jpeg_common->cinfo);
17 return TRUE;
18}
19
20void jpeg_common_destroy_decompress(JpegCommon* jpeg_common) {
21 jpeg_destroy_decompress(&jpeg_common->cinfo);
22}
23
24boolean jpeg_common_start_decompress(JpegCommon* jpeg_common) {
25 if (setjmp(jpeg_common->jmpbuf) == -1) {
26 return FALSE;
27 }
28 return jpeg_start_decompress(&jpeg_common->cinfo);
29}
30
31int jpeg_common_read_header(JpegCommon* jpeg_common, boolean flag) {
32 if (setjmp(jpeg_common->jmpbuf) == -1) {
33 return -1;
34 }
35 return jpeg_read_header(&jpeg_common->cinfo, flag);
36}
37
38int jpeg_common_read_scanlines(JpegCommon* jpeg_common,
39 void* buf,
40 unsigned int count) {
41 if (setjmp(jpeg_common->jmpbuf) == -1) {
42 return -1;
43 }
44 return jpeg_read_scanlines(&jpeg_common->cinfo, buf, count);
45}
46
47void jpeg_common_src_do_nothing(j_decompress_ptr cinfo) {}
48
49boolean jpeg_common_src_fill_buffer(j_decompress_ptr cinfo) {
50 return FALSE;
51}
52
53boolean jpeg_common_src_resync(j_decompress_ptr cinfo, int desired) {
54 return FALSE;
55}
56
57void jpeg_common_error_do_nothing(j_common_ptr cinfo) {}
58
59void jpeg_common_error_do_nothing_int(j_common_ptr cinfo, int arg) {}
60
61void jpeg_common_error_do_nothing_char(j_common_ptr cinfo, char* arg) {}
boolean jpeg_common_src_fill_buffer(j_decompress_ptr cinfo)
Definition jpeg_common.c:49
void jpeg_common_error_do_nothing(j_common_ptr cinfo)
Definition jpeg_common.c:57
void jpeg_common_error_do_nothing_char(j_common_ptr cinfo, char *arg)
Definition jpeg_common.c:61
boolean jpeg_common_create_decompress(JpegCommon *jpeg_common)
Definition jpeg_common.c:12
boolean jpeg_common_src_resync(j_decompress_ptr cinfo, int desired)
Definition jpeg_common.c:53
int jpeg_common_read_header(JpegCommon *jpeg_common, boolean flag)
Definition jpeg_common.c:31
int jpeg_common_read_scanlines(JpegCommon *jpeg_common, void *buf, unsigned int count)
Definition jpeg_common.c:38
void jpeg_common_src_do_nothing(j_decompress_ptr cinfo)
Definition jpeg_common.c:47
void jpeg_common_error_do_nothing_int(j_common_ptr cinfo, int arg)
Definition jpeg_common.c:59
boolean jpeg_common_start_decompress(JpegCommon *jpeg_common)
Definition jpeg_common.c:24
void jpeg_common_destroy_decompress(JpegCommon *jpeg_common)
Definition jpeg_common.c:20
jmp_buf jmpbuf
Definition jpeg_common.h:40