1 // Copyright 2016 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_CFX_CLIPRGN_H_ 8 #define CORE_FXGE_CFX_CLIPRGN_H_ 9 10 #include "core/fxcrt/fx_coordinates.h" 11 #include "core/fxcrt/retain_ptr.h" 12 13 class CFX_DIBitmap; 14 15 class CFX_ClipRgn { 16 public: 17 enum ClipType { RectI, MaskF }; 18 19 CFX_ClipRgn(int device_width, int device_height); 20 CFX_ClipRgn(const CFX_ClipRgn& src); 21 ~CFX_ClipRgn(); 22 23 ClipType GetType() const { return m_Type; } 24 const FX_RECT& GetBox() const { return m_Box; } 25 RetainPtr<CFX_DIBitmap> GetMask() const { return m_Mask; } 26 27 void Reset(const FX_RECT& rect); 28 void IntersectRect(const FX_RECT& rect); 29 void IntersectMaskF(int left, int top, const RetainPtr<CFX_DIBitmap>& Mask); 30 31 private: 32 void IntersectMaskRect(FX_RECT rect, 33 FX_RECT mask_box, 34 const RetainPtr<CFX_DIBitmap>& Mask); 35 36 ClipType m_Type; 37 FX_RECT m_Box; 38 RetainPtr<CFX_DIBitmap> m_Mask; 39 }; 40 41 #endif // CORE_FXGE_CFX_CLIPRGN_H_ 42