• 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_FLATE_FLATEMODULE_H_
8 #define CORE_FXCODEC_FLATE_FLATEMODULE_H_
9 
10 #include <memory>
11 
12 #include "core/fxcrt/fx_memory_wrappers.h"
13 #include "core/fxcrt/fx_system.h"
14 #include "third_party/base/span.h"
15 
16 namespace fxcodec {
17 
18 class ScanlineDecoder;
19 
20 class FlateModule {
21  public:
22   static std::unique_ptr<ScanlineDecoder> CreateDecoder(
23       pdfium::span<const uint8_t> src_span,
24       int width,
25       int height,
26       int nComps,
27       int bpc,
28       int predictor,
29       int Colors,
30       int BitsPerComponent,
31       int Columns);
32 
33   static uint32_t FlateOrLZWDecode(
34       bool bLZW,
35       pdfium::span<const uint8_t> src_span,
36       bool bEarlyChange,
37       int predictor,
38       int Colors,
39       int BitsPerComponent,
40       int Columns,
41       uint32_t estimated_size,
42       std::unique_ptr<uint8_t, FxFreeDeleter>* dest_buf,
43       uint32_t* dest_size);
44 
45   static bool Encode(const uint8_t* src_buf,
46                      uint32_t src_size,
47                      std::unique_ptr<uint8_t, FxFreeDeleter>* dest_buf,
48                      uint32_t* dest_size);
49 
50   FlateModule() = delete;
51   FlateModule(const FlateModule&) = delete;
52   FlateModule& operator=(const FlateModule&) = delete;
53 };
54 
55 }  // namespace fxcodec
56 
57 using FlateModule = fxcodec::FlateModule;
58 
59 #endif  // CORE_FXCODEC_FLATE_FLATEMODULE_H_
60