OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_ | 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_ |
8 #define CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_ | 8 #define CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "core/include/fpdfapi/fpdf_page.h" | 13 #include "core/include/fpdfapi/fpdf_page.h" |
14 #include "core/include/fxge/fx_ge.h" | 14 #include "core/include/fxge/fx_ge.h" |
15 | 15 |
16 class CFX_GraphStateData; | 16 class CFX_GraphStateData; |
17 class CFX_PathData; | 17 class CFX_PathData; |
18 class CFX_RenderDevice; | 18 class CFX_RenderDevice; |
19 class CPDF_FormObject; | 19 class CPDF_FormObject; |
20 class CPDF_ImageCacheEntry; | 20 class CPDF_ImageCacheEntry; |
21 class CPDF_ImageObject; | 21 class CPDF_ImageObject; |
22 class CPDF_PathObject; | 22 class CPDF_PathObject; |
23 class CPDF_RenderContext; | |
24 class CPDF_RenderOptions; | |
25 class CPDF_RenderStatus; | 23 class CPDF_RenderStatus; |
26 class CPDF_ShadingObject; | 24 class CPDF_ShadingObject; |
27 class CPDF_TextObject; | 25 class CPDF_TextObject; |
28 class IFX_Pause; | 26 class IFX_Pause; |
29 | 27 |
30 class IPDF_OCContext { | 28 class IPDF_OCContext { |
31 public: | 29 public: |
32 virtual ~IPDF_OCContext() {} | 30 virtual ~IPDF_OCContext() {} |
33 | 31 |
34 virtual FX_BOOL CheckOCGVisible(const CPDF_Dictionary* pOCG) = 0; | 32 virtual FX_BOOL CheckOCGVisible(const CPDF_Dictionary* pOCG) = 0; |
(...skipping 13 matching lines...) Expand all Loading... |
48 #define RENDER_FORCE_HALFTONE 0x00000040 | 46 #define RENDER_FORCE_HALFTONE 0x00000040 |
49 #define RENDER_RECT_AA 0x00000080 | 47 #define RENDER_RECT_AA 0x00000080 |
50 #define RENDER_FILL_FULLCOVER 0x00000100 | 48 #define RENDER_FILL_FULLCOVER 0x00000100 |
51 #define RENDER_PRINTIMAGETEXT 0x00000200 | 49 #define RENDER_PRINTIMAGETEXT 0x00000200 |
52 #define RENDER_OVERPRINT 0x00000400 | 50 #define RENDER_OVERPRINT 0x00000400 |
53 #define RENDER_THINLINE 0x00000800 | 51 #define RENDER_THINLINE 0x00000800 |
54 #define RENDER_NOTEXTSMOOTH 0x10000000 | 52 #define RENDER_NOTEXTSMOOTH 0x10000000 |
55 #define RENDER_NOPATHSMOOTH 0x20000000 | 53 #define RENDER_NOPATHSMOOTH 0x20000000 |
56 #define RENDER_NOIMAGESMOOTH 0x40000000 | 54 #define RENDER_NOIMAGESMOOTH 0x40000000 |
57 #define RENDER_LIMITEDIMAGECACHE 0x80000000 | 55 #define RENDER_LIMITEDIMAGECACHE 0x80000000 |
| 56 |
58 class CPDF_RenderOptions { | 57 class CPDF_RenderOptions { |
59 public: | 58 public: |
60 CPDF_RenderOptions(); | 59 CPDF_RenderOptions(); |
| 60 FX_ARGB TranslateColor(FX_ARGB argb) const; |
61 | 61 |
62 int m_ColorMode; | 62 int m_ColorMode; |
| 63 FX_COLORREF m_BackColor; |
| 64 FX_COLORREF m_ForeColor; |
| 65 FX_DWORD m_Flags; |
| 66 int m_Interpolation; |
| 67 FX_DWORD m_AddFlags; |
| 68 IPDF_OCContext* m_pOCContext; |
| 69 FX_DWORD m_dwLimitCacheSize; |
| 70 int m_HalftoneLimit; |
| 71 }; |
63 | 72 |
64 FX_COLORREF m_BackColor; | |
65 | |
66 FX_COLORREF m_ForeColor; | |
67 | |
68 FX_DWORD m_Flags; | |
69 | |
70 int m_Interpolation; | |
71 | |
72 FX_DWORD m_AddFlags; | |
73 | |
74 IPDF_OCContext* m_pOCContext; | |
75 | |
76 FX_DWORD m_dwLimitCacheSize; | |
77 | |
78 int m_HalftoneLimit; | |
79 | |
80 FX_ARGB TranslateColor(FX_ARGB argb) const; | |
81 }; | |
82 class CPDF_RenderContext { | 73 class CPDF_RenderContext { |
83 public: | 74 public: |
| 75 class Layer { |
| 76 public: |
| 77 CPDF_PageObjectList* m_pObjectList; |
| 78 CFX_Matrix m_Matrix; |
| 79 }; |
| 80 |
84 explicit CPDF_RenderContext(CPDF_Page* pPage); | 81 explicit CPDF_RenderContext(CPDF_Page* pPage); |
85 CPDF_RenderContext(CPDF_Document* pDoc, CPDF_PageRenderCache* pPageCache); | 82 CPDF_RenderContext(CPDF_Document* pDoc, CPDF_PageRenderCache* pPageCache); |
86 ~CPDF_RenderContext(); | 83 ~CPDF_RenderContext(); |
87 | 84 |
88 void AppendObjectList(CPDF_PageObjectList* pObjs, | 85 void AppendLayer(CPDF_PageObjectList* pObjectList, |
89 const CFX_Matrix* pObject2Device); | 86 const CFX_Matrix* pObject2Device); |
90 | 87 |
91 void Render(CFX_RenderDevice* pDevice, | 88 void Render(CFX_RenderDevice* pDevice, |
92 const CPDF_RenderOptions* pOptions = NULL, | 89 const CPDF_RenderOptions* pOptions, |
93 const CFX_Matrix* pFinalMatrix = NULL); | 90 const CFX_Matrix* pFinalMatrix); |
94 | 91 |
95 void DrawObjectList(CFX_RenderDevice* pDevice, | 92 void Render(CFX_RenderDevice* pDevice, |
96 CPDF_PageObjectList* pObjs, | 93 const CPDF_PageObject* pStopObj, |
97 const CFX_Matrix* pObject2Device, | 94 const CPDF_RenderOptions* pOptions, |
98 const CPDF_RenderOptions* pOptions); | 95 const CFX_Matrix* pFinalMatrix); |
99 | 96 |
100 void GetBackground(CFX_DIBitmap* pBuffer, | 97 void GetBackground(CFX_DIBitmap* pBuffer, |
101 const CPDF_PageObject* pObj, | 98 const CPDF_PageObject* pObj, |
102 const CPDF_RenderOptions* pOptions, | 99 const CPDF_RenderOptions* pOptions, |
103 CFX_Matrix* pFinalMatrix); | 100 CFX_Matrix* pFinalMatrix); |
104 | 101 |
| 102 FX_DWORD CountLayers() const { return m_Layers.GetSize(); } |
| 103 Layer* GetLayer(FX_DWORD index) { return m_Layers.GetDataPtr(index); } |
| 104 |
| 105 CPDF_Document* GetDocument() const { return m_pDocument; } |
| 106 CPDF_Dictionary* GetPageResources() const { return m_pPageResources; } |
105 CPDF_PageRenderCache* GetPageCache() const { return m_pPageCache; } | 107 CPDF_PageRenderCache* GetPageCache() const { return m_pPageCache; } |
106 | 108 |
107 protected: | 109 protected: |
108 void Render(CFX_RenderDevice* pDevice, | |
109 const CPDF_PageObject* pStopObj, | |
110 const CPDF_RenderOptions* pOptions, | |
111 const CFX_Matrix* pFinalMatrix); | |
112 | |
113 CPDF_Document* const m_pDocument; | 110 CPDF_Document* const m_pDocument; |
114 CPDF_Dictionary* m_pPageResources; | 111 CPDF_Dictionary* m_pPageResources; |
115 CPDF_PageRenderCache* m_pPageCache; | 112 CPDF_PageRenderCache* m_pPageCache; |
116 CFX_ArrayTemplate<struct _PDF_RenderItem> m_ContentList; | |
117 FX_BOOL m_bFirstLayer; | 113 FX_BOOL m_bFirstLayer; |
118 | 114 CFX_ArrayTemplate<Layer> m_Layers; |
119 friend class CPDF_RenderStatus; | |
120 friend class CPDF_ProgressiveRenderer; | |
121 }; | 115 }; |
122 | 116 |
123 class CPDF_ProgressiveRenderer { | 117 class CPDF_ProgressiveRenderer { |
124 public: | 118 public: |
125 // Must match FDF_RENDER_* definitions in public/fpdf_progressive.h, but | 119 // Must match FDF_RENDER_* definitions in public/fpdf_progressive.h, but |
126 // cannot #include that header. fpdfsdk/src/fpdf_progressive.cpp has | 120 // cannot #include that header. fpdfsdk/src/fpdf_progressive.cpp has |
127 // static_asserts to make sure the two sets of values match. | 121 // static_asserts to make sure the two sets of values match. |
128 enum Status { | 122 enum Status { |
129 Ready, // FPDF_RENDER_READER | 123 Ready, // FPDF_RENDER_READER |
130 ToBeContinued, // FPDF_RENDER_TOBECOUNTINUED | 124 ToBeContinued, // FPDF_RENDER_TOBECOUNTINUED |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 public: | 265 public: |
272 CPDF_RenderConfig(); | 266 CPDF_RenderConfig(); |
273 ~CPDF_RenderConfig(); | 267 ~CPDF_RenderConfig(); |
274 int m_HalftoneLimit; | 268 int m_HalftoneLimit; |
275 int m_RenderStepLimit; | 269 int m_RenderStepLimit; |
276 }; | 270 }; |
277 | 271 |
278 FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix); | 272 FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix); |
279 | 273 |
280 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_ | 274 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_ |
OLD | NEW |