33 m_MaskColor(mask_color),
34 m_bRgbByteOrder(bRgbByteOrder) {
38 : FX_RECT(0, 0, pDevice->GetWidth(), pDevice->GetHeight());
43 if ((fabs(m_Matrix
.b) >= 0.5f || m_Matrix
.a == 0) ||
44 (fabs(m_Matrix
.c) >= 0.5f || m_Matrix
.d == 0)) {
45 if (fabs(m_Matrix
.a) < fabs(m_Matrix
.b) / 20 &&
46 fabs(m_Matrix
.d) < fabs(m_Matrix
.c) / 20 && fabs(m_Matrix
.a) < 0.5f &&
47 fabs(m_Matrix
.d) < 0.5f) {
50 FX_RECT bitmap_clip = m_ClipBox;
53 m_Matrix
.c > 0
, m_Matrix
.b < 0
);
54 const bool flip_x = m_Matrix
.c > 0;
55 const bool flip_y = m_Matrix
.b < 0;
56 m_Composer.Compose(pDevice, pClipRgn, alpha, mask_color, m_ClipBox,
57 true, flip_x, flip_y, m_bRgbByteOrder,
59 m_Stretcher = std::make_unique<CFX_ImageStretcher>(
60 &m_Composer, std::move(source), dest_height, dest_width, bitmap_clip,
62 if (m_Stretcher->Start())
63 m_State = State::kStretching;
66 m_State = State::kTransforming;
67 m_pTransformer = std::make_unique<CFX_ImageTransformer>(
68 std::move(source), m_Matrix, options, &m_ClipBox);
74 dest_width = -dest_width;
78 dest_height = -dest_height;
80 if (dest_width == 0 || dest_height == 0)
83 FX_RECT bitmap_clip = m_ClipBox;
85 m_Composer.Compose(pDevice, pClipRgn, alpha, mask_color, m_ClipBox,
87 m_bRgbByteOrder, BlendMode::kNormal);
88 m_State = State::kStretching;
89 m_Stretcher = std::make_unique<CFX_ImageStretcher>(
90 &m_Composer, std::move(source), dest_width, dest_height, bitmap_clip,
98 if (m_State == State::kStretching)
99 return m_Stretcher->Continue(pPause);
100 if (m_State != State::kTransforming)
102 if (m_pTransformer->Continue(pPause))
105 RetainPtr<CFX_DIBitmap> pBitmap = m_pTransformer->DetachBitmap();
106 if (!pBitmap || pBitmap->GetBuffer().empty())
109 if (pBitmap->IsMaskFormat()) {
110 if (m_Alpha != 1.0f) {
113 m_pDevice->CompositeMask(m_pTransformer->result().left,
114 m_pTransformer->result().top, pBitmap->GetWidth(),
115 pBitmap->GetHeight(), pBitmap, m_MaskColor, 0, 0,
116 BlendMode::kNormal, m_pClipRgn, m_bRgbByteOrder);
118 pBitmap->MultiplyAlpha(m_Alpha);
119 m_pDevice->CompositeBitmap(
120 m_pTransformer->result().left, m_pTransformer->result().top,
121 pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap, 0, 0,
122 BlendMode::kNormal, m_pClipRgn, m_bRgbByteOrder);
CFX_AggImageRenderer(const RetainPtr< CFX_DIBitmap > &pDevice, const CFX_AggClipRgn *pClipRgn, RetainPtr< const CFX_DIBBase > source, float alpha, uint32_t mask_color, const CFX_Matrix &matrix, const FXDIB_ResampleOptions &options, bool bRgbByteOrder)