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_PAGERENDERCACHE_H_ 8 #define CORE_FPDFAPI_RENDER_CPDF_PAGERENDERCACHE_H_ 9 10 #include <map> 11 12 #include "core/fxcrt/fx_system.h" 13 #include "core/fxcrt/retain_ptr.h" 14 #include "core/fxcrt/unowned_ptr.h" 15 16 class CFX_DIBitmap; 17 class CPDF_Image; 18 class CPDF_ImageCacheEntry; 19 class CPDF_Page; 20 class CPDF_RenderStatus; 21 class CPDF_Stream; 22 class IFX_PauseIndicator; 23 24 class CPDF_PageRenderCache { 25 public: 26 explicit CPDF_PageRenderCache(CPDF_Page* pPage); 27 ~CPDF_PageRenderCache(); 28 29 void CacheOptimization(int32_t dwLimitCacheSize); 30 uint32_t GetTimeCount() const { return m_nTimeCount; } 31 void ResetBitmap(const RetainPtr<CPDF_Image>& pImage, 32 const RetainPtr<CFX_DIBitmap>& pBitmap); 33 CPDF_Page* GetPage() const { return m_pPage.Get(); } 34 CPDF_ImageCacheEntry* GetCurImageCacheEntry() const { 35 return m_pCurImageCacheEntry; 36 } 37 38 bool StartGetCachedBitmap(const RetainPtr<CPDF_Image>& pImage, 39 bool bStdCS, 40 uint32_t GroupFamily, 41 bool bLoadMask, 42 CPDF_RenderStatus* pRenderStatus); 43 44 bool Continue(IFX_PauseIndicator* pPause, CPDF_RenderStatus* pRenderStatus); 45 46 private: 47 void ClearImageCacheEntry(CPDF_Stream* pStream); 48 49 UnownedPtr<CPDF_Page> const m_pPage; 50 CPDF_ImageCacheEntry* m_pCurImageCacheEntry; 51 std::map<CPDF_Stream*, CPDF_ImageCacheEntry*> m_ImageCache; 52 uint32_t m_nTimeCount; 53 uint32_t m_nCacheSize; 54 bool m_bCurFindCache; 55 }; 56 57 #endif // CORE_FPDFAPI_RENDER_CPDF_PAGERENDERCACHE_H_ 58