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 14 class CPDF_Stream; 15 class CPDF_ImageCacheEntry; 16 class CPDF_Page; 17 class CPDF_RenderStatus; 18 class CFX_DIBitmap; 19 class CFX_DIBSource; 20 class IFX_Pause; 21 22 class CPDF_PageRenderCache { 23 public: 24 explicit CPDF_PageRenderCache(CPDF_Page* pPage); 25 ~CPDF_PageRenderCache(); 26 27 void CacheOptimization(int32_t dwLimitCacheSize); GetTimeCount()28 uint32_t GetTimeCount() const { return m_nTimeCount; } 29 30 void ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap); GetPage()31 CPDF_Page* GetPage() const { return m_pPage; } GetCurImageCacheEntry()32 CPDF_ImageCacheEntry* GetCurImageCacheEntry() const { 33 return m_pCurImageCacheEntry; 34 } 35 36 bool StartGetCachedBitmap(CPDF_Stream* pStream, 37 bool bStdCS, 38 uint32_t GroupFamily, 39 bool bLoadMask, 40 CPDF_RenderStatus* pRenderStatus, 41 int32_t downsampleWidth, 42 int32_t downsampleHeight); 43 44 bool Continue(IFX_Pause* pPause); 45 46 private: 47 void ClearImageCacheEntry(CPDF_Stream* pStream); 48 49 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