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_SRC_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ | 7 #ifndef CORE_SRC_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ |
8 #define CORE_SRC_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ | 8 #define CORE_SRC_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 CPDF_Document* m_pPDFDoc; | 80 CPDF_Document* m_pPDFDoc; |
81 CFX_FontCache* m_pFontCache; | 81 CFX_FontCache* m_pFontCache; |
82 CPDF_Type3CacheMap m_Type3FaceMap; | 82 CPDF_Type3CacheMap m_Type3FaceMap; |
83 CPDF_TransferFuncMap m_TransferFuncMap; | 83 CPDF_TransferFuncMap m_TransferFuncMap; |
84 }; | 84 }; |
85 struct _PDF_RenderItem { | 85 struct _PDF_RenderItem { |
86 public: | 86 public: |
87 CPDF_PageObjects* m_pObjectList; | 87 CPDF_PageObjects* m_pObjectList; |
88 CFX_AffineMatrix m_Matrix; | 88 CFX_AffineMatrix m_Matrix; |
89 }; | 89 }; |
| 90 |
90 typedef CFX_ArrayTemplate<_PDF_RenderItem> CPDF_RenderLayer; | 91 typedef CFX_ArrayTemplate<_PDF_RenderItem> CPDF_RenderLayer; |
| 92 |
91 class IPDF_ObjectRenderer { | 93 class IPDF_ObjectRenderer { |
92 public: | 94 public: |
93 static IPDF_ObjectRenderer* Create(int type); | 95 static IPDF_ObjectRenderer* Create(int type); |
94 virtual ~IPDF_ObjectRenderer() {} | 96 virtual ~IPDF_ObjectRenderer() {} |
95 virtual FX_BOOL Start(CPDF_RenderStatus* pRenderStatus, | 97 virtual FX_BOOL Start(CPDF_RenderStatus* pRenderStatus, |
96 const CPDF_PageObject* pObj, | 98 const CPDF_PageObject* pObj, |
97 const CFX_AffineMatrix* pObj2Device, | 99 const CFX_AffineMatrix* pObj2Device, |
98 FX_BOOL bStdCS, | 100 FX_BOOL bStdCS, |
99 int blendType = FXDIB_BLEND_NORMAL) = 0; | 101 int blendType = FXDIB_BLEND_NORMAL) = 0; |
100 virtual FX_BOOL Continue(IFX_Pause* pPause) = 0; | 102 virtual FX_BOOL Continue(IFX_Pause* pPause) = 0; |
101 FX_BOOL m_Result; | 103 FX_BOOL m_Result; |
102 }; | 104 }; |
| 105 |
103 class CPDF_RenderStatus { | 106 class CPDF_RenderStatus { |
104 public: | 107 public: |
105 CPDF_RenderStatus(); | 108 CPDF_RenderStatus(); |
106 ~CPDF_RenderStatus(); | 109 ~CPDF_RenderStatus(); |
107 FX_BOOL Initialize(class CPDF_RenderContext* pContext, | 110 FX_BOOL Initialize(class CPDF_RenderContext* pContext, |
108 CFX_RenderDevice* pDevice, | 111 CFX_RenderDevice* pDevice, |
109 const CFX_AffineMatrix* pDeviceMatrix, | 112 const CFX_AffineMatrix* pDeviceMatrix, |
110 const CPDF_PageObject* pStopObj, | 113 const CPDF_PageObject* pStopObj, |
111 const CPDF_RenderStatus* pParentStatus, | 114 const CPDF_RenderStatus* pParentStatus, |
112 const CPDF_GraphicStates* pInitialStates, | 115 const CPDF_GraphicStates* pInitialStates, |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 FX_BOOL Continue(IFX_Pause* pPause); | 315 FX_BOOL Continue(IFX_Pause* pPause); |
313 | 316 |
314 protected: | 317 protected: |
315 CPDF_ImageLoader* m_pImageLoader; | 318 CPDF_ImageLoader* m_pImageLoader; |
316 CPDF_PageRenderCache* m_pCache; | 319 CPDF_PageRenderCache* m_pCache; |
317 CPDF_ImageObject* m_pImage; | 320 CPDF_ImageObject* m_pImage; |
318 int32_t m_nDownsampleWidth; | 321 int32_t m_nDownsampleWidth; |
319 int32_t m_nDownsampleHeight; | 322 int32_t m_nDownsampleHeight; |
320 }; | 323 }; |
321 class CFX_ImageTransformer; | 324 class CFX_ImageTransformer; |
| 325 |
322 class CPDF_ImageRenderer : public IPDF_ObjectRenderer { | 326 class CPDF_ImageRenderer : public IPDF_ObjectRenderer { |
323 public: | 327 public: |
324 CPDF_ImageRenderer(); | 328 CPDF_ImageRenderer(); |
325 ~CPDF_ImageRenderer(); | 329 ~CPDF_ImageRenderer() override; |
| 330 |
| 331 // IPDF_ObjectRenderer |
326 FX_BOOL Start(CPDF_RenderStatus* pStatus, | 332 FX_BOOL Start(CPDF_RenderStatus* pStatus, |
327 const CPDF_PageObject* pObj, | 333 const CPDF_PageObject* pObj, |
328 const CFX_AffineMatrix* pObj2Device, | 334 const CFX_AffineMatrix* pObj2Device, |
329 FX_BOOL bStdCS, | 335 FX_BOOL bStdCS, |
330 int blendType = FXDIB_BLEND_NORMAL); | 336 int blendType = FXDIB_BLEND_NORMAL) override; |
| 337 FX_BOOL Continue(IFX_Pause* pPause) override; |
| 338 |
331 FX_BOOL Start(CPDF_RenderStatus* pStatus, | 339 FX_BOOL Start(CPDF_RenderStatus* pStatus, |
332 const CFX_DIBSource* pDIBSource, | 340 const CFX_DIBSource* pDIBSource, |
333 FX_ARGB bitmap_argb, | 341 FX_ARGB bitmap_argb, |
334 int bitmap_alpha, | 342 int bitmap_alpha, |
335 const CFX_AffineMatrix* pImage2Device, | 343 const CFX_AffineMatrix* pImage2Device, |
336 FX_DWORD flags, | 344 FX_DWORD flags, |
337 FX_BOOL bStdCS, | 345 FX_BOOL bStdCS, |
338 int blendType = FXDIB_BLEND_NORMAL); | 346 int blendType = FXDIB_BLEND_NORMAL); |
339 FX_BOOL Continue(IFX_Pause* pPause); | |
340 | 347 |
341 protected: | 348 protected: |
342 CPDF_RenderStatus* m_pRenderStatus; | 349 CPDF_RenderStatus* m_pRenderStatus; |
343 CPDF_ImageObject* m_pImageObject; | 350 CPDF_ImageObject* m_pImageObject; |
344 int m_Status; | 351 int m_Status; |
345 const CFX_AffineMatrix* m_pObj2Device; | 352 const CFX_AffineMatrix* m_pObj2Device; |
346 CFX_AffineMatrix m_ImageMatrix; | 353 CFX_AffineMatrix m_ImageMatrix; |
347 CPDF_ImageLoader m_Loader; | 354 CPDF_ImageLoader m_Loader; |
348 const CFX_DIBSource* m_pDIBSource; | 355 const CFX_DIBSource* m_pDIBSource; |
349 CFX_DIBitmap* m_pClone; | 356 CFX_DIBitmap* m_pClone; |
350 int m_BitmapAlpha; | 357 int m_BitmapAlpha; |
351 FX_BOOL m_bPatternColor; | 358 FX_BOOL m_bPatternColor; |
352 CPDF_Pattern* m_pPattern; | 359 CPDF_Pattern* m_pPattern; |
353 FX_ARGB m_FillArgb; | 360 FX_ARGB m_FillArgb; |
354 FX_DWORD m_Flags; | 361 FX_DWORD m_Flags; |
355 CPDF_QuickStretcher* m_pQuickStretcher; | 362 CPDF_QuickStretcher* m_pQuickStretcher; |
356 CFX_ImageTransformer* m_pTransformer; | 363 CFX_ImageTransformer* m_pTransformer; |
357 void* m_DeviceHandle; | 364 void* m_DeviceHandle; |
358 void* m_LoadHandle; | 365 void* m_LoadHandle; |
359 FX_BOOL m_bStdCS; | 366 FX_BOOL m_bStdCS; |
360 int m_BlendType; | 367 int m_BlendType; |
361 FX_BOOL StartBitmapAlpha(); | 368 FX_BOOL StartBitmapAlpha(); |
362 FX_BOOL StartDIBSource(); | 369 FX_BOOL StartDIBSource(); |
363 FX_BOOL StartRenderDIBSource(); | 370 FX_BOOL StartRenderDIBSource(); |
364 FX_BOOL StartLoadDIBSource(); | 371 FX_BOOL StartLoadDIBSource(); |
365 FX_BOOL DrawMaskedImage(); | 372 FX_BOOL DrawMaskedImage(); |
366 FX_BOOL DrawPatternImage(const CFX_Matrix* pObj2Device); | 373 FX_BOOL DrawPatternImage(const CFX_Matrix* pObj2Device); |
367 }; | 374 }; |
| 375 |
368 class CPDF_ScaledRenderBuffer { | 376 class CPDF_ScaledRenderBuffer { |
369 public: | 377 public: |
370 CPDF_ScaledRenderBuffer(); | 378 CPDF_ScaledRenderBuffer(); |
371 ~CPDF_ScaledRenderBuffer(); | 379 ~CPDF_ScaledRenderBuffer(); |
372 FX_BOOL Initialize(CPDF_RenderContext* pContext, | 380 FX_BOOL Initialize(CPDF_RenderContext* pContext, |
373 CFX_RenderDevice* pDevice, | 381 CFX_RenderDevice* pDevice, |
374 FX_RECT* pRect, | 382 FX_RECT* pRect, |
375 const CPDF_PageObject* pObj, | 383 const CPDF_PageObject* pObj, |
376 const CPDF_RenderOptions* pOptions = NULL, | 384 const CPDF_RenderOptions* pOptions = NULL, |
377 int max_dpi = 0); | 385 int max_dpi = 0); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 CFX_DIBSource* m_pCachedMask; | 484 CFX_DIBSource* m_pCachedMask; |
477 FX_DWORD m_dwCacheSize; | 485 FX_DWORD m_dwCacheSize; |
478 void CalcSize(); | 486 void CalcSize(); |
479 }; | 487 }; |
480 typedef struct { | 488 typedef struct { |
481 FX_FLOAT m_DecodeMin; | 489 FX_FLOAT m_DecodeMin; |
482 FX_FLOAT m_DecodeStep; | 490 FX_FLOAT m_DecodeStep; |
483 int m_ColorKeyMin; | 491 int m_ColorKeyMin; |
484 int m_ColorKeyMax; | 492 int m_ColorKeyMax; |
485 } DIB_COMP_DATA; | 493 } DIB_COMP_DATA; |
| 494 |
486 class CPDF_DIBSource : public CFX_DIBSource { | 495 class CPDF_DIBSource : public CFX_DIBSource { |
487 public: | 496 public: |
488 CPDF_DIBSource(); | 497 CPDF_DIBSource(); |
489 virtual ~CPDF_DIBSource(); | 498 ~CPDF_DIBSource() override; |
| 499 |
490 FX_BOOL Load(CPDF_Document* pDoc, | 500 FX_BOOL Load(CPDF_Document* pDoc, |
491 const CPDF_Stream* pStream, | 501 const CPDF_Stream* pStream, |
492 CPDF_DIBSource** ppMask, | 502 CPDF_DIBSource** ppMask, |
493 FX_DWORD* pMatteColor, | 503 FX_DWORD* pMatteColor, |
494 CPDF_Dictionary* pFormResources, | 504 CPDF_Dictionary* pFormResources, |
495 CPDF_Dictionary* pPageResources, | 505 CPDF_Dictionary* pPageResources, |
496 FX_BOOL bStdCS = FALSE, | 506 FX_BOOL bStdCS = FALSE, |
497 FX_DWORD GroupFamily = 0, | 507 FX_DWORD GroupFamily = 0, |
498 FX_BOOL bLoadMask = FALSE); | 508 FX_BOOL bLoadMask = FALSE); |
499 virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const; | 509 |
500 virtual uint8_t* GetBuffer() const; | 510 // CFX_DIBSource |
501 virtual const uint8_t* GetScanline(int line) const; | 511 FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const override; |
502 virtual void DownSampleScanline(int line, | 512 uint8_t* GetBuffer() const override; |
503 uint8_t* dest_scan, | 513 const uint8_t* GetScanline(int line) const override; |
504 int dest_bpp, | 514 void DownSampleScanline(int line, |
505 int dest_width, | 515 uint8_t* dest_scan, |
506 FX_BOOL bFlipX, | 516 int dest_bpp, |
507 int clip_left, | 517 int dest_width, |
508 int clip_width) const; | 518 FX_BOOL bFlipX, |
509 virtual void SetDownSampleSize(int dest_width, int dest_height) const; | 519 int clip_left, |
| 520 int clip_width) const override; |
| 521 void SetDownSampleSize(int dest_width, int dest_height) const override; |
| 522 |
510 CFX_DIBitmap* GetBitmap() const; | 523 CFX_DIBitmap* GetBitmap() const; |
511 void ReleaseBitmap(CFX_DIBitmap*) const; | 524 void ReleaseBitmap(CFX_DIBitmap*) const; |
512 void ClearImageData(); | 525 void ClearImageData(); |
513 | 526 |
514 public: | 527 public: |
515 int StartLoadDIBSource(CPDF_Document* pDoc, | 528 int StartLoadDIBSource(CPDF_Document* pDoc, |
516 const CPDF_Stream* pStream, | 529 const CPDF_Stream* pStream, |
517 FX_BOOL bHasMask, | 530 FX_BOOL bHasMask, |
518 CPDF_Dictionary* pFormResources, | 531 CPDF_Dictionary* pFormResources, |
519 CPDF_Dictionary* pPageResources, | 532 CPDF_Dictionary* pPageResources, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 FX_BOOL m_bDefaultDecode; | 575 FX_BOOL m_bDefaultDecode; |
563 FX_BOOL m_bImageMask; | 576 FX_BOOL m_bImageMask; |
564 FX_BOOL m_bDoBpcCheck; | 577 FX_BOOL m_bDoBpcCheck; |
565 FX_BOOL m_bColorKey; | 578 FX_BOOL m_bColorKey; |
566 DIB_COMP_DATA* m_pCompData; | 579 DIB_COMP_DATA* m_pCompData; |
567 uint8_t* m_pLineBuf; | 580 uint8_t* m_pLineBuf; |
568 uint8_t* m_pMaskedLine; | 581 uint8_t* m_pMaskedLine; |
569 nonstd::unique_ptr<CFX_DIBitmap> m_pCachedBitmap; | 582 nonstd::unique_ptr<CFX_DIBitmap> m_pCachedBitmap; |
570 ICodec_ScanlineDecoder* m_pDecoder; | 583 ICodec_ScanlineDecoder* m_pDecoder; |
571 }; | 584 }; |
| 585 |
572 #define FPDF_HUGE_IMAGE_SIZE 60000000 | 586 #define FPDF_HUGE_IMAGE_SIZE 60000000 |
573 class CPDF_DIBTransferFunc : public CFX_FilteredDIB { | 587 class CPDF_DIBTransferFunc : public CFX_FilteredDIB { |
574 public: | 588 public: |
575 CPDF_DIBTransferFunc(const CPDF_TransferFunc* pTransferFunc); | 589 CPDF_DIBTransferFunc(const CPDF_TransferFunc* pTransferFunc); |
576 virtual FXDIB_Format GetDestFormat(); | 590 ~CPDF_DIBTransferFunc() override; |
577 virtual FX_ARGB* GetDestPalette() { return NULL; } | 591 |
578 virtual void TranslateScanline(uint8_t* dest_buf, | 592 // CFX_FilteredDIB |
579 const uint8_t* src_buf) const; | 593 FXDIB_Format GetDestFormat() override; |
580 virtual void TranslateDownSamples(uint8_t* dest_buf, | 594 FX_ARGB* GetDestPalette() override { return NULL; } |
581 const uint8_t* src_buf, | 595 void TranslateScanline(uint8_t* dest_buf, |
582 int pixels, | 596 const uint8_t* src_buf) const override; |
583 int Bpp) const; | 597 void TranslateDownSamples(uint8_t* dest_buf, |
| 598 const uint8_t* src_buf, |
| 599 int pixels, |
| 600 int Bpp) const override; |
| 601 |
584 const uint8_t* m_RampR; | 602 const uint8_t* m_RampR; |
585 const uint8_t* m_RampG; | 603 const uint8_t* m_RampG; |
586 const uint8_t* m_RampB; | 604 const uint8_t* m_RampB; |
587 }; | 605 }; |
| 606 |
588 struct _CPDF_UniqueKeyGen { | 607 struct _CPDF_UniqueKeyGen { |
589 void Generate(int count, ...); | 608 void Generate(int count, ...); |
590 FX_CHAR m_Key[128]; | 609 FX_CHAR m_Key[128]; |
591 int m_KeyLen; | 610 int m_KeyLen; |
592 }; | 611 }; |
593 | 612 |
594 #endif // CORE_SRC_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ | 613 #endif // CORE_SRC_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ |
OLD | NEW |