OLD | NEW |
(Empty) | |
| 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_FPDF_RENDER_CPDF_PAGERENDERCACHE_H_ |
| 8 #define CORE_FPDFAPI_FPDF_RENDER_CPDF_PAGERENDERCACHE_H_ |
| 9 |
| 10 #include <map> |
| 11 |
| 12 #include "core/include/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 : m_pPage(pPage), |
| 26 m_pCurImageCacheEntry(nullptr), |
| 27 m_nTimeCount(0), |
| 28 m_nCacheSize(0), |
| 29 m_bCurFindCache(FALSE) {} |
| 30 ~CPDF_PageRenderCache(); |
| 31 void ClearImageData(); |
| 32 |
| 33 FX_DWORD EstimateSize(); |
| 34 void CacheOptimization(int32_t dwLimitCacheSize); |
| 35 FX_DWORD GetTimeCount() const { return m_nTimeCount; } |
| 36 void SetTimeCount(FX_DWORD dwTimeCount) { m_nTimeCount = dwTimeCount; } |
| 37 |
| 38 void GetCachedBitmap(CPDF_Stream* pStream, |
| 39 CFX_DIBSource*& pBitmap, |
| 40 CFX_DIBSource*& pMask, |
| 41 FX_DWORD& MatteColor, |
| 42 FX_BOOL bStdCS = FALSE, |
| 43 FX_DWORD GroupFamily = 0, |
| 44 FX_BOOL bLoadMask = FALSE, |
| 45 CPDF_RenderStatus* pRenderStatus = NULL, |
| 46 int32_t downsampleWidth = 0, |
| 47 int32_t downsampleHeight = 0); |
| 48 |
| 49 void ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap); |
| 50 void ClearImageCacheEntry(CPDF_Stream* pStream); |
| 51 CPDF_Page* GetPage() const { return m_pPage; } |
| 52 CPDF_ImageCacheEntry* GetCurImageCacheEntry() const { |
| 53 return m_pCurImageCacheEntry; |
| 54 } |
| 55 |
| 56 FX_BOOL StartGetCachedBitmap(CPDF_Stream* pStream, |
| 57 FX_BOOL bStdCS = FALSE, |
| 58 FX_DWORD GroupFamily = 0, |
| 59 FX_BOOL bLoadMask = FALSE, |
| 60 CPDF_RenderStatus* pRenderStatus = NULL, |
| 61 int32_t downsampleWidth = 0, |
| 62 int32_t downsampleHeight = 0); |
| 63 |
| 64 FX_BOOL Continue(IFX_Pause* pPause); |
| 65 |
| 66 protected: |
| 67 friend class CPDF_Page; |
| 68 |
| 69 CPDF_Page* const m_pPage; |
| 70 CPDF_ImageCacheEntry* m_pCurImageCacheEntry; |
| 71 std::map<CPDF_Stream*, CPDF_ImageCacheEntry*> m_ImageCache; |
| 72 FX_DWORD m_nTimeCount; |
| 73 FX_DWORD m_nCacheSize; |
| 74 FX_BOOL m_bCurFindCache; |
| 75 }; |
| 76 |
| 77 #endif // CORE_FPDFAPI_FPDF_RENDER_CPDF_PAGERENDERCACHE_H_ |
OLD | NEW |