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