• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 PDFium Authors. All rights reserved.
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_FAX_FAXMODULE_H_
8 #define CORE_FXCODEC_FAX_FAXMODULE_H_
9 
10 #include <memory>
11 
12 #include "build/build_config.h"
13 #include "core/fxcrt/fx_memory_wrappers.h"
14 #include "core/fxcrt/fx_system.h"
15 #include "third_party/base/span.h"
16 
17 namespace fxcodec {
18 
19 class ScanlineDecoder;
20 
21 class FaxModule {
22  public:
23   static std::unique_ptr<ScanlineDecoder> CreateDecoder(
24       pdfium::span<const uint8_t> src_span,
25       int width,
26       int height,
27       int K,
28       bool EndOfLine,
29       bool EncodedByteAlign,
30       bool BlackIs1,
31       int Columns,
32       int Rows);
33 
34   // Return the ending bit position.
35   static int FaxG4Decode(const uint8_t* src_buf,
36                          uint32_t src_size,
37                          int starting_bitpos,
38                          int width,
39                          int height,
40                          int pitch,
41                          uint8_t* dest_buf);
42 
43 #if defined(OS_WIN)
44   static void FaxEncode(const uint8_t* src_buf,
45                         int width,
46                         int height,
47                         int pitch,
48                         std::unique_ptr<uint8_t, FxFreeDeleter>* dest_buf,
49                         uint32_t* dest_size);
50 #endif  // defined(OS_WIN)
51 
52   FaxModule() = delete;
53   FaxModule(const FaxModule&) = delete;
54   FaxModule& operator=(const FaxModule&) = delete;
55 };
56 
57 }  // namespace fxcodec
58 
59 using FaxModule = fxcodec::FaxModule;
60 
61 #endif  // CORE_FXCODEC_FAX_FAXMODULE_H_
62