OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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_INCLUDE_FPDFAPI_FPDF_RENDER_H_ | 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_ |
8 #define CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_ | 8 #define CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_ |
9 | 9 |
| 10 #include <map> |
| 11 |
| 12 #include "core/include/fpdfapi/fpdf_page.h" |
10 #include "core/include/fxge/fx_ge.h" | 13 #include "core/include/fxge/fx_ge.h" |
11 #include "fpdf_page.h" | |
12 #include "third_party/base/nonstd_unique_ptr.h" | 14 #include "third_party/base/nonstd_unique_ptr.h" |
13 | 15 |
14 class CFX_GraphStateData; | 16 class CFX_GraphStateData; |
15 class CFX_PathData; | 17 class CFX_PathData; |
16 class CFX_RenderDevice; | 18 class CFX_RenderDevice; |
17 class CPDF_FormObject; | 19 class CPDF_FormObject; |
18 class CPDF_ImageCache; | 20 class CPDF_ImageCacheEntry; |
19 class CPDF_ImageObject; | 21 class CPDF_ImageObject; |
20 class CPDF_PathObject; | 22 class CPDF_PathObject; |
21 class CPDF_RenderContext; | 23 class CPDF_RenderContext; |
22 class CPDF_RenderOptions; | 24 class CPDF_RenderOptions; |
23 class CPDF_RenderStatus; | 25 class CPDF_RenderStatus; |
24 class CPDF_ShadingObject; | 26 class CPDF_ShadingObject; |
25 class CPDF_TextObject; | 27 class CPDF_TextObject; |
26 class IFX_Pause; | 28 class IFX_Pause; |
27 | 29 |
28 class IPDF_OCContext { | 30 class IPDF_OCContext { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 int nChars, | 209 int nChars, |
208 FX_DWORD* pCharCodes, | 210 FX_DWORD* pCharCodes, |
209 FX_FLOAT* pCharPos, | 211 FX_FLOAT* pCharPos, |
210 CPDF_Font* pFont, | 212 CPDF_Font* pFont, |
211 FX_FLOAT font_size, | 213 FX_FLOAT font_size, |
212 const CFX_Matrix* pText2Device, | 214 const CFX_Matrix* pText2Device, |
213 FX_ARGB fill_argb); | 215 FX_ARGB fill_argb); |
214 }; | 216 }; |
215 class CPDF_PageRenderCache { | 217 class CPDF_PageRenderCache { |
216 public: | 218 public: |
217 CPDF_PageRenderCache(CPDF_Page* pPage) { | 219 explicit CPDF_PageRenderCache(CPDF_Page* pPage) |
218 m_pPage = pPage; | 220 : m_pPage(pPage), |
219 m_nTimeCount = 0; | 221 m_pCurImageCacheEntry(nullptr), |
220 m_nCacheSize = 0; | 222 m_nTimeCount(0), |
221 m_pCurImageCache = NULL; | 223 m_nCacheSize(0), |
222 m_bCurFindCache = FALSE; | 224 m_bCurFindCache(FALSE) {} |
223 } | 225 ~CPDF_PageRenderCache(); |
224 ~CPDF_PageRenderCache() { ClearAll(); } | |
225 void ClearAll(); | |
226 void ClearImageData(); | 226 void ClearImageData(); |
227 | 227 |
228 FX_DWORD EstimateSize(); | 228 FX_DWORD EstimateSize(); |
229 void CacheOptimization(int32_t dwLimitCacheSize); | 229 void CacheOptimization(int32_t dwLimitCacheSize); |
230 FX_DWORD GetCachedSize(CPDF_Stream* pStream) const; | |
231 FX_DWORD GetTimeCount() const { return m_nTimeCount; } | 230 FX_DWORD GetTimeCount() const { return m_nTimeCount; } |
232 void SetTimeCount(FX_DWORD dwTimeCount) { m_nTimeCount = dwTimeCount; } | 231 void SetTimeCount(FX_DWORD dwTimeCount) { m_nTimeCount = dwTimeCount; } |
233 | 232 |
234 void GetCachedBitmap(CPDF_Stream* pStream, | 233 void GetCachedBitmap(CPDF_Stream* pStream, |
235 CFX_DIBSource*& pBitmap, | 234 CFX_DIBSource*& pBitmap, |
236 CFX_DIBSource*& pMask, | 235 CFX_DIBSource*& pMask, |
237 FX_DWORD& MatteColor, | 236 FX_DWORD& MatteColor, |
238 FX_BOOL bStdCS = FALSE, | 237 FX_BOOL bStdCS = FALSE, |
239 FX_DWORD GroupFamily = 0, | 238 FX_DWORD GroupFamily = 0, |
240 FX_BOOL bLoadMask = FALSE, | 239 FX_BOOL bLoadMask = FALSE, |
241 CPDF_RenderStatus* pRenderStatus = NULL, | 240 CPDF_RenderStatus* pRenderStatus = NULL, |
242 int32_t downsampleWidth = 0, | 241 int32_t downsampleWidth = 0, |
243 int32_t downsampleHeight = 0); | 242 int32_t downsampleHeight = 0); |
244 | 243 |
245 void ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap); | 244 void ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap); |
246 void ClearImageCache(CPDF_Stream* pStream); | 245 void ClearImageCacheEntry(CPDF_Stream* pStream); |
247 CPDF_Page* GetPage() { return m_pPage; } | 246 CPDF_Page* GetPage() const { return m_pPage; } |
248 CFX_MapPtrToPtr m_ImageCaches; | 247 CPDF_ImageCacheEntry* GetCurImageCacheEntry() const { |
| 248 return m_pCurImageCacheEntry; |
| 249 } |
249 | 250 |
250 public: | |
251 FX_BOOL StartGetCachedBitmap(CPDF_Stream* pStream, | 251 FX_BOOL StartGetCachedBitmap(CPDF_Stream* pStream, |
252 FX_BOOL bStdCS = FALSE, | 252 FX_BOOL bStdCS = FALSE, |
253 FX_DWORD GroupFamily = 0, | 253 FX_DWORD GroupFamily = 0, |
254 FX_BOOL bLoadMask = FALSE, | 254 FX_BOOL bLoadMask = FALSE, |
255 CPDF_RenderStatus* pRenderStatus = NULL, | 255 CPDF_RenderStatus* pRenderStatus = NULL, |
256 int32_t downsampleWidth = 0, | 256 int32_t downsampleWidth = 0, |
257 int32_t downsampleHeight = 0); | 257 int32_t downsampleHeight = 0); |
258 | 258 |
259 FX_BOOL Continue(IFX_Pause* pPause); | 259 FX_BOOL Continue(IFX_Pause* pPause); |
260 CPDF_ImageCache* m_pCurImageCache; | |
261 | 260 |
262 protected: | 261 protected: |
263 friend class CPDF_Page; | 262 friend class CPDF_Page; |
264 CPDF_Page* m_pPage; | 263 CPDF_Page* const m_pPage; |
265 | 264 CPDF_ImageCacheEntry* m_pCurImageCacheEntry; |
| 265 std::map<CPDF_Stream*, CPDF_ImageCacheEntry*> m_ImageCache; |
266 FX_DWORD m_nTimeCount; | 266 FX_DWORD m_nTimeCount; |
267 FX_DWORD m_nCacheSize; | 267 FX_DWORD m_nCacheSize; |
268 FX_BOOL m_bCurFindCache; | 268 FX_BOOL m_bCurFindCache; |
269 }; | 269 }; |
270 class CPDF_RenderConfig { | 270 class CPDF_RenderConfig { |
271 public: | 271 public: |
272 CPDF_RenderConfig(); | 272 CPDF_RenderConfig(); |
273 ~CPDF_RenderConfig(); | 273 ~CPDF_RenderConfig(); |
274 int m_HalftoneLimit; | 274 int m_HalftoneLimit; |
275 int m_RenderStepLimit; | 275 int m_RenderStepLimit; |
276 }; | 276 }; |
277 | 277 |
278 FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix); | 278 FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix); |
279 | 279 |
280 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_ | 280 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_ |
OLD | NEW |