From 7577d5ccc34a6ab8d12d20766173338cb3466fb6 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 17 Jan 2018 15:28:07 +0000 Subject: Remove transparency flag from CompositeDIBitmap The transparency flag was always false, this CL removes the flag and any code as needed. Change-Id: Ia4aecd7919b17c446c1b59361042e6a7444064af Reviewed-on: https://pdfium-review.googlesource.com/23056 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- xfa/fxfa/cxfa_imagerenderer.cpp | 60 +++++++++-------------------------------- xfa/fxfa/cxfa_imagerenderer.h | 5 ++-- 2 files changed, 14 insertions(+), 51 deletions(-) (limited to 'xfa') diff --git a/xfa/fxfa/cxfa_imagerenderer.cpp b/xfa/fxfa/cxfa_imagerenderer.cpp index 0c6a44edcb..dfa45f07d7 100644 --- a/xfa/fxfa/cxfa_imagerenderer.cpp +++ b/xfa/fxfa/cxfa_imagerenderer.cpp @@ -6,7 +6,6 @@ #include "xfa/fxfa/cxfa_imagerenderer.h" -#include "core/fpdfapi/page/cpdf_pageobjectholder.h" #include "core/fxge/cfx_renderdevice.h" #include "core/fxge/dib/cfx_dibsource.h" #include "core/fxge/dib/cfx_imagerenderer.h" @@ -88,9 +87,9 @@ bool CXFA_ImageRenderer::Start() { dest_rect.right - image_rect.left, dest_rect.bottom - image_rect.top); RetainPtr pStretched = m_pDIBSource->StretchTo(dest_width, dest_height, m_Flags, &dest_clip); - if (pStretched) { - CompositeDIBitmap(pStretched, dest_rect.left, dest_rect.top, false); - } + if (pStretched) + CompositeDIBitmap(pStretched, dest_rect.left, dest_rect.top); + return false; } @@ -122,76 +121,41 @@ bool CXFA_ImageRenderer::Continue() { void CXFA_ImageRenderer::CompositeDIBitmap( const RetainPtr& pDIBitmap, int left, - int top, - int iTransparency) { + int top) { if (!pDIBitmap) return; - bool bIsolated = !!(iTransparency & PDFTRANS_ISOLATED); - bool bGroup = !!(iTransparency & PDFTRANS_GROUP); 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; + } else if (m_pDevice->SetBitMask(pDIBitmap, left, top, 0)) { + return; } 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()) - return; + if (pDIBitmap->IsAlphaMask()) + return; - m_pDevice->SetDIBitsWithBlend(pDIBitmap, left, top, FXDIB_BLEND_NORMAL); - } else { - FX_RECT rect(left, top, left + pDIBitmap->GetWidth(), - top + pDIBitmap->GetHeight()); - rect.Intersect(m_pDevice->GetClipBox()); - RetainPtr pClone; - if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) { - pClone = m_pDevice->GetBackDrop()->Clone(&rect); - RetainPtr pForeBitmap = m_pDevice->GetBitmap(); - pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(), - pForeBitmap, rect.left, rect.top); - left = left >= 0 ? 0 : left; - top = top >= 0 ? 0 : top; - if (!pDIBitmap->IsAlphaMask()) - pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(), - pDIBitmap, left, top, FXDIB_BLEND_NORMAL); - else - pClone->CompositeMask(0, 0, pClone->GetWidth(), pClone->GetHeight(), - pDIBitmap, 0, left, top, FXDIB_BLEND_NORMAL); - } else { - pClone = pDIBitmap; - } - if (m_pDevice->GetBackDrop()) { - m_pDevice->SetDIBits(pClone, rect.left, rect.top); - } else { - if (pDIBitmap->IsAlphaMask()) - return; - m_pDevice->SetDIBitsWithBlend(pDIBitmap, rect.left, rect.top, - FXDIB_BLEND_NORMAL); - } - } + m_pDevice->SetDIBitsWithBlend(pDIBitmap, left, top, FXDIB_BLEND_NORMAL); return; } if (!pDIBitmap->HasAlpha() || (m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE)) { return; } + RetainPtr pCloneConvert = pDIBitmap->CloneConvert(FXDIB_Rgb); if (!pCloneConvert) return; CXFA_ImageRenderer imageRender(m_pDevice, pCloneConvert, &m_ImageMatrix, m_Flags); - if (!imageRender.Start()) { + if (!imageRender.Start()) return; - } + while (imageRender.Continue()) continue; } diff --git a/xfa/fxfa/cxfa_imagerenderer.h b/xfa/fxfa/cxfa_imagerenderer.h index c0cc64e073..7e013d3243 100644 --- a/xfa/fxfa/cxfa_imagerenderer.h +++ b/xfa/fxfa/cxfa_imagerenderer.h @@ -30,11 +30,10 @@ class CXFA_ImageRenderer { bool Start(); bool Continue(); - protected: + private: void CompositeDIBitmap(const RetainPtr& pDIBitmap, int left, - int top, - int iTransparency); + int top); CFX_RenderDevice* m_pDevice; int m_Status = 0; -- cgit v1.2.3