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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 int transparency, | 141 int transparency, |
142 FX_BOOL bDropObjects, | 142 FX_BOOL bDropObjects, |
143 CPDF_Dictionary* pFormResource = nullptr, | 143 CPDF_Dictionary* pFormResource = nullptr, |
144 FX_BOOL bStdCS = FALSE, | 144 FX_BOOL bStdCS = FALSE, |
145 CPDF_Type3Char* pType3Char = nullptr, | 145 CPDF_Type3Char* pType3Char = nullptr, |
146 FX_ARGB fill_color = 0, | 146 FX_ARGB fill_color = 0, |
147 uint32_t GroupFamily = 0, | 147 uint32_t GroupFamily = 0, |
148 FX_BOOL bLoadMask = FALSE); | 148 FX_BOOL bLoadMask = FALSE); |
149 void RenderObjectList(const CPDF_PageObjectHolder* pObjectHolder, | 149 void RenderObjectList(const CPDF_PageObjectHolder* pObjectHolder, |
150 const CFX_Matrix* pObj2Device); | 150 const CFX_Matrix* pObj2Device); |
151 void RenderSingleObject(const CPDF_PageObject* pObj, | 151 void RenderSingleObject(CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device); |
152 const CFX_Matrix* pObj2Device); | 152 FX_BOOL ContinueSingleObject(CPDF_PageObject* pObj, |
153 FX_BOOL ContinueSingleObject(const CPDF_PageObject* pObj, | |
154 const CFX_Matrix* pObj2Device, | 153 const CFX_Matrix* pObj2Device, |
155 IFX_Pause* pPause); | 154 IFX_Pause* pPause); |
156 CPDF_RenderContext* GetContext() { return m_pContext; } | 155 CPDF_RenderContext* GetContext() { return m_pContext; } |
157 | 156 |
158 #if defined _SKIA_SUPPORT_ | 157 #if defined _SKIA_SUPPORT_ |
159 void DebugVerifyDeviceIsPreMultiplied() const; | 158 void DebugVerifyDeviceIsPreMultiplied() const; |
160 #endif | 159 #endif |
161 | 160 |
162 CPDF_RenderOptions m_Options; | 161 CPDF_RenderOptions m_Options; |
163 CPDF_Dictionary* m_pFormResource; | 162 CPDF_Dictionary* m_pFormResource; |
164 CPDF_Dictionary* m_pPageResource; | 163 CPDF_Dictionary* m_pPageResource; |
165 CFX_ArrayTemplate<CPDF_Type3Font*> m_Type3FontCache; | 164 CFX_ArrayTemplate<CPDF_Type3Font*> m_Type3FontCache; |
166 | 165 |
167 protected: | 166 protected: |
168 friend class CPDF_ImageRenderer; | 167 friend class CPDF_ImageRenderer; |
169 friend class CPDF_RenderContext; | 168 friend class CPDF_RenderContext; |
170 | 169 |
171 void ProcessClipPath(CPDF_ClipPath ClipPath, const CFX_Matrix* pObj2Device); | 170 void ProcessClipPath(CPDF_ClipPath ClipPath, const CFX_Matrix* pObj2Device); |
172 void DrawClipPath(CPDF_ClipPath ClipPath, const CFX_Matrix* pObj2Device); | 171 void DrawClipPath(CPDF_ClipPath ClipPath, const CFX_Matrix* pObj2Device); |
173 FX_BOOL ProcessTransparency(const CPDF_PageObject* PageObj, | 172 FX_BOOL ProcessTransparency(CPDF_PageObject* PageObj, |
174 const CFX_Matrix* pObj2Device); | 173 const CFX_Matrix* pObj2Device); |
175 void ProcessObjectNoClip(const CPDF_PageObject* PageObj, | 174 void ProcessObjectNoClip(CPDF_PageObject* PageObj, |
176 const CFX_Matrix* pObj2Device); | 175 const CFX_Matrix* pObj2Device); |
177 void DrawObjWithBackground(const CPDF_PageObject* pObj, | 176 void DrawObjWithBackground(CPDF_PageObject* pObj, |
178 const CFX_Matrix* pObj2Device); | 177 const CFX_Matrix* pObj2Device); |
179 FX_BOOL DrawObjWithBlend(const CPDF_PageObject* pObj, | 178 FX_BOOL DrawObjWithBlend(CPDF_PageObject* pObj, |
180 const CFX_Matrix* pObj2Device); | 179 const CFX_Matrix* pObj2Device); |
181 FX_BOOL ProcessPath(const CPDF_PathObject* pPathObj, | 180 FX_BOOL ProcessPath(CPDF_PathObject* pPathObj, const CFX_Matrix* pObj2Device); |
182 const CFX_Matrix* pObj2Device); | 181 void ProcessPathPattern(CPDF_PathObject* pPathObj, |
183 void ProcessPathPattern(const CPDF_PathObject* pPathObj, | |
184 const CFX_Matrix* pObj2Device, | 182 const CFX_Matrix* pObj2Device, |
185 int& filltype, | 183 int& filltype, |
186 FX_BOOL& bStroke); | 184 FX_BOOL& bStroke); |
187 void DrawPathWithPattern(const CPDF_PathObject* pPathObj, | 185 void DrawPathWithPattern(CPDF_PathObject* pPathObj, |
188 const CFX_Matrix* pObj2Device, | 186 const CFX_Matrix* pObj2Device, |
189 const CPDF_Color* pColor, | 187 const CPDF_Color* pColor, |
190 FX_BOOL bStroke); | 188 FX_BOOL bStroke); |
191 void DrawTilingPattern(CPDF_TilingPattern* pPattern, | 189 void DrawTilingPattern(CPDF_TilingPattern* pPattern, |
192 const CPDF_PageObject* pPageObj, | 190 CPDF_PageObject* pPageObj, |
193 const CFX_Matrix* pObj2Device, | 191 const CFX_Matrix* pObj2Device, |
194 FX_BOOL bStroke); | 192 FX_BOOL bStroke); |
195 void DrawShadingPattern(CPDF_ShadingPattern* pPattern, | 193 void DrawShadingPattern(CPDF_ShadingPattern* pPattern, |
196 const CPDF_PageObject* pPageObj, | 194 const CPDF_PageObject* pPageObj, |
197 const CFX_Matrix* pObj2Device, | 195 const CFX_Matrix* pObj2Device, |
198 FX_BOOL bStroke); | 196 FX_BOOL bStroke); |
199 FX_BOOL SelectClipPath(const CPDF_PathObject* pPathObj, | 197 FX_BOOL SelectClipPath(const CPDF_PathObject* pPathObj, |
200 const CFX_Matrix* pObj2Device, | 198 const CFX_Matrix* pObj2Device, |
201 FX_BOOL bStroke); | 199 FX_BOOL bStroke); |
202 FX_BOOL ProcessImage(const CPDF_ImageObject* pImageObj, | 200 FX_BOOL ProcessImage(CPDF_ImageObject* pImageObj, |
203 const CFX_Matrix* pObj2Device); | 201 const CFX_Matrix* pObj2Device); |
204 FX_BOOL OutputBitmapAlpha(CPDF_ImageObject* pImageObj, | 202 FX_BOOL OutputBitmapAlpha(CPDF_ImageObject* pImageObj, |
205 const CFX_Matrix* pImage2Device); | 203 const CFX_Matrix* pImage2Device); |
206 FX_BOOL OutputImage(CPDF_ImageObject* pImageObj, | 204 FX_BOOL OutputImage(CPDF_ImageObject* pImageObj, |
207 const CFX_Matrix* pImage2Device); | 205 const CFX_Matrix* pImage2Device); |
208 FX_BOOL OutputDIBSource(const CFX_DIBSource* pOutputBitmap, | 206 FX_BOOL OutputDIBSource(const CFX_DIBSource* pOutputBitmap, |
209 FX_ARGB fill_argb, | 207 FX_ARGB fill_argb, |
210 int bitmap_alpha, | 208 int bitmap_alpha, |
211 const CFX_Matrix* pImage2Device, | 209 const CFX_Matrix* pImage2Device, |
212 CPDF_ImageCacheEntry* pImageCache, | 210 CPDF_ImageCacheEntry* pImageCache, |
213 uint32_t flags); | 211 uint32_t flags); |
214 void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, | 212 void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, |
215 int left, | 213 int left, |
216 int top, | 214 int top, |
217 FX_ARGB mask_argb, | 215 FX_ARGB mask_argb, |
218 int bitmap_alpha, | 216 int bitmap_alpha, |
219 int blend_mode, | 217 int blend_mode, |
220 int bIsolated); | 218 int bIsolated); |
221 void ProcessShading(const CPDF_ShadingObject* pShadingObj, | 219 void ProcessShading(const CPDF_ShadingObject* pShadingObj, |
222 const CFX_Matrix* pObj2Device); | 220 const CFX_Matrix* pObj2Device); |
223 void DrawShading(CPDF_ShadingPattern* pPattern, | 221 void DrawShading(CPDF_ShadingPattern* pPattern, |
224 CFX_Matrix* pMatrix, | 222 CFX_Matrix* pMatrix, |
225 FX_RECT& clip_rect, | 223 FX_RECT& clip_rect, |
226 int alpha, | 224 int alpha, |
227 FX_BOOL bAlphaMode); | 225 FX_BOOL bAlphaMode); |
228 FX_BOOL ProcessType3Text(const CPDF_TextObject* textobj, | 226 FX_BOOL ProcessType3Text(CPDF_TextObject* textobj, |
229 const CFX_Matrix* pObj2Device); | 227 const CFX_Matrix* pObj2Device); |
230 FX_BOOL ProcessText(const CPDF_TextObject* textobj, | 228 FX_BOOL ProcessText(CPDF_TextObject* textobj, |
231 const CFX_Matrix* pObj2Device, | 229 const CFX_Matrix* pObj2Device, |
232 CFX_PathData* pClippingPath); | 230 CFX_PathData* pClippingPath); |
233 void DrawTextPathWithPattern(const CPDF_TextObject* textobj, | 231 void DrawTextPathWithPattern(const CPDF_TextObject* textobj, |
234 const CFX_Matrix* pObj2Device, | 232 const CFX_Matrix* pObj2Device, |
235 CPDF_Font* pFont, | 233 CPDF_Font* pFont, |
236 FX_FLOAT font_size, | 234 FX_FLOAT font_size, |
237 const CFX_Matrix* pTextMatrix, | 235 const CFX_Matrix* pTextMatrix, |
238 FX_BOOL bFill, | 236 FX_BOOL bFill, |
239 FX_BOOL bStroke); | 237 FX_BOOL bStroke); |
240 FX_BOOL ProcessForm(const CPDF_FormObject* pFormObj, | 238 FX_BOOL ProcessForm(const CPDF_FormObject* pFormObj, |
241 const CFX_Matrix* pObj2Device); | 239 const CFX_Matrix* pObj2Device); |
242 CFX_DIBitmap* GetBackdrop(const CPDF_PageObject* pObj, | 240 CFX_DIBitmap* GetBackdrop(const CPDF_PageObject* pObj, |
243 const FX_RECT& rect, | 241 const FX_RECT& rect, |
244 int& left, | 242 int& left, |
245 int& top, | 243 int& top, |
246 FX_BOOL bBackAlphaRequired); | 244 FX_BOOL bBackAlphaRequired); |
247 CFX_DIBitmap* LoadSMask(CPDF_Dictionary* pSMaskDict, | 245 CFX_DIBitmap* LoadSMask(CPDF_Dictionary* pSMaskDict, |
248 FX_RECT* pClipRect, | 246 FX_RECT* pClipRect, |
249 const CFX_Matrix* pMatrix); | 247 const CFX_Matrix* pMatrix); |
250 void Init(CPDF_RenderContext* pParent); | 248 void Init(CPDF_RenderContext* pParent); |
251 static class CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont); | 249 static class CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont); |
252 static CPDF_GraphicStates* CloneObjStates(const CPDF_GraphicStates* pPathObj, | 250 static CPDF_GraphicStates* CloneObjStates(const CPDF_GraphicStates* pPathObj, |
253 FX_BOOL bStroke); | 251 FX_BOOL bStroke); |
254 CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObject) const; | 252 CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObject) const; |
255 FX_ARGB GetFillArgb(const CPDF_PageObject* pObj, | 253 FX_ARGB GetFillArgb(CPDF_PageObject* pObj, FX_BOOL bType3 = FALSE) const; |
256 FX_BOOL bType3 = FALSE) const; | 254 FX_ARGB GetStrokeArgb(CPDF_PageObject* pObj) const; |
257 FX_ARGB GetStrokeArgb(const CPDF_PageObject* pObj) const; | |
258 FX_BOOL GetObjectClippedRect(const CPDF_PageObject* pObj, | 255 FX_BOOL GetObjectClippedRect(const CPDF_PageObject* pObj, |
259 const CFX_Matrix* pObj2Device, | 256 const CFX_Matrix* pObj2Device, |
260 FX_BOOL bLogical, | 257 FX_BOOL bLogical, |
261 FX_RECT& rect) const; | 258 FX_RECT& rect) const; |
262 void GetScaledMatrix(CFX_Matrix& matrix) const; | 259 void GetScaledMatrix(CFX_Matrix& matrix) const; |
263 | 260 |
264 static const int kRenderMaxRecursionDepth = 64; | 261 static const int kRenderMaxRecursionDepth = 64; |
265 static int s_CurrentRecursionDepth; | 262 static int s_CurrentRecursionDepth; |
266 | 263 |
267 CPDF_RenderContext* m_pContext; | 264 CPDF_RenderContext* m_pContext; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 int32_t m_nDownsampleWidth; | 339 int32_t m_nDownsampleWidth; |
343 int32_t m_nDownsampleHeight; | 340 int32_t m_nDownsampleHeight; |
344 }; | 341 }; |
345 | 342 |
346 class CPDF_ImageRenderer { | 343 class CPDF_ImageRenderer { |
347 public: | 344 public: |
348 CPDF_ImageRenderer(); | 345 CPDF_ImageRenderer(); |
349 ~CPDF_ImageRenderer(); | 346 ~CPDF_ImageRenderer(); |
350 | 347 |
351 FX_BOOL Start(CPDF_RenderStatus* pStatus, | 348 FX_BOOL Start(CPDF_RenderStatus* pStatus, |
352 const CPDF_PageObject* pObj, | 349 CPDF_PageObject* pObj, |
353 const CFX_Matrix* pObj2Device, | 350 const CFX_Matrix* pObj2Device, |
354 FX_BOOL bStdCS, | 351 FX_BOOL bStdCS, |
355 int blendType = FXDIB_BLEND_NORMAL); | 352 int blendType = FXDIB_BLEND_NORMAL); |
356 FX_BOOL Continue(IFX_Pause* pPause); | 353 FX_BOOL Continue(IFX_Pause* pPause); |
357 | 354 |
358 FX_BOOL Start(CPDF_RenderStatus* pStatus, | 355 FX_BOOL Start(CPDF_RenderStatus* pStatus, |
359 const CFX_DIBSource* pDIBSource, | 356 const CFX_DIBSource* pDIBSource, |
360 FX_ARGB bitmap_argb, | 357 FX_ARGB bitmap_argb, |
361 int bitmap_alpha, | 358 int bitmap_alpha, |
362 const CFX_Matrix* pImage2Device, | 359 const CFX_Matrix* pImage2Device, |
363 uint32_t flags, | 360 uint32_t flags, |
364 FX_BOOL bStdCS, | 361 FX_BOOL bStdCS, |
365 int blendType = FXDIB_BLEND_NORMAL); | 362 int blendType = FXDIB_BLEND_NORMAL); |
366 | 363 |
367 FX_BOOL m_Result; | 364 FX_BOOL m_Result; |
368 | 365 |
369 protected: | 366 protected: |
370 FX_BOOL StartBitmapAlpha(); | 367 FX_BOOL StartBitmapAlpha(); |
371 FX_BOOL StartDIBSource(); | 368 FX_BOOL StartDIBSource(); |
372 FX_BOOL StartRenderDIBSource(); | 369 FX_BOOL StartRenderDIBSource(); |
373 FX_BOOL StartLoadDIBSource(); | 370 FX_BOOL StartLoadDIBSource(); |
374 FX_BOOL DrawMaskedImage(); | 371 FX_BOOL DrawMaskedImage(); |
375 FX_BOOL DrawPatternImage(const CFX_Matrix* pObj2Device); | 372 FX_BOOL DrawPatternImage(const CFX_Matrix* pObj2Device); |
376 | 373 |
377 CPDF_RenderStatus* m_pRenderStatus; | 374 CPDF_RenderStatus* m_pRenderStatus; |
378 const CPDF_ImageObject* m_pImageObject; | 375 CPDF_ImageObject* m_pImageObject; |
379 int m_Status; | 376 int m_Status; |
380 const CFX_Matrix* m_pObj2Device; | 377 const CFX_Matrix* m_pObj2Device; |
381 CFX_Matrix m_ImageMatrix; | 378 CFX_Matrix m_ImageMatrix; |
382 CPDF_ImageLoader m_Loader; | 379 CPDF_ImageLoader m_Loader; |
383 const CFX_DIBSource* m_pDIBSource; | 380 const CFX_DIBSource* m_pDIBSource; |
384 std::unique_ptr<CFX_DIBitmap> m_pClone; | 381 std::unique_ptr<CFX_DIBitmap> m_pClone; |
385 int m_BitmapAlpha; | 382 int m_BitmapAlpha; |
386 FX_BOOL m_bPatternColor; | 383 FX_BOOL m_bPatternColor; |
387 CPDF_Pattern* m_pPattern; | 384 CPDF_Pattern* m_pPattern; |
388 FX_ARGB m_FillArgb; | 385 FX_ARGB m_FillArgb; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 const uint8_t* src_buf, | 628 const uint8_t* src_buf, |
632 int pixels, | 629 int pixels, |
633 int Bpp) const override; | 630 int Bpp) const override; |
634 | 631 |
635 const uint8_t* m_RampR; | 632 const uint8_t* m_RampR; |
636 const uint8_t* m_RampG; | 633 const uint8_t* m_RampG; |
637 const uint8_t* m_RampB; | 634 const uint8_t* m_RampB; |
638 }; | 635 }; |
639 | 636 |
640 #endif // CORE_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ | 637 #endif // CORE_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ |
OLD | NEW |