summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render/cpdf_dibtransferfunc.h
blob: 62e0157665a33b2946f2af886babf6077f442aa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2016 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#ifndef CORE_FPDFAPI_RENDER_CPDF_DIBTRANSFERFUNC_H_
#define CORE_FPDFAPI_RENDER_CPDF_DIBTRANSFERFUNC_H_

#include <vector>

#include "core/fxcrt/unowned_ptr.h"
#include "core/fxge/dib/cfx_filtereddib.h"
#include "core/fxge/fx_dib.h"

class CPDF_TransferFunc;

class CPDF_DIBTransferFunc final : public CFX_FilteredDIB {
 public:
  template <typename T, typename... Args>
  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);

  // CFX_FilteredDIB
  FXDIB_Format GetDestFormat() override;
  FX_ARGB* GetDestPalette() override;
  void TranslateScanline(const uint8_t* src_buf,
                         std::vector<uint8_t>* dest_buf) const override;
  void TranslateDownSamples(uint8_t* dest_buf,
                            const uint8_t* src_buf,
                            int pixels,
                            int Bpp) const override;

 private:
  explicit CPDF_DIBTransferFunc(
      const RetainPtr<CPDF_TransferFunc>& pTransferFunc);
  ~CPDF_DIBTransferFunc() override;

  RetainPtr<CPDF_TransferFunc> m_pTransferFunc;
  const uint8_t* m_RampR;
  const uint8_t* m_RampG;
  const uint8_t* m_RampB;
};

#endif  // CORE_FPDFAPI_RENDER_CPDF_DIBTRANSFERFUNC_H_