diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-17 15:28:07 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-17 15:28:07 +0000 |
commit | 7577d5ccc34a6ab8d12d20766173338cb3466fb6 (patch) | |
tree | f6728d763bbc465941e50d7798e6672a409829c1 /xfa | |
parent | 1ab9b926b3c76e1cfc763b1dc8df342a5d3225d9 (diff) | |
download | pdfium-7577d5ccc34a6ab8d12d20766173338cb3466fb6.tar.xz |
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 <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fxfa/cxfa_imagerenderer.cpp | 60 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_imagerenderer.h | 5 |
2 files changed, 14 insertions, 51 deletions
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<CFX_DIBitmap> 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<CFX_DIBitmap>& 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<CFX_DIBitmap> pClone; - if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) { - pClone = m_pDevice->GetBackDrop()->Clone(&rect); - RetainPtr<CFX_DIBitmap> 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<CFX_DIBitmap> 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<CFX_DIBitmap>& pDIBitmap, int left, - int top, - int iTransparency); + int top); CFX_RenderDevice* m_pDevice; int m_Status = 0; |