summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-25 17:25:13 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-25 17:25:13 +0000
commitecf14f7caac3b5d79a3cc36b30d7bb97aabbb062 (patch)
tree4df8b9ee72185d3a25413503057299b201d57f7d
parente115ca7d978532d8bfcbf06cb03cbbb4c148881c (diff)
downloadpdfium-ecf14f7caac3b5d79a3cc36b30d7bb97aabbb062.tar.xz
Initialize CFX_ImageRenderer members in the header.
- Reorder to pack a bit better. - Remove |m_BlendType| which is always |FXDIB_BLEND_NORMAL|. - Change the ctor to pass the matrix by reference. Change-Id: I07870947915fd2c90f28502803eb17f18204ac92 Reviewed-on: https://pdfium-review.googlesource.com/c/44547 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp2
-rw-r--r--core/fxge/dib/cfx_imagerenderer.cpp20
-rw-r--r--core/fxge/dib/cfx_imagerenderer.h13
-rw-r--r--core/fxge/skia/fx_skia_device.cpp2
4 files changed, 17 insertions, 20 deletions
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index 69006b6083..39b31b58f1 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -1556,7 +1556,7 @@ bool CFX_AggDeviceDriver::StartDIBits(
return true;
*handle = pdfium::MakeUnique<CFX_ImageRenderer>(
- m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb, pMatrix,
+ m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb, *pMatrix,
render_flags, m_bRgbByteOrder);
return true;
}
diff --git a/core/fxge/dib/cfx_imagerenderer.cpp b/core/fxge/dib/cfx_imagerenderer.cpp
index ffab8ee623..b4d95b8c6f 100644
--- a/core/fxge/dib/cfx_imagerenderer.cpp
+++ b/core/fxge/dib/cfx_imagerenderer.cpp
@@ -18,18 +18,15 @@ CFX_ImageRenderer::CFX_ImageRenderer(const RetainPtr<CFX_DIBitmap>& pDevice,
const RetainPtr<CFX_DIBBase>& pSource,
int bitmap_alpha,
uint32_t mask_color,
- const CFX_Matrix* pMatrix,
+ const CFX_Matrix& matrix,
uint32_t dib_flags,
bool bRgbByteOrder)
: m_pDevice(pDevice),
m_pClipRgn(pClipRgn),
- m_Matrix(*pMatrix),
+ m_Matrix(matrix),
m_BitmapAlpha(bitmap_alpha),
- m_BlendType(FXDIB_BLEND_NORMAL),
- m_bRgbByteOrder(bRgbByteOrder),
m_MaskColor(mask_color),
- m_Status(0),
- m_AlphaFlag(0) {
+ m_bRgbByteOrder(bRgbByteOrder) {
FX_RECT image_rect = m_Matrix.GetUnitRect().GetOuterRect();
m_ClipBox = pClipRgn ? pClipRgn->GetBox() : FX_RECT(0, 0, pDevice->GetWidth(),
pDevice->GetHeight());
@@ -50,7 +47,7 @@ CFX_ImageRenderer::CFX_ImageRenderer(const RetainPtr<CFX_DIBitmap>& pDevice,
m_Matrix.c > 0, m_Matrix.b < 0);
m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox,
true, m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder,
- 0, m_BlendType);
+ 0, FXDIB_BLEND_NORMAL);
m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
&m_Composer, pSource, dest_height, dest_width, bitmap_clip,
dib_flags);
@@ -78,7 +75,8 @@ CFX_ImageRenderer::CFX_ImageRenderer(const RetainPtr<CFX_DIBitmap>& pDevice,
FX_RECT bitmap_clip = m_ClipBox;
bitmap_clip.Offset(-image_rect.left, -image_rect.top);
m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox,
- false, false, false, m_bRgbByteOrder, 0, m_BlendType);
+ false, false, false, m_bRgbByteOrder, 0,
+ FXDIB_BLEND_NORMAL);
m_Status = 1;
m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
&m_Composer, pSource, dest_width, dest_height, bitmap_clip, dib_flags);
@@ -111,14 +109,14 @@ bool CFX_ImageRenderer::Continue(PauseIndicatorIface* pPause) {
m_pDevice->CompositeMask(
m_pTransformer->result().left, m_pTransformer->result().top,
pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap, m_MaskColor, 0, 0,
- m_BlendType, m_pClipRgn.Get(), m_bRgbByteOrder, m_AlphaFlag);
+ FXDIB_BLEND_NORMAL, m_pClipRgn.Get(), m_bRgbByteOrder, m_AlphaFlag);
} else {
if (m_BitmapAlpha != 255)
pBitmap->MultiplyAlpha(m_BitmapAlpha);
m_pDevice->CompositeBitmap(
m_pTransformer->result().left, m_pTransformer->result().top,
- pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap, 0, 0, m_BlendType,
- m_pClipRgn.Get(), m_bRgbByteOrder);
+ pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap, 0, 0,
+ FXDIB_BLEND_NORMAL, m_pClipRgn.Get(), m_bRgbByteOrder);
}
return false;
}
diff --git a/core/fxge/dib/cfx_imagerenderer.h b/core/fxge/dib/cfx_imagerenderer.h
index 10dca178bf..2a16d2d18b 100644
--- a/core/fxge/dib/cfx_imagerenderer.h
+++ b/core/fxge/dib/cfx_imagerenderer.h
@@ -27,7 +27,7 @@ class CFX_ImageRenderer {
const RetainPtr<CFX_DIBBase>& pSource,
int bitmap_alpha,
uint32_t mask_color,
- const CFX_Matrix* pMatrix,
+ const CFX_Matrix& matrix,
uint32_t dib_flags,
bool bRgbByteOrder);
~CFX_ImageRenderer();
@@ -38,16 +38,15 @@ class CFX_ImageRenderer {
RetainPtr<CFX_DIBitmap> const m_pDevice;
UnownedPtr<const CFX_ClipRgn> const m_pClipRgn;
const CFX_Matrix m_Matrix;
- const int m_BitmapAlpha;
- const int m_BlendType;
- const bool m_bRgbByteOrder;
- uint32_t m_MaskColor;
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;
- int m_AlphaFlag;
+ const int m_BitmapAlpha;
+ int m_Status = 0;
+ int m_AlphaFlag = 0;
+ uint32_t m_MaskColor;
+ const bool m_bRgbByteOrder;
};
#endif // CORE_FXGE_DIB_CFX_IMAGERENDERER_H_
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index a282cd6a1f..6e90c29f99 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -2392,7 +2392,7 @@ bool CFX_SkiaDeviceDriver::StartDIBits(
return true;
m_pBitmap->UnPreMultiply();
*handle = pdfium::MakeUnique<CFX_ImageRenderer>(
- m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb, pMatrix,
+ m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb, *pMatrix,
render_flags, m_bRgbByteOrder);
#endif // _SKIA_SUPPORT_PATHS_
return true;