xref: /aosp_15_r20/external/pdfium/core/fxcodec/tiff/tiff_decoder.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
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   static bool Decode(ProgressiveDecoderIface::Context* ctx,
39                      const RetainPtr<CFX_DIBitmap>& pDIBitmap);
40 
41   TiffDecoder() = delete;
42   TiffDecoder(const TiffDecoder&) = delete;
43   TiffDecoder& operator=(const TiffDecoder&) = delete;
44 };
45 
46 }  // namespace fxcodec
47 
48 using TiffDecoder = fxcodec::TiffDecoder;
49 
50 #endif  // CORE_FXCODEC_TIFF_TIFF_DECODER_H_
51