32 m_MaskColor(mask_color),
33 m_bRgbByteOrder(bRgbByteOrder) {
37 : FX_RECT(0, 0, pDevice->GetWidth(), pDevice->GetHeight());
42 if ((fabs(m_Matrix
.b) >= 0.5f || m_Matrix
.a == 0) ||
43 (fabs(m_Matrix
.c) >= 0.5f || m_Matrix
.d == 0)) {
44 if (fabs(m_Matrix
.a) < fabs(m_Matrix
.b) / 20 &&
45 fabs(m_Matrix
.d) < fabs(m_Matrix
.c) / 20 && fabs(m_Matrix
.a) < 0.5f &&
46 fabs(m_Matrix
.d) < 0.5f) {
49 FX_RECT bitmap_clip = m_ClipBox;
52 m_Matrix
.c > 0
, m_Matrix
.b < 0
);
53 const bool flip_x = m_Matrix
.c > 0;
54 const bool flip_y = m_Matrix
.b < 0;
55 m_Composer.Compose(pDevice, pClipRgn, alpha, mask_color, m_ClipBox,
56 true, flip_x, flip_y, m_bRgbByteOrder,
58 m_Stretcher = std::make_unique<CFX_ImageStretcher>(
59 &m_Composer, std::move(source), dest_height, dest_width, bitmap_clip,
61 if (m_Stretcher->Start())
62 m_State = State::kStretching;
65 m_State = State::kTransforming;
66 m_pTransformer = std::make_unique<CFX_ImageTransformer>(
67 std::move(source), m_Matrix, options, &m_ClipBox);
73 dest_width = -dest_width;
77 dest_height = -dest_height;
79 if (dest_width == 0 || dest_height == 0)
82 FX_RECT bitmap_clip = m_ClipBox;
84 m_Composer.Compose(pDevice, pClipRgn, alpha, mask_color, m_ClipBox,
86 m_bRgbByteOrder, BlendMode::kNormal);
87 m_State = State::kStretching;
88 m_Stretcher = std::make_unique<CFX_ImageStretcher>(
89 &m_Composer, std::move(source), dest_width, dest_height, bitmap_clip,
97 if (m_State == State::kStretching)
98 return m_Stretcher->Continue(pPause);
99 if (m_State != State::kTransforming)
101 if (m_pTransformer->Continue(pPause))
104 RetainPtr<CFX_DIBitmap> pBitmap = m_pTransformer->DetachBitmap();
105 if (!pBitmap || pBitmap->GetBuffer().empty())
108 if (pBitmap->IsMaskFormat()) {
109 if (m_Alpha != 1.0f) {
112 m_pDevice->CompositeMask(m_pTransformer->result().left,
113 m_pTransformer->result().top, pBitmap->GetWidth(),
114 pBitmap->GetHeight(), pBitmap, m_MaskColor, 0, 0,
115 BlendMode::kNormal, m_pClipRgn, m_bRgbByteOrder);
117 pBitmap->MultiplyAlpha(m_Alpha);
118 m_pDevice->CompositeBitmap(
119 m_pTransformer->result().left, m_pTransformer->result().top,
120 pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap, 0, 0,
121 BlendMode::kNormal, m_pClipRgn, m_bRgbByteOrder);
CFX_ImageRenderer(const RetainPtr< CFX_DIBitmap > &pDevice, const CFX_ClipRgn *pClipRgn, RetainPtr< const CFX_DIBBase > source, float alpha, uint32_t mask_color, const CFX_Matrix &matrix, const FXDIB_ResampleOptions &options, bool bRgbByteOrder)