• 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_wrappers.h"
14 #include "core/fxcrt/retain_ptr.h"
15 #include "core/fxcrt/unowned_ptr.h"
16 #include "core/fxge/dib/scanlinecomposer_iface.h"
17 #include "core/fxge/fx_dib.h"
18 
19 class CFX_DIBBase;
20 class CStretchEngine;
21 class PauseIndicatorIface;
22 
23 class CFX_ImageStretcher {
24  public:
25   CFX_ImageStretcher(ScanlineComposerIface* pDest,
26                      const RetainPtr<CFX_DIBBase>& pSource,
27                      int dest_width,
28                      int dest_height,
29                      const FX_RECT& bitmap_rect,
30                      const FXDIB_ResampleOptions& options);
31   ~CFX_ImageStretcher();
32 
33   bool Start();
34   bool Continue(PauseIndicatorIface* pPause);
35 
36   RetainPtr<CFX_DIBBase> source();
37 
38  private:
39   bool StartStretch();
40   bool ContinueStretch(PauseIndicatorIface* pPause);
41 
42   UnownedPtr<ScanlineComposerIface> const m_pDest;
43   RetainPtr<CFX_DIBBase> m_pSource;
44   std::unique_ptr<CStretchEngine> m_pStretchEngine;
45   std::unique_ptr<uint8_t, FxFreeDeleter> m_pScanline;
46   std::unique_ptr<uint8_t, FxFreeDeleter> m_pMaskScanline;
47   const FXDIB_ResampleOptions m_ResampleOptions;
48   int m_DestWidth;
49   int m_DestHeight;
50   const FX_RECT m_ClipRect;
51   const FXDIB_Format m_DestFormat;
52   const int m_DestBPP;
53 };
54 
55 #endif  // CORE_FXGE_DIB_CFX_IMAGESTRETCHER_H_
56