• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 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_FXGE_DIB_CFX_IMAGESTRETCHER_H_
8 #define CORE_FXGE_DIB_CFX_IMAGESTRETCHER_H_
9 
10 #include <memory>
11 
12 #include "core/fxcrt/fx_coordinates.h"
13 #include "core/fxcrt/fx_memory.h"
14 #include "core/fxcrt/retain_ptr.h"
15 #include "core/fxcrt/unowned_ptr.h"
16 #include "core/fxge/dib/ifx_scanlinecomposer.h"
17 #include "core/fxge/fx_dib.h"
18 
19 class CFX_DIBSource;
20 class IFX_PauseIndicator;
21 
22 class CFX_ImageStretcher {
23  public:
24   CFX_ImageStretcher(IFX_ScanlineComposer* pDest,
25                      const RetainPtr<CFX_DIBSource>& pSource,
26                      int dest_width,
27                      int dest_height,
28                      const FX_RECT& bitmap_rect,
29                      uint32_t flags);
30   ~CFX_ImageStretcher();
31 
32   bool Start();
33   bool Continue(IFX_PauseIndicator* pPause);
34 
source()35   RetainPtr<CFX_DIBSource> source() { return m_pSource; }
36 
37  private:
38   bool StartQuickStretch();
39   bool StartStretch();
40   bool ContinueQuickStretch(IFX_PauseIndicator* pPause);
41   bool ContinueStretch(IFX_PauseIndicator* pPause);
42 
43   UnownedPtr<IFX_ScanlineComposer> const m_pDest;
44   RetainPtr<CFX_DIBSource> m_pSource;
45   std::unique_ptr<CStretchEngine> m_pStretchEngine;
46   std::unique_ptr<uint8_t, FxFreeDeleter> m_pScanline;
47   std::unique_ptr<uint8_t, FxFreeDeleter> m_pMaskScanline;
48   const uint32_t m_Flags;
49   bool m_bFlipX;
50   bool m_bFlipY;
51   int m_DestWidth;
52   int m_DestHeight;
53   FX_RECT m_ClipRect;
54   const FXDIB_Format m_DestFormat;
55   const int m_DestBPP;
56   int m_LineIndex;
57 };
58 
59 #endif  // CORE_FXGE_DIB_CFX_IMAGESTRETCHER_H_
60