xref: /aosp_15_r20/external/pdfium/core/fpdfapi/page/cpdf_transferfuncdib.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_FPDFAPI_PAGE_CPDF_TRANSFERFUNCDIB_H_
8 #define CORE_FPDFAPI_PAGE_CPDF_TRANSFERFUNCDIB_H_
9 
10 #include <stdint.h>
11 
12 #include "core/fxcrt/data_vector.h"
13 #include "core/fxcrt/retain_ptr.h"
14 #include "core/fxge/dib/cfx_dibbase.h"
15 #include "third_party/base/containers/span.h"
16 
17 class CPDF_TransferFunc;
18 
19 class CPDF_TransferFuncDIB final : public CFX_DIBBase {
20  public:
21   CONSTRUCT_VIA_MAKE_RETAIN;
22 
23   // CFX_DIBBase:
24   pdfium::span<const uint8_t> GetScanline(int line) const override;
25 
26  private:
27   CPDF_TransferFuncDIB(RetainPtr<CFX_DIBBase> pSrc,
28                        RetainPtr<CPDF_TransferFunc> pTransferFunc);
29   ~CPDF_TransferFuncDIB() override;
30 
31   void TranslateScanline(pdfium::span<const uint8_t> src_span) const;
32   FXDIB_Format GetDestFormat() const;
33 
34   RetainPtr<CFX_DIBBase> const m_pSrc;
35   RetainPtr<CPDF_TransferFunc> const m_pTransferFunc;
36   const pdfium::span<const uint8_t> m_RampR;
37   const pdfium::span<const uint8_t> m_RampG;
38   const pdfium::span<const uint8_t> m_RampB;
39   mutable DataVector<uint8_t> m_Scanline;
40 };
41 
42 #endif  // CORE_FPDFAPI_PAGE_CPDF_TRANSFERFUNCDIB_H_
43