| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 protected: | 48 protected: |
| 49 CFX_GlyphBitmap* RenderGlyph(CPDF_Type3Glyphs* pSize, | 49 CFX_GlyphBitmap* RenderGlyph(CPDF_Type3Glyphs* pSize, |
| 50 FX_DWORD charcode, | 50 FX_DWORD charcode, |
| 51 const CFX_AffineMatrix* pMatrix, | 51 const CFX_AffineMatrix* pMatrix, |
| 52 FX_FLOAT retinaScaleX = 1.0f, | 52 FX_FLOAT retinaScaleX = 1.0f, |
| 53 FX_FLOAT retinaScaleY = 1.0f); | 53 FX_FLOAT retinaScaleY = 1.0f); |
| 54 CPDF_Type3Font* const m_pFont; | 54 CPDF_Type3Font* const m_pFont; |
| 55 std::map<CFX_ByteString, CPDF_Type3Glyphs*> m_SizeMap; | 55 std::map<CFX_ByteString, CPDF_Type3Glyphs*> m_SizeMap; |
| 56 }; | 56 }; |
| 57 |
| 57 class CPDF_TransferFunc { | 58 class CPDF_TransferFunc { |
| 58 public: | 59 public: |
| 59 CPDF_Document* m_pPDFDoc; | 60 explicit CPDF_TransferFunc(CPDF_Document* pDoc); |
| 60 uint8_t m_Samples[256 * 3]; | |
| 61 FX_BOOL m_bIdentity; | |
| 62 | 61 |
| 62 FX_COLORREF TranslateColor(FX_COLORREF src) const; |
| 63 CFX_DIBSource* TranslateImage(const CFX_DIBSource* pSrc, | 63 CFX_DIBSource* TranslateImage(const CFX_DIBSource* pSrc, |
| 64 FX_BOOL bAutoDropSrc); | 64 FX_BOOL bAutoDropSrc); |
| 65 FX_COLORREF TranslateColor(FX_COLORREF src); | 65 |
| 66 CPDF_Document* const m_pPDFDoc; |
| 67 FX_BOOL m_bIdentity; |
| 68 uint8_t m_Samples[256 * 3]; |
| 66 }; | 69 }; |
| 67 | 70 |
| 68 class CPDF_DocRenderData { | 71 class CPDF_DocRenderData { |
| 69 public: | 72 public: |
| 70 CPDF_DocRenderData(CPDF_Document* pPDFDoc = NULL); | 73 CPDF_DocRenderData(CPDF_Document* pPDFDoc = NULL); |
| 71 ~CPDF_DocRenderData(); | 74 ~CPDF_DocRenderData(); |
| 72 CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont); | 75 CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont); |
| 73 CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObj); | 76 CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObj); |
| 74 CFX_FontCache* GetFontCache() { return m_pFontCache; } | 77 CFX_FontCache* GetFontCache() { return m_pFontCache; } |
| 75 void Clear(FX_BOOL bRelease = FALSE); | 78 void Clear(FX_BOOL bRelease = FALSE); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 static const int kRenderMaxRecursionDepth = 64; | 249 static const int kRenderMaxRecursionDepth = 64; |
| 247 static int s_CurrentRecursionDepth; | 250 static int s_CurrentRecursionDepth; |
| 248 | 251 |
| 249 CFX_RenderDevice* m_pDevice; | 252 CFX_RenderDevice* m_pDevice; |
| 250 CFX_AffineMatrix m_DeviceMatrix; | 253 CFX_AffineMatrix m_DeviceMatrix; |
| 251 CPDF_ClipPath m_LastClipPath; | 254 CPDF_ClipPath m_LastClipPath; |
| 252 const CPDF_PageObject* m_pCurObj; | 255 const CPDF_PageObject* m_pCurObj; |
| 253 const CPDF_PageObject* m_pStopObj; | 256 const CPDF_PageObject* m_pStopObj; |
| 254 CPDF_GraphicStates m_InitialStates; | 257 CPDF_GraphicStates m_InitialStates; |
| 255 int m_HalftoneLimit; | 258 int m_HalftoneLimit; |
| 256 IPDF_ObjectRenderer* m_pObjectRenderer; | 259 nonstd::unique_ptr<IPDF_ObjectRenderer> m_pObjectRenderer; |
| 257 FX_BOOL m_bPrint; | 260 FX_BOOL m_bPrint; |
| 258 int m_Transparency; | 261 int m_Transparency; |
| 259 int m_DitherBits; | 262 int m_DitherBits; |
| 260 FX_BOOL m_bDropObjects; | 263 FX_BOOL m_bDropObjects; |
| 261 FX_BOOL m_bStdCS; | 264 FX_BOOL m_bStdCS; |
| 262 FX_DWORD m_GroupFamily; | 265 FX_DWORD m_GroupFamily; |
| 263 FX_BOOL m_bLoadMask; | 266 FX_BOOL m_bLoadMask; |
| 264 CPDF_Type3Char* m_pType3Char; | 267 CPDF_Type3Char* m_pType3Char; |
| 265 FX_ARGB m_T3FillColor; | 268 FX_ARGB m_T3FillColor; |
| 266 int m_curBlend; | 269 int m_curBlend; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 FX_BOOL StartRenderDIBSource(); | 378 FX_BOOL StartRenderDIBSource(); |
| 376 FX_BOOL StartLoadDIBSource(); | 379 FX_BOOL StartLoadDIBSource(); |
| 377 FX_BOOL DrawMaskedImage(); | 380 FX_BOOL DrawMaskedImage(); |
| 378 FX_BOOL DrawPatternImage(const CFX_Matrix* pObj2Device); | 381 FX_BOOL DrawPatternImage(const CFX_Matrix* pObj2Device); |
| 379 }; | 382 }; |
| 380 | 383 |
| 381 class CPDF_ScaledRenderBuffer { | 384 class CPDF_ScaledRenderBuffer { |
| 382 public: | 385 public: |
| 383 CPDF_ScaledRenderBuffer(); | 386 CPDF_ScaledRenderBuffer(); |
| 384 ~CPDF_ScaledRenderBuffer(); | 387 ~CPDF_ScaledRenderBuffer(); |
| 388 |
| 385 FX_BOOL Initialize(CPDF_RenderContext* pContext, | 389 FX_BOOL Initialize(CPDF_RenderContext* pContext, |
| 386 CFX_RenderDevice* pDevice, | 390 CFX_RenderDevice* pDevice, |
| 387 FX_RECT* pRect, | 391 FX_RECT* pRect, |
| 388 const CPDF_PageObject* pObj, | 392 const CPDF_PageObject* pObj, |
| 389 const CPDF_RenderOptions* pOptions = NULL, | 393 const CPDF_RenderOptions* pOptions = NULL, |
| 390 int max_dpi = 0); | 394 int max_dpi = 0); |
| 391 CFX_RenderDevice* GetDevice() { | 395 CFX_RenderDevice* GetDevice() { |
| 392 return m_pBitmapDevice ? m_pBitmapDevice : m_pDevice; | 396 return m_pBitmapDevice ? m_pBitmapDevice.get() : m_pDevice; |
| 393 } | 397 } |
| 394 CFX_AffineMatrix* GetMatrix() { return &m_Matrix; } | 398 CFX_AffineMatrix* GetMatrix() { return &m_Matrix; } |
| 395 void OutputToDevice(); | 399 void OutputToDevice(); |
| 396 | 400 |
| 397 private: | 401 private: |
| 398 CFX_RenderDevice* m_pDevice; | 402 CFX_RenderDevice* m_pDevice; |
| 399 CPDF_RenderContext* m_pContext; | 403 CPDF_RenderContext* m_pContext; |
| 400 FX_RECT m_Rect; | 404 FX_RECT m_Rect; |
| 401 const CPDF_PageObject* m_pObject; | 405 const CPDF_PageObject* m_pObject; |
| 402 CFX_FxgeDevice* m_pBitmapDevice; | 406 nonstd::unique_ptr<CFX_FxgeDevice> m_pBitmapDevice; |
| 403 CFX_AffineMatrix m_Matrix; | 407 CFX_AffineMatrix m_Matrix; |
| 404 }; | 408 }; |
| 409 |
| 405 class ICodec_ScanlineDecoder; | 410 class ICodec_ScanlineDecoder; |
| 406 class CPDF_QuickStretcher { | 411 class CPDF_QuickStretcher { |
| 407 public: | 412 public: |
| 408 CPDF_QuickStretcher(); | 413 CPDF_QuickStretcher(); |
| 409 ~CPDF_QuickStretcher(); | 414 ~CPDF_QuickStretcher(); |
| 410 FX_BOOL Start(CPDF_ImageObject* pImageObj, | 415 FX_BOOL Start(CPDF_ImageObject* pImageObj, |
| 411 CFX_AffineMatrix* pImage2Device, | 416 CFX_AffineMatrix* pImage2Device, |
| 412 const FX_RECT* pClipBox); | 417 const FX_RECT* pClipBox); |
| 413 FX_BOOL Continue(IFX_Pause* pPause); | 418 FX_BOOL Continue(IFX_Pause* pPause); |
| 414 CFX_DIBitmap* m_pBitmap; | 419 CFX_DIBitmap* m_pBitmap; |
| 415 int m_ResultLeft, m_ResultTop, m_ClipLeft, m_ClipTop; | 420 int m_ResultLeft, m_ResultTop, m_ClipLeft, m_ClipTop; |
| 416 int m_DestWidth, m_DestHeight, m_ResultWidth, m_ResultHeight; | 421 int m_DestWidth, m_DestHeight, m_ResultWidth, m_ResultHeight; |
| 417 int m_Bpp, m_SrcWidth, m_SrcHeight; | 422 int m_Bpp, m_SrcWidth, m_SrcHeight; |
| 418 FX_BOOL m_bFlipX, m_bFlipY; | 423 FX_BOOL m_bFlipX, m_bFlipY; |
| 419 CPDF_ColorSpace* m_pCS; | 424 CPDF_ColorSpace* m_pCS; |
| 420 ICodec_ScanlineDecoder* m_pDecoder; | 425 ICodec_ScanlineDecoder* m_pDecoder; |
| 421 CPDF_StreamAcc m_StreamAcc; | 426 CPDF_StreamAcc m_StreamAcc; |
| 422 int m_LineIndex; | 427 int m_LineIndex; |
| 423 }; | 428 }; |
| 429 |
| 424 class CPDF_DeviceBuffer { | 430 class CPDF_DeviceBuffer { |
| 425 public: | 431 public: |
| 426 CPDF_DeviceBuffer(); | 432 CPDF_DeviceBuffer(); |
| 427 ~CPDF_DeviceBuffer(); | 433 ~CPDF_DeviceBuffer(); |
| 428 FX_BOOL Initialize(CPDF_RenderContext* pContext, | 434 FX_BOOL Initialize(CPDF_RenderContext* pContext, |
| 429 CFX_RenderDevice* pDevice, | 435 CFX_RenderDevice* pDevice, |
| 430 FX_RECT* pRect, | 436 FX_RECT* pRect, |
| 431 const CPDF_PageObject* pObj, | 437 const CPDF_PageObject* pObj, |
| 432 int max_dpi = 0); | 438 int max_dpi = 0); |
| 433 void OutputToDevice(); | 439 void OutputToDevice(); |
| 434 CFX_DIBitmap* GetBitmap() const { return m_pBitmap; } | 440 CFX_DIBitmap* GetBitmap() const { return m_pBitmap.get(); } |
| 435 const CFX_AffineMatrix* GetMatrix() const { return &m_Matrix; } | 441 const CFX_AffineMatrix* GetMatrix() const { return &m_Matrix; } |
| 436 | 442 |
| 437 private: | 443 private: |
| 438 CFX_RenderDevice* m_pDevice; | 444 CFX_RenderDevice* m_pDevice; |
| 439 CPDF_RenderContext* m_pContext; | 445 CPDF_RenderContext* m_pContext; |
| 440 FX_RECT m_Rect; | 446 FX_RECT m_Rect; |
| 441 const CPDF_PageObject* m_pObject; | 447 const CPDF_PageObject* m_pObject; |
| 442 CFX_DIBitmap* m_pBitmap; | 448 nonstd::unique_ptr<CFX_DIBitmap> m_pBitmap; |
| 443 CFX_AffineMatrix m_Matrix; | 449 CFX_AffineMatrix m_Matrix; |
| 444 }; | 450 }; |
| 451 |
| 445 class CPDF_ImageCache { | 452 class CPDF_ImageCache { |
| 446 public: | 453 public: |
| 447 CPDF_ImageCache(CPDF_Document* pDoc, CPDF_Stream* pStream); | 454 CPDF_ImageCache(CPDF_Document* pDoc, CPDF_Stream* pStream); |
| 448 ~CPDF_ImageCache(); | 455 ~CPDF_ImageCache(); |
| 449 void ClearImageData(); | 456 void ClearImageData(); |
| 450 void Reset(const CFX_DIBitmap* pBitmap); | 457 void Reset(const CFX_DIBitmap* pBitmap); |
| 451 FX_BOOL GetCachedBitmap(CFX_DIBSource*& pBitmap, | 458 FX_BOOL GetCachedBitmap(CFX_DIBSource*& pBitmap, |
| 452 CFX_DIBSource*& pMask, | 459 CFX_DIBSource*& pMask, |
| 453 FX_DWORD& MatteColor, | 460 FX_DWORD& MatteColor, |
| 454 CPDF_Dictionary* pPageResources, | 461 CPDF_Dictionary* pPageResources, |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 const uint8_t* m_RampB; | 644 const uint8_t* m_RampB; |
| 638 }; | 645 }; |
| 639 | 646 |
| 640 struct _CPDF_UniqueKeyGen { | 647 struct _CPDF_UniqueKeyGen { |
| 641 void Generate(int count, ...); | 648 void Generate(int count, ...); |
| 642 FX_CHAR m_Key[128]; | 649 FX_CHAR m_Key[128]; |
| 643 int m_KeyLen; | 650 int m_KeyLen; |
| 644 }; | 651 }; |
| 645 | 652 |
| 646 #endif // CORE_SRC_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ | 653 #endif // CORE_SRC_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ |
| OLD | NEW |