xref: /aosp_15_r20/external/pdfium/core/fxge/cfx_cliprgn.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2016 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_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 : bool { kRectI, kMaskF };
18 
19   CFX_ClipRgn(int device_width, int device_height);
20   CFX_ClipRgn(const CFX_ClipRgn& src);
21   ~CFX_ClipRgn();
22 
GetType()23   ClipType GetType() const { return m_Type; }
GetBox()24   const FX_RECT& GetBox() const { return m_Box; }
GetMask()25   RetainPtr<CFX_DIBitmap> GetMask() const { return m_Mask; }
26 
27   void IntersectRect(const FX_RECT& rect);
28   void IntersectMaskF(int left, int top, RetainPtr<CFX_DIBitmap> Mask);
29 
30  private:
31   void IntersectMaskRect(FX_RECT rect,
32                          FX_RECT mask_rect,
33                          RetainPtr<CFX_DIBitmap> pOldMask);
34 
35   ClipType m_Type = kRectI;
36   FX_RECT m_Box;
37   RetainPtr<CFX_DIBitmap> m_Mask;
38 };
39 
40 #endif  // CORE_FXGE_CFX_CLIPRGN_H_
41