From ecf14f7caac3b5d79a3cc36b30d7bb97aabbb062 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 25 Oct 2018 17:25:13 +0000 Subject: 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 Commit-Queue: Lei Zhang --- core/fxge/agg/fx_agg_driver.cpp | 2 +- core/fxge/dib/cfx_imagerenderer.cpp | 20 +++++++++----------- core/fxge/dib/cfx_imagerenderer.h | 13 ++++++------- core/fxge/skia/fx_skia_device.cpp | 2 +- 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( - 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& pDevice, const RetainPtr& 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& 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( &m_Composer, pSource, dest_height, dest_width, bitmap_clip, dib_flags); @@ -78,7 +75,8 @@ CFX_ImageRenderer::CFX_ImageRenderer(const RetainPtr& 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( &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& 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 const m_pDevice; UnownedPtr 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 m_pTransformer; std::unique_ptr 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( - 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; -- cgit v1.2.3