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