1 // Copyright 2016 PDFium Authors. All rights reserved.
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_RENDER_CPDF_DOCRENDERDATA_H_
8 #define CORE_FPDFAPI_RENDER_CPDF_DOCRENDERDATA_H_
9 
10 #include <map>
11 
12 #include "core/fpdfapi/parser/cpdf_document.h"
13 #include "core/fxcrt/observed_ptr.h"
14 #include "core/fxcrt/retain_ptr.h"
15 
16 class CPDF_Font;
17 class CPDF_Object;
18 class CPDF_TransferFunc;
19 class CPDF_Type3Cache;
20 class CPDF_Type3Font;
21 
22 class CPDF_DocRenderData : public CPDF_Document::RenderDataIface {
23  public:
24   static CPDF_DocRenderData* FromDocument(const CPDF_Document* pDoc);
25 
26   CPDF_DocRenderData();
27   ~CPDF_DocRenderData() override;
28 
29   CPDF_DocRenderData(const CPDF_DocRenderData&) = delete;
30   CPDF_DocRenderData& operator=(const CPDF_DocRenderData&) = delete;
31 
32   RetainPtr<CPDF_Type3Cache> GetCachedType3(CPDF_Type3Font* pFont);
33   RetainPtr<CPDF_TransferFunc> GetTransferFunc(const CPDF_Object* pObj);
34 
35  protected:
36   // protected for use by test subclasses.
37   RetainPtr<CPDF_TransferFunc> CreateTransferFunc(
38       const CPDF_Object* pObj) const;
39 
40  private:
41   std::map<CPDF_Font*, ObservedPtr<CPDF_Type3Cache>> m_Type3FaceMap;
42   std::map<const CPDF_Object*, ObservedPtr<CPDF_TransferFunc>>
43       m_TransferFuncMap;
44 };
45 
46 #endif  // CORE_FPDFAPI_RENDER_CPDF_DOCRENDERDATA_H_
47