• 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_TIFF_TIFF_DECODER_H_
8 #define CORE_FXCODEC_TIFF_TIFF_DECODER_H_
9 
10 #include <memory>
11 
12 #include "core/fxcodec/progressive_decoder_iface.h"
13 #include "core/fxcrt/retain_ptr.h"
14 
15 #ifndef PDF_ENABLE_XFA_TIFF
16 #error "TIFF must be enabled"
17 #endif
18 
19 class CFX_DIBitmap;
20 class IFX_SeekableReadStream;
21 
22 namespace fxcodec {
23 
24 class CFX_DIBAttribute;
25 
26 class TiffDecoder {
27  public:
28   static std::unique_ptr<ProgressiveDecoderIface::Context> CreateDecoder(
29       const RetainPtr<IFX_SeekableReadStream>& file_ptr);
30 
31   static bool LoadFrameInfo(ProgressiveDecoderIface::Context* ctx,
32                             int32_t frame,
33                             int32_t* width,
34                             int32_t* height,
35                             int32_t* comps,
36                             int32_t* bpc,
37                             CFX_DIBAttribute* pAttribute);
38   // `bitmap` must be `FXDIB_Format::kBgra`.
39   static bool Decode(ProgressiveDecoderIface::Context* ctx,
40                      RetainPtr<CFX_DIBitmap> bitmap);
41 
42   TiffDecoder() = delete;
43   TiffDecoder(const TiffDecoder&) = delete;
44   TiffDecoder& operator=(const TiffDecoder&) = delete;
45 };
46 
47 }  // namespace fxcodec
48 
49 using TiffDecoder = fxcodec::TiffDecoder;
50 
51 #endif  // CORE_FXCODEC_TIFF_TIFF_DECODER_H_
52