diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-17 15:14:06 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-17 15:14:06 +0000 |
commit | 8fc7dc6da9356e57f7318bff54e77fe567c5c6a1 (patch) | |
tree | 331d7aaec82d2b3ea6215c59d318306d17b6f34a /xfa | |
parent | f22d4206c768856efdfbf0ec38af4386a706de3a (diff) | |
download | pdfium-8fc7dc6da9356e57f7318bff54e77fe567c5c6a1.tar.xz |
Remove bitmap alpha from CXFA_ImageRenderer
The bitmap alpha value is always set to 255, this CL removes the
parameter and passes 255 directly where needed.
Change-Id: I435fbdd00121cae4dda0e2a790b339993f5e8a07
Reviewed-on: https://pdfium-review.googlesource.com/23051
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fxfa/cxfa_ffwidget.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_imagerenderer.cpp | 31 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_imagerenderer.h | 3 |
3 files changed, 7 insertions, 29 deletions
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index def2ee3139..34965236f9 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -1091,7 +1091,7 @@ void XFA_DrawImage(CXFA_Graphics* pGS, CFX_Matrix(rtFit.width, 0, 0, rtFit.height, rtFit.left, rtFit.top)); mtImage.Concat(matrix); - CXFA_ImageRenderer imageRender(pRenderDevice, pDIBitmap, 0, 255, &mtImage, + CXFA_ImageRenderer imageRender(pRenderDevice, pDIBitmap, 0, &mtImage, FXDIB_INTERPOL); if (!imageRender.Start()) { return; diff --git a/xfa/fxfa/cxfa_imagerenderer.cpp b/xfa/fxfa/cxfa_imagerenderer.cpp index 7423037cb5..a56f4d94a6 100644 --- a/xfa/fxfa/cxfa_imagerenderer.cpp +++ b/xfa/fxfa/cxfa_imagerenderer.cpp @@ -17,20 +17,18 @@ CXFA_ImageRenderer::CXFA_ImageRenderer( CFX_RenderDevice* pDevice, const RetainPtr<CFX_DIBSource>& pDIBSource, FX_ARGB bitmap_argb, - int bitmap_alpha, const CFX_Matrix* pImage2Device, uint32_t flags) : m_pDevice(pDevice), m_ImageMatrix(*pImage2Device), m_pDIBSource(pDIBSource), - m_BitmapAlpha(bitmap_alpha), m_FillArgb(bitmap_argb), m_Flags(flags) {} CXFA_ImageRenderer::~CXFA_ImageRenderer() {} bool CXFA_ImageRenderer::Start() { - if (m_pDevice->StartDIBitsWithBlend(m_pDIBSource, m_BitmapAlpha, m_FillArgb, + if (m_pDevice->StartDIBitsWithBlend(m_pDIBSource, 255, m_FillArgb, &m_ImageMatrix, m_Flags, &m_DeviceHandle, m_BlendType)) { if (m_DeviceHandle) { @@ -74,7 +72,7 @@ bool CXFA_ImageRenderer::Start() { 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; - if (m_pDIBSource->IsOpaqueImage() && m_BitmapAlpha == 255) { + if (m_pDIBSource->IsOpaqueImage()) { if (m_pDevice->StretchDIBitsWithFlagsAndBlend( m_pDIBSource, dest_left, dest_top, dest_width, dest_height, m_Flags, m_BlendType)) { @@ -82,9 +80,6 @@ bool CXFA_ImageRenderer::Start() { } } if (m_pDIBSource->IsAlphaMask()) { - if (m_BitmapAlpha != 255) { - m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha); - } if (m_pDevice->StretchBitMaskWithFlags(m_pDIBSource, dest_left, dest_top, dest_width, dest_height, m_FillArgb, m_Flags)) { @@ -105,7 +100,7 @@ bool CXFA_ImageRenderer::Start() { m_pDIBSource->StretchTo(dest_width, dest_height, m_Flags, &dest_clip); if (pStretched) { CompositeDIBitmap(pStretched, dest_rect.left, dest_rect.top, m_FillArgb, - m_BitmapAlpha, m_BlendType, false); + m_BlendType, false); } return false; } @@ -120,14 +115,10 @@ bool CXFA_ImageRenderer::Continue() { return false; if (pBitmap->IsAlphaMask()) { - if (m_BitmapAlpha != 255) - m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha); m_Result = m_pDevice->SetBitMask(pBitmap, m_pTransformer->result().left, m_pTransformer->result().top, m_FillArgb); } else { - if (m_BitmapAlpha != 255) - pBitmap->MultiplyAlpha(m_BitmapAlpha); m_Result = m_pDevice->SetDIBitsWithBlend( pBitmap, m_pTransformer->result().left, m_pTransformer->result().top, m_BlendType); @@ -145,7 +136,6 @@ void CXFA_ImageRenderer::CompositeDIBitmap( int left, int top, FX_ARGB mask_argb, - int bitmap_alpha, int blend_mode, int iTransparency) { if (!pDIBitmap) { @@ -155,21 +145,12 @@ void CXFA_ImageRenderer::CompositeDIBitmap( bool bGroup = !!(iTransparency & PDFTRANS_GROUP); if (blend_mode == FXDIB_BLEND_NORMAL) { if (!pDIBitmap->IsAlphaMask()) { - if (bitmap_alpha < 255) { - pDIBitmap->MultiplyAlpha(bitmap_alpha); - } - if (m_pDevice->SetDIBits(pDIBitmap, left, top)) { + if (m_pDevice->SetDIBits(pDIBitmap, left, top)) return; - } } else { uint32_t fill_argb = (mask_argb); - if (bitmap_alpha < 255) { - ((uint8_t*)&fill_argb)[3] = - ((uint8_t*)&fill_argb)[3] * bitmap_alpha / 255; - } - if (m_pDevice->SetBitMask(pDIBitmap, left, top, fill_argb)) { + if (m_pDevice->SetBitMask(pDIBitmap, left, top, fill_argb)) return; - } } } bool bBackAlphaRequired = blend_mode && bIsolated; @@ -224,7 +205,7 @@ void CXFA_ImageRenderer::CompositeDIBitmap( return; CXFA_ImageRenderer imageRender(m_pDevice, pCloneConvert, m_FillArgb, - m_BitmapAlpha, &m_ImageMatrix, m_Flags); + &m_ImageMatrix, m_Flags); if (!imageRender.Start()) { return; } diff --git a/xfa/fxfa/cxfa_imagerenderer.h b/xfa/fxfa/cxfa_imagerenderer.h index 6a165b53e4..45ab32721d 100644 --- a/xfa/fxfa/cxfa_imagerenderer.h +++ b/xfa/fxfa/cxfa_imagerenderer.h @@ -24,7 +24,6 @@ class CXFA_ImageRenderer { CXFA_ImageRenderer(CFX_RenderDevice* pDevice, const RetainPtr<CFX_DIBSource>& pDIBSource, FX_ARGB bitmap_argb, - int bitmap_alpha, const CFX_Matrix* pImage2Device, uint32_t flags); ~CXFA_ImageRenderer(); @@ -37,7 +36,6 @@ class CXFA_ImageRenderer { int left, int top, FX_ARGB mask_argb, - int bitmap_alpha, int blend_mode, int iTransparency); @@ -46,7 +44,6 @@ class CXFA_ImageRenderer { CFX_Matrix m_ImageMatrix; RetainPtr<CFX_DIBSource> m_pDIBSource; RetainPtr<CFX_DIBitmap> m_pCloneConvert; - int m_BitmapAlpha; FX_ARGB m_FillArgb; uint32_t m_Flags; std::unique_ptr<CFX_ImageTransformer> m_pTransformer; |