7#include "core/fxge/cfx_cliprgn.h"
13#include "core/fxcrt/span_util.h"
14#include "core/fxge/dib/cfx_dibitmap.h"
15#include "third_party/base/check_op.h"
16#include "third_party/base/notreached.h"
29 IntersectMaskRect(rect, m_Box, m_Mask);
42 if (m_Box
== mask_rect) {
43 m_Mask = std::move(pOldMask);
46 m_Mask = pdfium::MakeRetain<CFX_DIBitmap>();
47 m_Mask->Create(m_Box.Width(), m_Box.Height(), FXDIB_Format::k8bppMask);
48 const int offset = m_Box
.left - mask_rect
.left;
49 for (
int row = m_Box
.top; row < m_Box
.bottom; row++) {
50 pdfium::span<uint8_t> dest_scan =
51 m_Mask->GetWritableScanline(row - m_Box.top);
52 pdfium::span<
const uint8_t> src_scan =
53 pOldMask->GetScanline(row - mask_rect.top);
54 fxcrt::spancpy(dest_scan, src_scan.subspan(offset, m_Box
.Width()));
62 FX_RECT mask_box(left, top, left + pMask->GetWidth(),
63 top + pMask->GetHeight());
65 IntersectMaskRect(m_Box, mask_box,
std::move(pMask));
77 auto new_dib = pdfium::MakeRetain<CFX_DIBitmap>();
79 for (
int row = new_box
.top; row < new_box
.bottom; row++) {
80 pdfium::span<
const uint8_t> old_scan = m_Mask->GetScanline(row - m_Box.top);
81 pdfium::span<
const uint8_t> mask_scan = pMask->GetScanline(row - top);
82 uint8_t* new_scan = new_dib->GetWritableScanline(row - new_box
.top).data();
83 for (
int col = new_box
.left; col < new_box
.right; col++) {
84 new_scan[col - new_box
.left] =
85 old_scan[col - m_Box
.left] * mask_scan[col - left] / 255;
89 m_Mask = std::move(new_dib);
CFX_ClipRgn(int device_width, int device_height)
void IntersectRect(const FX_RECT &rect)
CFX_ClipRgn(const CFX_ClipRgn &src)
void IntersectMaskF(int left, int top, RetainPtr< CFX_DIBitmap > Mask)
FX_RECT & operator=(const FX_RECT &that)=default
bool operator==(const FX_RECT &src) const
void Intersect(const FX_RECT &src)
constexpr FX_RECT(int l, int t, int r, int b)