summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/render/cpdf_imagerenderer.cpp1
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp6
-rw-r--r--core/fxge/dib/cfx_dibsource.cpp1
-rw-r--r--core/fxge/dib/cfx_imagerenderer.cpp66
-rw-r--r--core/fxge/dib/cfx_imagerenderer.h31
-rw-r--r--core/fxge/dib/cfx_imagetransformer.cpp36
-rw-r--r--core/fxge/dib/cfx_imagetransformer.h1
-rw-r--r--core/fxge/skia/fx_skia_device.cpp6
-rw-r--r--xfa/fxfa/cxfa_ffwidget.cpp7
9 files changed, 66 insertions, 89 deletions
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp
index 716203a7a5..6fcf89c83a 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.cpp
+++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp
@@ -418,7 +418,6 @@ bool CPDF_ImageRenderer::StartDIBSource() {
m_Status = 2;
m_pTransformer = pdfium::MakeUnique<CFX_ImageTransformer>(
m_pDIBSource, &m_ImageMatrix, m_Flags, &clip_box);
- m_pTransformer->Start();
return true;
}
if (m_ImageMatrix.a < 0)
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index 91272d4427..855ea2a04c 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -1546,9 +1546,9 @@ bool CFX_AggDeviceDriver::StartDIBits(
if (!m_pBitmap->GetBuffer())
return true;
- *handle = pdfium::MakeUnique<CFX_ImageRenderer>();
- (*handle)->Start(m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb,
- pMatrix, render_flags, m_bRgbByteOrder);
+ *handle = pdfium::MakeUnique<CFX_ImageRenderer>(
+ m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb, pMatrix,
+ render_flags, m_bRgbByteOrder);
return true;
}
diff --git a/core/fxge/dib/cfx_dibsource.cpp b/core/fxge/dib/cfx_dibsource.cpp
index deb8e15f49..458baa56ca 100644
--- a/core/fxge/dib/cfx_dibsource.cpp
+++ b/core/fxge/dib/cfx_dibsource.cpp
@@ -1089,7 +1089,6 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::TransformTo(
int* result_top) {
CFX_RetainPtr<CFX_DIBSource> holder(this);
CFX_ImageTransformer transformer(holder, pDestMatrix, 0, nullptr);
- transformer.Start();
transformer.Continue(nullptr);
*result_left = transformer.result().left;
*result_top = transformer.result().top;
diff --git a/core/fxge/dib/cfx_imagerenderer.cpp b/core/fxge/dib/cfx_imagerenderer.cpp
index ec611cacbe..db3fe02bd5 100644
--- a/core/fxge/dib/cfx_imagerenderer.cpp
+++ b/core/fxge/dib/cfx_imagerenderer.cpp
@@ -13,39 +13,30 @@
#include "core/fxge/ge/cfx_cliprgn.h"
#include "third_party/base/ptr_util.h"
-CFX_ImageRenderer::CFX_ImageRenderer()
- : m_Status(0),
- m_bRgbByteOrder(false),
- m_BlendType(FXDIB_BLEND_NORMAL) {}
-
-CFX_ImageRenderer::~CFX_ImageRenderer() {}
-
-bool CFX_ImageRenderer::Start(const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
- const CFX_ClipRgn* pClipRgn,
- const CFX_RetainPtr<CFX_DIBSource>& pSource,
- int bitmap_alpha,
- uint32_t mask_color,
- const CFX_Matrix* pMatrix,
- uint32_t dib_flags,
- bool bRgbByteOrder) {
- m_Matrix = *pMatrix;
- CFX_FloatRect image_rect_f = m_Matrix.GetUnitRect();
- FX_RECT image_rect = image_rect_f.GetOuterRect();
+CFX_ImageRenderer::CFX_ImageRenderer(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
+ const CFX_ClipRgn* pClipRgn,
+ const CFX_RetainPtr<CFX_DIBSource>& pSource,
+ int bitmap_alpha,
+ uint32_t mask_color,
+ const CFX_Matrix* pMatrix,
+ uint32_t dib_flags,
+ bool bRgbByteOrder)
+ : m_pDevice(pDevice),
+ m_pClipRgn(pClipRgn),
+ m_Matrix(*pMatrix),
+ m_BitmapAlpha(bitmap_alpha),
+ m_BlendType(FXDIB_BLEND_NORMAL),
+ m_bRgbByteOrder(bRgbByteOrder),
+ m_MaskColor(mask_color),
+ m_Status(0),
+ m_AlphaFlag(0) {
+ FX_RECT image_rect = m_Matrix.GetUnitRect().GetOuterRect();
m_ClipBox = pClipRgn ? pClipRgn->GetBox() : FX_RECT(0, 0, pDevice->GetWidth(),
pDevice->GetHeight());
m_ClipBox.Intersect(image_rect);
if (m_ClipBox.IsEmpty())
- return false;
-
- m_pDevice = pDevice;
- m_pClipRgn = pClipRgn;
- m_MaskColor = mask_color;
- m_BitmapAlpha = bitmap_alpha;
- m_Matrix = *pMatrix;
- m_Flags = dib_flags;
- m_AlphaFlag = 0;
- m_bRgbByteOrder = bRgbByteOrder;
- m_BlendType = FXDIB_BLEND_NORMAL;
+ return;
if ((fabs(m_Matrix.b) >= 0.5f || m_Matrix.a == 0) ||
(fabs(m_Matrix.c) >= 0.5f || m_Matrix.d == 0)) {
@@ -64,17 +55,14 @@ bool CFX_ImageRenderer::Start(const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
&m_Composer, pSource, dest_height, dest_width, bitmap_clip,
dib_flags);
- if (!m_Stretcher->Start())
- return false;
-
- m_Status = 1;
- return true;
+ if (m_Stretcher->Start())
+ m_Status = 1;
+ return;
}
m_Status = 2;
m_pTransformer = pdfium::MakeUnique<CFX_ImageTransformer>(
pSource, &m_Matrix, dib_flags, &m_ClipBox);
- m_pTransformer->Start();
- return true;
+ return;
}
int dest_width = image_rect.Width();
@@ -86,7 +74,7 @@ bool CFX_ImageRenderer::Start(const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
dest_height = -dest_height;
if (dest_width == 0 || dest_height == 0)
- return false;
+ return;
FX_RECT bitmap_clip = m_ClipBox;
bitmap_clip.Offset(-image_rect.left, -image_rect.top);
@@ -95,9 +83,11 @@ bool CFX_ImageRenderer::Start(const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
m_Status = 1;
m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
&m_Composer, pSource, dest_width, dest_height, bitmap_clip, dib_flags);
- return m_Stretcher->Start();
+ m_Stretcher->Start();
}
+CFX_ImageRenderer::~CFX_ImageRenderer() {}
+
bool CFX_ImageRenderer::Continue(IFX_Pause* pPause) {
if (m_Status == 1)
return m_Stretcher->Continue(pPause);
diff --git a/core/fxge/dib/cfx_imagerenderer.h b/core/fxge/dib/cfx_imagerenderer.h
index cad621e19c..97427ceb91 100644
--- a/core/fxge/dib/cfx_imagerenderer.h
+++ b/core/fxge/dib/cfx_imagerenderer.h
@@ -23,35 +23,32 @@ class CFX_ImageStretcher;
class CFX_ImageRenderer {
public:
- CFX_ImageRenderer();
+ CFX_ImageRenderer(const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
+ const CFX_ClipRgn* pClipRgn,
+ const CFX_RetainPtr<CFX_DIBSource>& pSource,
+ int bitmap_alpha,
+ uint32_t mask_color,
+ const CFX_Matrix* pMatrix,
+ uint32_t dib_flags,
+ bool bRgbByteOrder);
~CFX_ImageRenderer();
- bool Start(const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
- const CFX_ClipRgn* pClipRgn,
- const CFX_RetainPtr<CFX_DIBSource>& pSource,
- int bitmap_alpha,
- uint32_t mask_color,
- const CFX_Matrix* pMatrix,
- uint32_t dib_flags,
- bool bRgbByteOrder);
-
bool Continue(IFX_Pause* pPause);
private:
- CFX_RetainPtr<CFX_DIBitmap> m_pDevice;
- CFX_UnownedPtr<const CFX_ClipRgn> m_pClipRgn;
- int m_BitmapAlpha;
+ const CFX_RetainPtr<CFX_DIBitmap> m_pDevice;
+ const CFX_UnownedPtr<const CFX_ClipRgn> m_pClipRgn;
+ const CFX_Matrix m_Matrix;
+ const int m_BitmapAlpha;
+ const int m_BlendType;
+ const bool m_bRgbByteOrder;
uint32_t m_MaskColor;
- CFX_Matrix m_Matrix;
std::unique_ptr<CFX_ImageTransformer> m_pTransformer;
std::unique_ptr<CFX_ImageStretcher> m_Stretcher;
CFX_BitmapComposer m_Composer;
int m_Status;
FX_RECT m_ClipBox;
- uint32_t m_Flags;
int m_AlphaFlag;
- bool m_bRgbByteOrder;
- int m_BlendType;
};
#endif // CORE_FXGE_DIB_CFX_IMAGERENDERER_H_
diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp
index 2fb21e4c33..7a097ced12 100644
--- a/core/fxge/dib/cfx_imagetransformer.cpp
+++ b/core/fxge/dib/cfx_imagetransformer.cpp
@@ -186,19 +186,14 @@ CFX_ImageTransformer::CFX_ImageTransformer(
m_pMatrix(pMatrix),
m_pClip(pClip),
m_Flags(flags),
- m_Status(0) {}
-
-CFX_ImageTransformer::~CFX_ImageTransformer() {}
-
-bool CFX_ImageTransformer::Start() {
- CFX_FloatRect unit_rect = m_pMatrix->GetUnitRect();
- FX_RECT result_rect = unit_rect.GetClosestRect();
+ m_Status(0) {
+ FX_RECT result_rect = m_pMatrix->GetUnitRect().GetClosestRect();
FX_RECT result_clip = result_rect;
if (m_pClip)
result_clip.Intersect(*m_pClip);
if (result_clip.IsEmpty())
- return false;
+ return;
m_result = result_clip;
if (fabs(m_pMatrix->a) < fabs(m_pMatrix->b) / 20 &&
@@ -213,29 +208,29 @@ bool CFX_ImageTransformer::Start() {
&m_Storer, m_pSrc, dest_height, dest_width, result_clip, m_Flags);
m_Stretcher->Start();
m_Status = 1;
- return true;
+ return;
}
if (fabs(m_pMatrix->b) < FIX16_005 && fabs(m_pMatrix->c) < FIX16_005) {
- int dest_width =
- m_pMatrix->a > 0 ? (int)ceil(m_pMatrix->a) : (int)floor(m_pMatrix->a);
- int dest_height =
- m_pMatrix->d > 0 ? (int)-ceil(m_pMatrix->d) : (int)-floor(m_pMatrix->d);
+ int dest_width = static_cast<int>(m_pMatrix->a > 0 ? ceil(m_pMatrix->a)
+ : floor(m_pMatrix->a));
+ int dest_height = static_cast<int>(m_pMatrix->d > 0 ? -ceil(m_pMatrix->d)
+ : -floor(m_pMatrix->d));
result_clip.Offset(-result_rect.left, -result_rect.top);
m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
&m_Storer, m_pSrc, dest_width, dest_height, result_clip, m_Flags);
m_Stretcher->Start();
m_Status = 2;
- return true;
+ return;
}
- int stretch_width = (int)ceil(FXSYS_sqrt2(m_pMatrix->a, m_pMatrix->b));
- int stretch_height = (int)ceil(FXSYS_sqrt2(m_pMatrix->c, m_pMatrix->d));
- CFX_Matrix stretch2dest(1.0f, 0.0f, 0.0f, -1.0f, 0.0f,
- (float)(stretch_height));
+ int stretch_width =
+ static_cast<int>(ceil(FXSYS_sqrt2(m_pMatrix->a, m_pMatrix->b)));
+ int stretch_height =
+ static_cast<int>(ceil(FXSYS_sqrt2(m_pMatrix->c, m_pMatrix->d)));
+ CFX_Matrix stretch2dest(1.0f, 0.0f, 0.0f, -1.0f, 0.0f, stretch_height);
stretch2dest.Concat(
CFX_Matrix(m_pMatrix->a / stretch_width, m_pMatrix->b / stretch_width,
m_pMatrix->c / stretch_height, m_pMatrix->d / stretch_height,
m_pMatrix->e, m_pMatrix->f));
- ASSERT(m_dest2stretch.IsIdentity());
m_dest2stretch = stretch2dest.GetInverse();
CFX_FloatRect clip_rect_f(result_clip);
@@ -246,9 +241,10 @@ bool CFX_ImageTransformer::Start() {
&m_Storer, m_pSrc, stretch_width, stretch_height, m_StretchClip, m_Flags);
m_Stretcher->Start();
m_Status = 3;
- return true;
}
+CFX_ImageTransformer::~CFX_ImageTransformer() {}
+
bool CFX_ImageTransformer::Continue(IFX_Pause* pPause) {
if (m_Status == 1) {
if (m_Stretcher->Continue(pPause))
diff --git a/core/fxge/dib/cfx_imagetransformer.h b/core/fxge/dib/cfx_imagetransformer.h
index 90f605dce9..60e4714a65 100644
--- a/core/fxge/dib/cfx_imagetransformer.h
+++ b/core/fxge/dib/cfx_imagetransformer.h
@@ -25,7 +25,6 @@ class CFX_ImageTransformer {
const FX_RECT* pClip);
~CFX_ImageTransformer();
- bool Start();
bool Continue(IFX_Pause* pPause);
const FX_RECT& result() const { return m_result; }
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index f4b72fe2ad..7e0d55688c 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -2174,9 +2174,9 @@ bool CFX_SkiaDeviceDriver::StartDIBits(
if (!m_pBitmap->GetBuffer())
return true;
m_pBitmap->UnPreMultiply();
- *handle = pdfium::MakeUnique<CFX_ImageRenderer>();
- (*handle)->Start(m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb,
- pMatrix, render_flags, m_bRgbByteOrder);
+ *handle = pdfium::MakeUnique<CFX_ImageRenderer>(
+ m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb, pMatrix,
+ render_flags, m_bRgbByteOrder);
#endif // _SKIA_SUPPORT_PATHS_
return true;
}
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index f72b29127a..2437c53cd3 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -660,15 +660,12 @@ bool CXFA_ImageRenderer::StartDIBSource() {
m_Status = 2;
m_pTransformer = pdfium::MakeUnique<CFX_ImageTransformer>(
pDib, &m_ImageMatrix, m_Flags, &clip_box);
- m_pTransformer->Start();
return true;
}
- if (m_ImageMatrix.a < 0) {
+ if (m_ImageMatrix.a < 0)
dest_width = -dest_width;
- }
- if (m_ImageMatrix.d > 0) {
+ if (m_ImageMatrix.d > 0)
dest_height = -dest_height;
- }
int dest_left, dest_top;
dest_left = dest_width > 0 ? image_rect.left : image_rect.right;
dest_top = dest_height > 0 ? image_rect.top : image_rect.bottom;