• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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_JPX_JPX_DECODE_UTILS_H_
8 #define CORE_FXCODEC_JPX_JPX_DECODE_UTILS_H_
9 
10 #include <stdint.h>
11 
12 #include "core/fxcrt/span.h"
13 
14 #if defined(USE_SYSTEM_LIBOPENJPEG2)
15 #include <openjpeg.h>
16 #else
17 #include "third_party/libopenjpeg/openjpeg.h"
18 #endif
19 
20 namespace fxcodec {
21 
22 struct DecodeData {
23   DecodeData() = default;
24   explicit DecodeData(pdfium::span<const uint8_t> data);
25 
26   const uint8_t* src_data = nullptr;
27   OPJ_SIZE_T src_size = 0;
28   OPJ_SIZE_T offset = 0;
29 };
30 
31 /* Wrappers for C-style callbacks. */
32 OPJ_SIZE_T opj_read_from_memory(void* p_buffer,
33                                 OPJ_SIZE_T nb_bytes,
34                                 void* p_user_data);
35 OPJ_OFF_T opj_skip_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data);
36 OPJ_BOOL opj_seek_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data);
37 
38 }  // namespace fxcodec
39 
40 #endif  // CORE_FXCODEC_JPX_JPX_DECODE_UTILS_H_
41