// Copyright 2017 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #ifndef CORE_FXGE_DIB_CSTRETCHENGINE_H_ #define CORE_FXGE_DIB_CSTRETCHENGINE_H_ #include #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/retain_ptr.h" #include "core/fxcrt/unowned_ptr.h" #include "core/fxge/fx_dib.h" class PauseIndicatorIface; class ScanlineComposerIface; class CStretchEngine { public: CStretchEngine(ScanlineComposerIface* pDestBitmap, FXDIB_Format dest_format, int dest_width, int dest_height, const FX_RECT& clip_rect, const RetainPtr& pSrcBitmap, int flags); ~CStretchEngine(); bool Continue(PauseIndicatorIface* pPause); bool StartStretchHorz(); bool ContinueStretchHorz(PauseIndicatorIface* pPause); void StretchVert(); class CWeightTable { public: CWeightTable(); ~CWeightTable(); bool Calc(int dest_len, int dest_min, int dest_max, int src_len, int src_min, int src_max, int flags); PixelWeight* GetPixelWeight(int pixel) const; int* GetValueFromPixelWeight(PixelWeight* pWeight, int index) const; size_t GetPixelWeightSize() const; private: int m_DestMin; int m_ItemSize; std::vector m_WeightTables; size_t m_dwWeightTablesSize; }; FXDIB_Format m_DestFormat; int m_DestBpp; int m_SrcBpp; int m_bHasAlpha; UnownedPtr m_pDestBitmap; int m_DestWidth; int m_DestHeight; FX_RECT m_DestClip; std::vector m_DestScanline; std::vector m_DestMaskScanline; FX_RECT m_SrcClip; RetainPtr m_pSource; uint32_t* m_pSrcPalette; int m_SrcWidth; int m_SrcHeight; int m_SrcPitch; int m_InterPitch; int m_ExtraMaskPitch; std::vector m_InterBuf; std::vector m_ExtraAlphaBuf; int m_TransMethod; int m_Flags; CWeightTable m_WeightTable; int m_CurRow; int m_State; }; #endif // CORE_FXGE_DIB_CSTRETCHENGINE_H_