1 // Copyright 2016 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef CORE_FPDFAPI_RENDER_CPDF_IMAGECACHEENTRY_H_ 8 #define CORE_FPDFAPI_RENDER_CPDF_IMAGECACHEENTRY_H_ 9 10 #include <memory> 11 12 #include "core/fxcrt/fx_system.h" 13 14 class CFX_DIBitmap; 15 class CFX_DIBSource; 16 class CPDF_Dictionary; 17 class CPDF_Document; 18 class CPDF_RenderStatus; 19 class CPDF_Stream; 20 class IFX_Pause; 21 22 class CPDF_ImageCacheEntry { 23 public: 24 CPDF_ImageCacheEntry(CPDF_Document* pDoc, CPDF_Stream* pStream); 25 ~CPDF_ImageCacheEntry(); 26 27 void Reset(const CFX_DIBitmap* pBitmap); EstimateSize()28 uint32_t EstimateSize() const { return m_dwCacheSize; } GetTimeCount()29 uint32_t GetTimeCount() const { return m_dwTimeCount; } GetStream()30 CPDF_Stream* GetStream() const { return m_pStream; } 31 32 int StartGetCachedBitmap(CPDF_Dictionary* pFormResources, 33 CPDF_Dictionary* pPageResources, 34 bool bStdCS, 35 uint32_t GroupFamily, 36 bool bLoadMask, 37 CPDF_RenderStatus* pRenderStatus, 38 int32_t downsampleWidth, 39 int32_t downsampleHeight); 40 int Continue(IFX_Pause* pPause); 41 CFX_DIBSource* DetachBitmap(); 42 CFX_DIBSource* DetachMask(); 43 44 int m_dwTimeCount; 45 uint32_t m_MatteColor; 46 47 private: 48 void ContinueGetCachedBitmap(); 49 void CalcSize(); 50 51 CPDF_RenderStatus* m_pRenderStatus; 52 CPDF_Document* m_pDocument; 53 CPDF_Stream* m_pStream; 54 CFX_DIBSource* m_pCurBitmap; 55 CFX_DIBSource* m_pCurMask; 56 std::unique_ptr<CFX_DIBSource> m_pCachedBitmap; 57 std::unique_ptr<CFX_DIBSource> m_pCachedMask; 58 uint32_t m_dwCacheSize; 59 }; 60 61 #endif // CORE_FPDFAPI_RENDER_CPDF_IMAGECACHEENTRY_H_ 62