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/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 uint32_t EstimateSize(); | |
28 void CacheOptimization(int32_t dwLimitCacheSize); | |
29 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 FX_BOOL bStdCS = FALSE, | |
37 uint32_t GroupFamily = 0, | |
38 FX_BOOL bLoadMask = FALSE, | |
39 CPDF_RenderStatus* pRenderStatus = nullptr, | |
40 int32_t downsampleWidth = 0, | |
41 int32_t downsampleHeight = 0); | |
42 | |
43 void ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap); | |
44 void ClearImageCacheEntry(CPDF_Stream* pStream); | |
45 CPDF_Page* GetPage() const { return m_pPage; } | |
46 CPDF_ImageCacheEntry* GetCurImageCacheEntry() const { | |
47 return m_pCurImageCacheEntry; | |
48 } | |
49 | |
50 FX_BOOL StartGetCachedBitmap(CPDF_Stream* pStream, | |
51 FX_BOOL bStdCS = FALSE, | |
52 uint32_t GroupFamily = 0, | |
53 FX_BOOL bLoadMask = FALSE, | |
54 CPDF_RenderStatus* pRenderStatus = nullptr, | |
55 int32_t downsampleWidth = 0, | |
56 int32_t downsampleHeight = 0); | |
57 | |
58 FX_BOOL Continue(IFX_Pause* pPause); | |
59 | |
60 protected: | |
61 friend class CPDF_Page; | |
62 | |
63 CPDF_Page* const m_pPage; | |
64 CPDF_ImageCacheEntry* m_pCurImageCacheEntry; | |
65 std::map<CPDF_Stream*, CPDF_ImageCacheEntry*> m_ImageCache; | |
66 uint32_t m_nTimeCount; | |
67 uint32_t m_nCacheSize; | |
68 FX_BOOL m_bCurFindCache; | |
69 }; | |
70 | |
71 #endif // CORE_FPDFAPI_FPDF_RENDER_CPDF_PAGERENDERCACHE_H_ | |
OLD | NEW |