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_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ |
8 #define CORE_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ | 8 #define CORE_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 int transparency, | 103 int transparency, |
104 FX_BOOL bDropObjects, | 104 FX_BOOL bDropObjects, |
105 CPDF_Dictionary* pFormResource = nullptr, | 105 CPDF_Dictionary* pFormResource = nullptr, |
106 FX_BOOL bStdCS = FALSE, | 106 FX_BOOL bStdCS = FALSE, |
107 CPDF_Type3Char* pType3Char = nullptr, | 107 CPDF_Type3Char* pType3Char = nullptr, |
108 FX_ARGB fill_color = 0, | 108 FX_ARGB fill_color = 0, |
109 uint32_t GroupFamily = 0, | 109 uint32_t GroupFamily = 0, |
110 FX_BOOL bLoadMask = FALSE); | 110 FX_BOOL bLoadMask = FALSE); |
111 void RenderObjectList(const CPDF_PageObjectHolder* pObjectHolder, | 111 void RenderObjectList(const CPDF_PageObjectHolder* pObjectHolder, |
112 const CFX_Matrix* pObj2Device); | 112 const CFX_Matrix* pObj2Device); |
113 void RenderSingleObject(const CPDF_PageObject* pObj, | 113 void RenderSingleObject(CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device); |
114 const CFX_Matrix* pObj2Device); | 114 FX_BOOL ContinueSingleObject(CPDF_PageObject* pObj, |
115 FX_BOOL ContinueSingleObject(const CPDF_PageObject* pObj, | |
116 const CFX_Matrix* pObj2Device, | 115 const CFX_Matrix* pObj2Device, |
117 IFX_Pause* pPause); | 116 IFX_Pause* pPause); |
118 CPDF_RenderContext* GetContext() { return m_pContext; } | 117 CPDF_RenderContext* GetContext() { return m_pContext; } |
119 | 118 |
120 #if defined _SKIA_SUPPORT_ | 119 #if defined _SKIA_SUPPORT_ |
121 void DebugVerifyDeviceIsPreMultiplied() const; | 120 void DebugVerifyDeviceIsPreMultiplied() const; |
122 #endif | 121 #endif |
123 | 122 |
124 CPDF_RenderOptions m_Options; | 123 CPDF_RenderOptions m_Options; |
125 CPDF_Dictionary* m_pFormResource; | 124 CPDF_Dictionary* m_pFormResource; |
126 CPDF_Dictionary* m_pPageResource; | 125 CPDF_Dictionary* m_pPageResource; |
127 CFX_ArrayTemplate<CPDF_Type3Font*> m_Type3FontCache; | 126 CFX_ArrayTemplate<CPDF_Type3Font*> m_Type3FontCache; |
128 | 127 |
129 protected: | 128 protected: |
130 friend class CPDF_ImageRenderer; | 129 friend class CPDF_ImageRenderer; |
131 friend class CPDF_RenderContext; | 130 friend class CPDF_RenderContext; |
132 | 131 |
133 void ProcessClipPath(CPDF_ClipPath ClipPath, const CFX_Matrix* pObj2Device); | 132 void ProcessClipPath(CPDF_ClipPath ClipPath, const CFX_Matrix* pObj2Device); |
134 void DrawClipPath(CPDF_ClipPath ClipPath, const CFX_Matrix* pObj2Device); | 133 void DrawClipPath(CPDF_ClipPath ClipPath, const CFX_Matrix* pObj2Device); |
135 FX_BOOL ProcessTransparency(const CPDF_PageObject* PageObj, | 134 FX_BOOL ProcessTransparency(CPDF_PageObject* PageObj, |
136 const CFX_Matrix* pObj2Device); | 135 const CFX_Matrix* pObj2Device); |
137 void ProcessObjectNoClip(const CPDF_PageObject* PageObj, | 136 void ProcessObjectNoClip(CPDF_PageObject* PageObj, |
138 const CFX_Matrix* pObj2Device); | 137 const CFX_Matrix* pObj2Device); |
139 void DrawObjWithBackground(const CPDF_PageObject* pObj, | 138 void DrawObjWithBackground(CPDF_PageObject* pObj, |
140 const CFX_Matrix* pObj2Device); | 139 const CFX_Matrix* pObj2Device); |
141 FX_BOOL DrawObjWithBlend(const CPDF_PageObject* pObj, | 140 FX_BOOL DrawObjWithBlend(CPDF_PageObject* pObj, |
142 const CFX_Matrix* pObj2Device); | 141 const CFX_Matrix* pObj2Device); |
143 FX_BOOL ProcessPath(const CPDF_PathObject* pPathObj, | 142 FX_BOOL ProcessPath(CPDF_PathObject* pPathObj, const CFX_Matrix* pObj2Device); |
144 const CFX_Matrix* pObj2Device); | 143 void ProcessPathPattern(CPDF_PathObject* pPathObj, |
145 void ProcessPathPattern(const CPDF_PathObject* pPathObj, | |
146 const CFX_Matrix* pObj2Device, | 144 const CFX_Matrix* pObj2Device, |
147 int& filltype, | 145 int& filltype, |
148 FX_BOOL& bStroke); | 146 FX_BOOL& bStroke); |
149 void DrawPathWithPattern(const CPDF_PathObject* pPathObj, | 147 void DrawPathWithPattern(CPDF_PathObject* pPathObj, |
150 const CFX_Matrix* pObj2Device, | 148 const CFX_Matrix* pObj2Device, |
151 const CPDF_Color* pColor, | 149 const CPDF_Color* pColor, |
152 FX_BOOL bStroke); | 150 FX_BOOL bStroke); |
153 void DrawTilingPattern(CPDF_TilingPattern* pPattern, | 151 void DrawTilingPattern(CPDF_TilingPattern* pPattern, |
154 const CPDF_PageObject* pPageObj, | 152 CPDF_PageObject* pPageObj, |
155 const CFX_Matrix* pObj2Device, | 153 const CFX_Matrix* pObj2Device, |
156 FX_BOOL bStroke); | 154 FX_BOOL bStroke); |
157 void DrawShadingPattern(CPDF_ShadingPattern* pPattern, | 155 void DrawShadingPattern(CPDF_ShadingPattern* pPattern, |
158 const CPDF_PageObject* pPageObj, | 156 const CPDF_PageObject* pPageObj, |
159 const CFX_Matrix* pObj2Device, | 157 const CFX_Matrix* pObj2Device, |
160 FX_BOOL bStroke); | 158 FX_BOOL bStroke); |
161 FX_BOOL SelectClipPath(const CPDF_PathObject* pPathObj, | 159 FX_BOOL SelectClipPath(const CPDF_PathObject* pPathObj, |
162 const CFX_Matrix* pObj2Device, | 160 const CFX_Matrix* pObj2Device, |
163 FX_BOOL bStroke); | 161 FX_BOOL bStroke); |
164 FX_BOOL ProcessImage(const CPDF_ImageObject* pImageObj, | 162 FX_BOOL ProcessImage(CPDF_ImageObject* pImageObj, |
165 const CFX_Matrix* pObj2Device); | 163 const CFX_Matrix* pObj2Device); |
166 FX_BOOL OutputBitmapAlpha(CPDF_ImageObject* pImageObj, | 164 FX_BOOL OutputBitmapAlpha(CPDF_ImageObject* pImageObj, |
167 const CFX_Matrix* pImage2Device); | 165 const CFX_Matrix* pImage2Device); |
168 FX_BOOL OutputImage(CPDF_ImageObject* pImageObj, | 166 FX_BOOL OutputImage(CPDF_ImageObject* pImageObj, |
169 const CFX_Matrix* pImage2Device); | 167 const CFX_Matrix* pImage2Device); |
170 FX_BOOL OutputDIBSource(const CFX_DIBSource* pOutputBitmap, | 168 FX_BOOL OutputDIBSource(const CFX_DIBSource* pOutputBitmap, |
171 FX_ARGB fill_argb, | 169 FX_ARGB fill_argb, |
172 int bitmap_alpha, | 170 int bitmap_alpha, |
173 const CFX_Matrix* pImage2Device, | 171 const CFX_Matrix* pImage2Device, |
174 CPDF_ImageCacheEntry* pImageCache, | 172 CPDF_ImageCacheEntry* pImageCache, |
175 uint32_t flags); | 173 uint32_t flags); |
176 void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, | 174 void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, |
177 int left, | 175 int left, |
178 int top, | 176 int top, |
179 FX_ARGB mask_argb, | 177 FX_ARGB mask_argb, |
180 int bitmap_alpha, | 178 int bitmap_alpha, |
181 int blend_mode, | 179 int blend_mode, |
182 int bIsolated); | 180 int bIsolated); |
183 void ProcessShading(const CPDF_ShadingObject* pShadingObj, | 181 void ProcessShading(const CPDF_ShadingObject* pShadingObj, |
184 const CFX_Matrix* pObj2Device); | 182 const CFX_Matrix* pObj2Device); |
185 void DrawShading(CPDF_ShadingPattern* pPattern, | 183 void DrawShading(CPDF_ShadingPattern* pPattern, |
186 CFX_Matrix* pMatrix, | 184 CFX_Matrix* pMatrix, |
187 FX_RECT& clip_rect, | 185 FX_RECT& clip_rect, |
188 int alpha, | 186 int alpha, |
189 FX_BOOL bAlphaMode); | 187 FX_BOOL bAlphaMode); |
190 FX_BOOL ProcessType3Text(const CPDF_TextObject* textobj, | 188 FX_BOOL ProcessType3Text(CPDF_TextObject* textobj, |
191 const CFX_Matrix* pObj2Device); | 189 const CFX_Matrix* pObj2Device); |
192 FX_BOOL ProcessText(const CPDF_TextObject* textobj, | 190 FX_BOOL ProcessText(CPDF_TextObject* textobj, |
193 const CFX_Matrix* pObj2Device, | 191 const CFX_Matrix* pObj2Device, |
194 CFX_PathData* pClippingPath); | 192 CFX_PathData* pClippingPath); |
195 void DrawTextPathWithPattern(const CPDF_TextObject* textobj, | 193 void DrawTextPathWithPattern(const CPDF_TextObject* textobj, |
196 const CFX_Matrix* pObj2Device, | 194 const CFX_Matrix* pObj2Device, |
197 CPDF_Font* pFont, | 195 CPDF_Font* pFont, |
198 FX_FLOAT font_size, | 196 FX_FLOAT font_size, |
199 const CFX_Matrix* pTextMatrix, | 197 const CFX_Matrix* pTextMatrix, |
200 FX_BOOL bFill, | 198 FX_BOOL bFill, |
201 FX_BOOL bStroke); | 199 FX_BOOL bStroke); |
202 FX_BOOL ProcessForm(const CPDF_FormObject* pFormObj, | 200 FX_BOOL ProcessForm(const CPDF_FormObject* pFormObj, |
203 const CFX_Matrix* pObj2Device); | 201 const CFX_Matrix* pObj2Device); |
204 CFX_DIBitmap* GetBackdrop(const CPDF_PageObject* pObj, | 202 CFX_DIBitmap* GetBackdrop(const CPDF_PageObject* pObj, |
205 const FX_RECT& rect, | 203 const FX_RECT& rect, |
206 int& left, | 204 int& left, |
207 int& top, | 205 int& top, |
208 FX_BOOL bBackAlphaRequired); | 206 FX_BOOL bBackAlphaRequired); |
209 CFX_DIBitmap* LoadSMask(CPDF_Dictionary* pSMaskDict, | 207 CFX_DIBitmap* LoadSMask(CPDF_Dictionary* pSMaskDict, |
210 FX_RECT* pClipRect, | 208 FX_RECT* pClipRect, |
211 const CFX_Matrix* pMatrix); | 209 const CFX_Matrix* pMatrix); |
212 void Init(CPDF_RenderContext* pParent); | 210 void Init(CPDF_RenderContext* pParent); |
213 static class CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont); | 211 static class CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont); |
214 static CPDF_GraphicStates* CloneObjStates(const CPDF_GraphicStates* pPathObj, | 212 static CPDF_GraphicStates* CloneObjStates(const CPDF_GraphicStates* pPathObj, |
215 FX_BOOL bStroke); | 213 FX_BOOL bStroke); |
216 CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObject) const; | 214 CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObject) const; |
217 FX_ARGB GetFillArgb(const CPDF_PageObject* pObj, | 215 FX_ARGB GetFillArgb(CPDF_PageObject* pObj, FX_BOOL bType3 = FALSE) const; |
218 FX_BOOL bType3 = FALSE) const; | 216 FX_ARGB GetStrokeArgb(CPDF_PageObject* pObj) const; |
219 FX_ARGB GetStrokeArgb(const CPDF_PageObject* pObj) const; | |
220 FX_BOOL GetObjectClippedRect(const CPDF_PageObject* pObj, | 217 FX_BOOL GetObjectClippedRect(const CPDF_PageObject* pObj, |
221 const CFX_Matrix* pObj2Device, | 218 const CFX_Matrix* pObj2Device, |
222 FX_BOOL bLogical, | 219 FX_BOOL bLogical, |
223 FX_RECT& rect) const; | 220 FX_RECT& rect) const; |
224 void GetScaledMatrix(CFX_Matrix& matrix) const; | 221 void GetScaledMatrix(CFX_Matrix& matrix) const; |
225 | 222 |
226 static const int kRenderMaxRecursionDepth = 64; | 223 static const int kRenderMaxRecursionDepth = 64; |
227 static int s_CurrentRecursionDepth; | 224 static int s_CurrentRecursionDepth; |
228 | 225 |
229 CPDF_RenderContext* m_pContext; | 226 CPDF_RenderContext* m_pContext; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 int32_t m_nDownsampleWidth; | 301 int32_t m_nDownsampleWidth; |
305 int32_t m_nDownsampleHeight; | 302 int32_t m_nDownsampleHeight; |
306 }; | 303 }; |
307 | 304 |
308 class CPDF_ImageRenderer { | 305 class CPDF_ImageRenderer { |
309 public: | 306 public: |
310 CPDF_ImageRenderer(); | 307 CPDF_ImageRenderer(); |
311 ~CPDF_ImageRenderer(); | 308 ~CPDF_ImageRenderer(); |
312 | 309 |
313 FX_BOOL Start(CPDF_RenderStatus* pStatus, | 310 FX_BOOL Start(CPDF_RenderStatus* pStatus, |
314 const CPDF_PageObject* pObj, | 311 CPDF_PageObject* pObj, |
315 const CFX_Matrix* pObj2Device, | 312 const CFX_Matrix* pObj2Device, |
316 FX_BOOL bStdCS, | 313 FX_BOOL bStdCS, |
317 int blendType = FXDIB_BLEND_NORMAL); | 314 int blendType = FXDIB_BLEND_NORMAL); |
318 FX_BOOL Continue(IFX_Pause* pPause); | 315 FX_BOOL Continue(IFX_Pause* pPause); |
319 | 316 |
320 FX_BOOL Start(CPDF_RenderStatus* pStatus, | 317 FX_BOOL Start(CPDF_RenderStatus* pStatus, |
321 const CFX_DIBSource* pDIBSource, | 318 const CFX_DIBSource* pDIBSource, |
322 FX_ARGB bitmap_argb, | 319 FX_ARGB bitmap_argb, |
323 int bitmap_alpha, | 320 int bitmap_alpha, |
324 const CFX_Matrix* pImage2Device, | 321 const CFX_Matrix* pImage2Device, |
325 uint32_t flags, | 322 uint32_t flags, |
326 FX_BOOL bStdCS, | 323 FX_BOOL bStdCS, |
327 int blendType = FXDIB_BLEND_NORMAL); | 324 int blendType = FXDIB_BLEND_NORMAL); |
328 | 325 |
329 FX_BOOL m_Result; | 326 FX_BOOL m_Result; |
330 | 327 |
331 protected: | 328 protected: |
332 FX_BOOL StartBitmapAlpha(); | 329 FX_BOOL StartBitmapAlpha(); |
333 FX_BOOL StartDIBSource(); | 330 FX_BOOL StartDIBSource(); |
334 FX_BOOL StartRenderDIBSource(); | 331 FX_BOOL StartRenderDIBSource(); |
335 FX_BOOL StartLoadDIBSource(); | 332 FX_BOOL StartLoadDIBSource(); |
336 FX_BOOL DrawMaskedImage(); | 333 FX_BOOL DrawMaskedImage(); |
337 FX_BOOL DrawPatternImage(const CFX_Matrix* pObj2Device); | 334 FX_BOOL DrawPatternImage(const CFX_Matrix* pObj2Device); |
338 | 335 |
339 CPDF_RenderStatus* m_pRenderStatus; | 336 CPDF_RenderStatus* m_pRenderStatus; |
340 const CPDF_ImageObject* m_pImageObject; | 337 CPDF_ImageObject* m_pImageObject; |
341 int m_Status; | 338 int m_Status; |
342 const CFX_Matrix* m_pObj2Device; | 339 const CFX_Matrix* m_pObj2Device; |
343 CFX_Matrix m_ImageMatrix; | 340 CFX_Matrix m_ImageMatrix; |
344 CPDF_ImageLoader m_Loader; | 341 CPDF_ImageLoader m_Loader; |
345 const CFX_DIBSource* m_pDIBSource; | 342 const CFX_DIBSource* m_pDIBSource; |
346 std::unique_ptr<CFX_DIBitmap> m_pClone; | 343 std::unique_ptr<CFX_DIBitmap> m_pClone; |
347 int m_BitmapAlpha; | 344 int m_BitmapAlpha; |
348 FX_BOOL m_bPatternColor; | 345 FX_BOOL m_bPatternColor; |
349 CPDF_Pattern* m_pPattern; | 346 CPDF_Pattern* m_pPattern; |
350 FX_ARGB m_FillArgb; | 347 FX_ARGB m_FillArgb; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 const uint8_t* src_buf, | 590 const uint8_t* src_buf, |
594 int pixels, | 591 int pixels, |
595 int Bpp) const override; | 592 int Bpp) const override; |
596 | 593 |
597 const uint8_t* m_RampR; | 594 const uint8_t* m_RampR; |
598 const uint8_t* m_RampG; | 595 const uint8_t* m_RampG; |
599 const uint8_t* m_RampB; | 596 const uint8_t* m_RampB; |
600 }; | 597 }; |
601 | 598 |
602 #endif // CORE_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ | 599 #endif // CORE_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ |
OLD | NEW |