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_SCANLINECOMPOSITOR_H_ 8 #define CORE_FXGE_DIB_CFX_SCANLINECOMPOSITOR_H_ 9 10 #include <memory> 11 12 #include "core/fxge/dib/cfx_dibsource.h" 13 14 class CFX_ScanlineCompositor { 15 public: 16 CFX_ScanlineCompositor(); 17 18 ~CFX_ScanlineCompositor(); 19 20 bool Init(FXDIB_Format dest_format, 21 FXDIB_Format src_format, 22 int32_t width, 23 uint32_t* pSrcPalette, 24 uint32_t mask_color, 25 int blend_type, 26 bool bClip, 27 bool bRgbByteOrder, 28 int alpha_flag); 29 30 void CompositeRgbBitmapLine(uint8_t* dest_scan, 31 const uint8_t* src_scan, 32 int width, 33 const uint8_t* clip_scan, 34 const uint8_t* src_extra_alpha, 35 uint8_t* dst_extra_alpha); 36 37 void CompositePalBitmapLine(uint8_t* dest_scan, 38 const uint8_t* src_scan, 39 int src_left, 40 int width, 41 const uint8_t* clip_scan, 42 const uint8_t* src_extra_alpha, 43 uint8_t* dst_extra_alpha); 44 45 void CompositeByteMaskLine(uint8_t* dest_scan, 46 const uint8_t* src_scan, 47 int width, 48 const uint8_t* clip_scan, 49 uint8_t* dst_extra_alpha); 50 51 void CompositeBitMaskLine(uint8_t* dest_scan, 52 const uint8_t* src_scan, 53 int src_left, 54 int width, 55 const uint8_t* clip_scan, 56 uint8_t* dst_extra_alpha); 57 58 private: 59 void InitSourcePalette(FXDIB_Format src_format, 60 FXDIB_Format dest_format, 61 const uint32_t* pSrcPalette); 62 63 void InitSourceMask(int alpha_flag, uint32_t mask_color); 64 65 int m_iTransparency; 66 FXDIB_Format m_SrcFormat; 67 FXDIB_Format m_DestFormat; 68 std::unique_ptr<uint32_t, FxFreeDeleter> m_pSrcPalette; 69 int m_MaskAlpha; 70 int m_MaskRed; 71 int m_MaskGreen; 72 int m_MaskBlue; 73 int m_BlendType; 74 bool m_bRgbByteOrder; 75 }; 76 77 #endif // CORE_FXGE_DIB_CFX_SCANLINECOMPOSITOR_H_ 78