From 1ab9b926b3c76e1cfc763b1dc8df342a5d3225d9 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 17 Jan 2018 15:22:47 +0000 Subject: Remove m_BlendType from CXFA_ImageRenderer The m_BlendType flag was never changed from the default. Removed. Change-Id: I0b347369339babf273c43861715d67f2f6bbfb17 Reviewed-on: https://pdfium-review.googlesource.com/23055 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- xfa/fxfa/cxfa_imagerenderer.cpp | 53 +++++++++++++++++++---------------------- xfa/fxfa/cxfa_imagerenderer.h | 2 -- 2 files changed, 25 insertions(+), 30 deletions(-) diff --git a/xfa/fxfa/cxfa_imagerenderer.cpp b/xfa/fxfa/cxfa_imagerenderer.cpp index e5b220b497..0c6a44edcb 100644 --- a/xfa/fxfa/cxfa_imagerenderer.cpp +++ b/xfa/fxfa/cxfa_imagerenderer.cpp @@ -27,7 +27,8 @@ CXFA_ImageRenderer::~CXFA_ImageRenderer() {} bool CXFA_ImageRenderer::Start() { if (m_pDevice->StartDIBitsWithBlend(m_pDIBSource, 255, 0, &m_ImageMatrix, - m_Flags, &m_DeviceHandle, m_BlendType)) { + m_Flags, &m_DeviceHandle, + FXDIB_BLEND_NORMAL)) { if (m_DeviceHandle) { m_Status = 3; return true; @@ -67,7 +68,7 @@ bool CXFA_ImageRenderer::Start() { if (m_pDIBSource->IsOpaqueImage()) { if (m_pDevice->StretchDIBitsWithFlagsAndBlend( m_pDIBSource, dest_left, dest_top, dest_width, dest_height, m_Flags, - m_BlendType)) { + FXDIB_BLEND_NORMAL)) { return false; } } @@ -88,8 +89,7 @@ bool CXFA_ImageRenderer::Start() { RetainPtr pStretched = m_pDIBSource->StretchTo(dest_width, dest_height, m_Flags, &dest_clip); if (pStretched) { - CompositeDIBitmap(pStretched, dest_rect.left, dest_rect.top, m_BlendType, - false); + CompositeDIBitmap(pStretched, dest_rect.left, dest_rect.top, false); } return false; } @@ -108,7 +108,8 @@ bool CXFA_ImageRenderer::Continue() { m_pTransformer->result().top, 0); } else { m_pDevice->SetDIBitsWithBlend(pBitmap, m_pTransformer->result().left, - m_pTransformer->result().top, m_BlendType); + m_pTransformer->result().top, + FXDIB_BLEND_NORMAL); } return false; } @@ -122,34 +123,30 @@ void CXFA_ImageRenderer::CompositeDIBitmap( const RetainPtr& pDIBitmap, int left, int top, - int blend_mode, int iTransparency) { - if (!pDIBitmap) { + if (!pDIBitmap) return; - } + bool bIsolated = !!(iTransparency & PDFTRANS_ISOLATED); bool bGroup = !!(iTransparency & PDFTRANS_GROUP); - if (blend_mode == FXDIB_BLEND_NORMAL) { - if (!pDIBitmap->IsAlphaMask()) { - if (m_pDevice->SetDIBits(pDIBitmap, left, top)) - return; - } else { - uint32_t fill_argb = 0; - if (m_pDevice->SetBitMask(pDIBitmap, left, top, fill_argb)) - return; - } + if (!pDIBitmap->IsAlphaMask()) { + if (m_pDevice->SetDIBits(pDIBitmap, left, top)) + return; + } else { + uint32_t fill_argb = 0; + if (m_pDevice->SetBitMask(pDIBitmap, left, top, fill_argb)) + return; } - bool bBackAlphaRequired = blend_mode && bIsolated; - bool bGetBackGround = - ((m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT)) || - (!(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT) && - (m_pDevice->GetRenderCaps() & FXRC_GET_BITS) && !bBackAlphaRequired); + + bool bGetBackGround = ((m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT)) || + (!(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT) && + (m_pDevice->GetRenderCaps() & FXRC_GET_BITS)); if (bGetBackGround) { if (bIsolated || !bGroup) { - if (pDIBitmap->IsAlphaMask()) { + if (pDIBitmap->IsAlphaMask()) return; - } - m_pDevice->SetDIBitsWithBlend(pDIBitmap, left, top, blend_mode); + + m_pDevice->SetDIBitsWithBlend(pDIBitmap, left, top, FXDIB_BLEND_NORMAL); } else { FX_RECT rect(left, top, left + pDIBitmap->GetWidth(), top + pDIBitmap->GetHeight()); @@ -164,10 +161,10 @@ void CXFA_ImageRenderer::CompositeDIBitmap( top = top >= 0 ? 0 : top; if (!pDIBitmap->IsAlphaMask()) pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(), - pDIBitmap, left, top, blend_mode); + pDIBitmap, left, top, FXDIB_BLEND_NORMAL); else pClone->CompositeMask(0, 0, pClone->GetWidth(), pClone->GetHeight(), - pDIBitmap, 0, left, top, blend_mode); + pDIBitmap, 0, left, top, FXDIB_BLEND_NORMAL); } else { pClone = pDIBitmap; } @@ -177,7 +174,7 @@ void CXFA_ImageRenderer::CompositeDIBitmap( if (pDIBitmap->IsAlphaMask()) return; m_pDevice->SetDIBitsWithBlend(pDIBitmap, rect.left, rect.top, - blend_mode); + FXDIB_BLEND_NORMAL); } } return; diff --git a/xfa/fxfa/cxfa_imagerenderer.h b/xfa/fxfa/cxfa_imagerenderer.h index cdc9464f92..c0cc64e073 100644 --- a/xfa/fxfa/cxfa_imagerenderer.h +++ b/xfa/fxfa/cxfa_imagerenderer.h @@ -34,7 +34,6 @@ class CXFA_ImageRenderer { void CompositeDIBitmap(const RetainPtr& pDIBitmap, int left, int top, - int blend_mode, int iTransparency); CFX_RenderDevice* m_pDevice; @@ -45,7 +44,6 @@ class CXFA_ImageRenderer { uint32_t m_Flags; std::unique_ptr m_pTransformer; std::unique_ptr m_DeviceHandle; - int32_t m_BlendType = FXDIB_BLEND_NORMAL; }; #endif // XFA_FXFA_CXFA_IMAGERENDERER_H_ -- cgit v1.2.3