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.h
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#ifndef CORE_FXCODEC_JPEG_JPEG_COMMON_H_
8#define CORE_FXCODEC_JPEG_JPEG_COMMON_H_
9
10// Common code for interacting with libjpeg shared by other files in
11// core/fxcodec/jpeg/. Not intended to be included in headers.
12
13#include <setjmp.h>
14#include <stdio.h>
15
16#include "build/build_config.h"
17
18#if BUILDFLAG(IS_WIN)
19// windows.h must come before the third_party/libjpeg_turbo includes.
20#include <windows.h>
21#endif
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#undef FAR
28#if defined(USE_SYSTEM_LIBJPEG)
29#include <jerror.h>
30#include <jpeglib.h>
31#elif defined(USE_LIBJPEG_TURBO)
32#include "third_party/libjpeg_turbo/jerror.h"
33#include "third_party/libjpeg_turbo/jpeglib.h"
34#else
35#include "third_party/libjpeg/jerror.h"
36#include "third_party/libjpeg/jpeglib.h"
37#endif
38
39struct JpegCommon {
40 jmp_buf jmpbuf;
41 struct jpeg_decompress_struct cinfo;
42 struct jpeg_error_mgr error_mgr;
43 struct jpeg_source_mgr source_mgr;
44};
45typedef struct JpegCommon JpegCommon;
46
47boolean jpeg_common_create_decompress(JpegCommon* jpeg_common);
48void jpeg_common_destroy_decompress(JpegCommon* jpeg_common);
49boolean jpeg_common_start_decompress(JpegCommon* jpeg_common);
50int jpeg_common_read_header(JpegCommon* jpeg_common, boolean flag);
51int jpeg_common_read_scanlines(JpegCommon* jpeg_common,
52 void* buf,
53 unsigned int count);
54
55// Callbacks.
56void jpeg_common_src_do_nothing(j_decompress_ptr cinfo);
57boolean jpeg_common_src_fill_buffer(j_decompress_ptr cinfo);
58boolean jpeg_common_src_resync(j_decompress_ptr cinfo, int desired);
59void jpeg_common_error_do_nothing(j_common_ptr cinfo);
60void jpeg_common_error_do_nothing_int(j_common_ptr cinfo, int arg);
61void jpeg_common_error_do_nothing_char(j_common_ptr cinfo, char* arg);
62
63#ifdef __cplusplus
64} // extern "C"
65#endif
66
67#endif // CORE_FXCODEC_JPEG_JPEG_COMMON_H_
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
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
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
struct jpeg_source_mgr source_mgr
Definition jpeg_common.h:43
struct jpeg_error_mgr error_mgr
Definition jpeg_common.h:42
struct jpeg_decompress_struct cinfo
Definition jpeg_common.h:41
jmp_buf jmpbuf
Definition jpeg_common.h:40