• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_IMAGECACHEENTRY_H_
8 #define CORE_FPDFAPI_RENDER_CPDF_IMAGECACHEENTRY_H_
9 
10 #include <memory>
11 
12 #include "core/fxcrt/fx_system.h"
13 #include "core/fxcrt/retain_ptr.h"
14 #include "core/fxcrt/unowned_ptr.h"
15 
16 class CFX_DIBSource;
17 class CFX_DIBitmap;
18 class CPDF_Dictionary;
19 class CPDF_Document;
20 class CPDF_Image;
21 class CPDF_RenderStatus;
22 class IFX_PauseIndicator;
23 
24 class CPDF_ImageCacheEntry {
25  public:
26   CPDF_ImageCacheEntry(CPDF_Document* pDoc,
27                        const RetainPtr<CPDF_Image>& pImage);
28   ~CPDF_ImageCacheEntry();
29 
30   void Reset(const RetainPtr<CFX_DIBitmap>& pBitmap);
EstimateSize()31   uint32_t EstimateSize() const { return m_dwCacheSize; }
GetTimeCount()32   uint32_t GetTimeCount() const { return m_dwTimeCount; }
GetImage()33   CPDF_Image* GetImage() const { return m_pImage.Get(); }
34   int StartGetCachedBitmap(CPDF_Dictionary* pFormResources,
35                            CPDF_Dictionary* pPageResources,
36                            bool bStdCS,
37                            uint32_t GroupFamily,
38                            bool bLoadMask,
39                            CPDF_RenderStatus* pRenderStatus);
40   int Continue(IFX_PauseIndicator* pPause, CPDF_RenderStatus* pRenderStatus);
41   RetainPtr<CFX_DIBSource> DetachBitmap();
42   RetainPtr<CFX_DIBSource> DetachMask();
43 
44   int m_dwTimeCount;
45   uint32_t m_MatteColor;
46 
47  private:
48   void ContinueGetCachedBitmap(CPDF_RenderStatus* pRenderStatus);
49   void CalcSize();
50 
51   UnownedPtr<CPDF_Document> const m_pDocument;
52   RetainPtr<CPDF_Image> const m_pImage;
53   RetainPtr<CFX_DIBSource> m_pCurBitmap;
54   RetainPtr<CFX_DIBSource> m_pCurMask;
55   RetainPtr<CFX_DIBSource> m_pCachedBitmap;
56   RetainPtr<CFX_DIBSource> m_pCachedMask;
57   uint32_t m_dwCacheSize;
58 };
59 
60 #endif  // CORE_FPDFAPI_RENDER_CPDF_IMAGECACHEENTRY_H_
61