OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_FPDFAPI_RENDER_CPDF_PAGERENDERCACHE_H_ | 7 #ifndef CORE_FPDFAPI_RENDER_CPDF_PAGERENDERCACHE_H_ |
8 #define CORE_FPDFAPI_RENDER_CPDF_PAGERENDERCACHE_H_ | 8 #define CORE_FPDFAPI_RENDER_CPDF_PAGERENDERCACHE_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "core/fxcrt/fx_system.h" | 12 #include "core/fxcrt/fx_system.h" |
13 | 13 |
14 class CPDF_Stream; | 14 class CPDF_Stream; |
15 class CPDF_ImageCacheEntry; | 15 class CPDF_ImageCacheEntry; |
16 class CPDF_Page; | 16 class CPDF_Page; |
17 class CPDF_RenderStatus; | 17 class CPDF_RenderStatus; |
18 class CFX_DIBitmap; | 18 class CFX_DIBitmap; |
19 class CFX_DIBSource; | 19 class CFX_DIBSource; |
20 class IFX_Pause; | 20 class IFX_Pause; |
21 | 21 |
22 class CPDF_PageRenderCache { | 22 class CPDF_PageRenderCache { |
23 public: | 23 public: |
24 explicit CPDF_PageRenderCache(CPDF_Page* pPage); | 24 explicit CPDF_PageRenderCache(CPDF_Page* pPage); |
25 ~CPDF_PageRenderCache(); | 25 ~CPDF_PageRenderCache(); |
26 | 26 |
27 uint32_t EstimateSize(); | |
28 void CacheOptimization(int32_t dwLimitCacheSize); | 27 void CacheOptimization(int32_t dwLimitCacheSize); |
29 uint32_t GetTimeCount() const { return m_nTimeCount; } | 28 uint32_t GetTimeCount() const { return m_nTimeCount; } |
30 void SetTimeCount(uint32_t dwTimeCount) { m_nTimeCount = dwTimeCount; } | |
31 | |
32 void GetCachedBitmap(CPDF_Stream* pStream, | |
33 CFX_DIBSource*& pBitmap, | |
34 CFX_DIBSource*& pMask, | |
35 uint32_t& MatteColor, | |
36 bool bStdCS = false, | |
37 uint32_t GroupFamily = 0, | |
38 bool bLoadMask = false, | |
39 CPDF_RenderStatus* pRenderStatus = nullptr, | |
40 int32_t downsampleWidth = 0, | |
41 int32_t downsampleHeight = 0); | |
42 | 29 |
43 void ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap); | 30 void ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap); |
44 void ClearImageCacheEntry(CPDF_Stream* pStream); | |
45 CPDF_Page* GetPage() const { return m_pPage; } | 31 CPDF_Page* GetPage() const { return m_pPage; } |
46 CPDF_ImageCacheEntry* GetCurImageCacheEntry() const { | 32 CPDF_ImageCacheEntry* GetCurImageCacheEntry() const { |
47 return m_pCurImageCacheEntry; | 33 return m_pCurImageCacheEntry; |
48 } | 34 } |
49 | 35 |
50 bool StartGetCachedBitmap(CPDF_Stream* pStream, | 36 bool StartGetCachedBitmap(CPDF_Stream* pStream, |
51 bool bStdCS = false, | 37 bool bStdCS, |
52 uint32_t GroupFamily = 0, | 38 uint32_t GroupFamily, |
53 bool bLoadMask = false, | 39 bool bLoadMask, |
54 CPDF_RenderStatus* pRenderStatus = nullptr, | 40 CPDF_RenderStatus* pRenderStatus, |
55 int32_t downsampleWidth = 0, | 41 int32_t downsampleWidth, |
56 int32_t downsampleHeight = 0); | 42 int32_t downsampleHeight); |
57 | 43 |
58 bool Continue(IFX_Pause* pPause); | 44 bool Continue(IFX_Pause* pPause); |
59 | 45 |
60 protected: | 46 private: |
| 47 void ClearImageCacheEntry(CPDF_Stream* pStream); |
| 48 |
61 CPDF_Page* const m_pPage; | 49 CPDF_Page* const m_pPage; |
62 CPDF_ImageCacheEntry* m_pCurImageCacheEntry; | 50 CPDF_ImageCacheEntry* m_pCurImageCacheEntry; |
63 std::map<CPDF_Stream*, CPDF_ImageCacheEntry*> m_ImageCache; | 51 std::map<CPDF_Stream*, CPDF_ImageCacheEntry*> m_ImageCache; |
64 uint32_t m_nTimeCount; | 52 uint32_t m_nTimeCount; |
65 uint32_t m_nCacheSize; | 53 uint32_t m_nCacheSize; |
66 bool m_bCurFindCache; | 54 bool m_bCurFindCache; |
67 }; | 55 }; |
68 | 56 |
69 #endif // CORE_FPDFAPI_RENDER_CPDF_PAGERENDERCACHE_H_ | 57 #endif // CORE_FPDFAPI_RENDER_CPDF_PAGERENDERCACHE_H_ |
OLD | NEW |