summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-04-04 13:38:29 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-04 18:21:06 +0000
commitc3202a95773d7a2c95038ad45c5ba2c9e095e67b (patch)
tree4742e65e173bbfec56a10b249abee6d9934047bd /xfa
parent6088612c21898eb79cfbde401984176dd94c385c (diff)
downloadpdfium-c3202a95773d7a2c95038ad45c5ba2c9e095e67b.tar.xz
Let CPDF_ImageRenderer own the CFX_ImageRenderer
This CL avoids some void* usage and removes CancelDIBits after making a CPDF_ImageRenderer own its CFX_ImageRenderer. Bug: pdfium:686 Change-Id: Ied205c57a858cc14d8e2c592db3444ed465b2796 Reviewed-on: https://pdfium-review.googlesource.com/3673 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fde/cfde_renderdevice.cpp8
-rw-r--r--xfa/fxfa/cxfa_ffwidget.cpp12
2 files changed, 9 insertions, 11 deletions
diff --git a/xfa/fde/cfde_renderdevice.cpp b/xfa/fde/cfde_renderdevice.cpp
index 6f2431737b..839ffac019 100644
--- a/xfa/fde/cfde_renderdevice.cpp
+++ b/xfa/fde/cfde_renderdevice.cpp
@@ -13,6 +13,7 @@
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/cfx_substfont.h"
+#include "core/fxge/dib/cfx_imagerenderer.h"
#include "xfa/fde/cfde_brush.h"
#include "xfa/fde/cfde_path.h"
#include "xfa/fde/cfde_pen.h"
@@ -111,12 +112,11 @@ bool CFDE_RenderDevice::DrawImage(const CFX_RetainPtr<CFX_DIBSource>& pDib,
if (pDevMatrix) {
dib2fxdev.Concat(*pDevMatrix);
}
- void* handle = nullptr;
+ std::unique_ptr<CFX_ImageRenderer> handle;
m_pDevice->StartDIBits(pDib, 255, 0, (const CFX_Matrix*)&dib2fxdev, 0,
- handle);
- while (m_pDevice->ContinueDIBits(handle, nullptr)) {
+ &handle);
+ while (m_pDevice->ContinueDIBits(handle.get(), nullptr)) {
}
- m_pDevice->CancelDIBits(handle);
return !!handle;
}
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index 1ebc6da353..18d6f94bc7 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -17,6 +17,7 @@
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
+#include "core/fxge/dib/cfx_imagerenderer.h"
#include "core/fxge/dib/cfx_imagetransformer.h"
#include "xfa/fwl/fwl_widgethit.h"
#include "xfa/fxfa/app/cxfa_textlayout.h"
@@ -587,7 +588,7 @@ class CXFA_ImageRenderer {
FX_ARGB m_FillArgb;
uint32_t m_Flags;
std::unique_ptr<CFX_ImageTransformer> m_pTransformer;
- void* m_DeviceHandle;
+ std::unique_ptr<CFX_ImageRenderer> m_DeviceHandle;
int32_t m_BlendType;
bool m_Result;
bool m_bPrint;
@@ -604,10 +605,7 @@ CXFA_ImageRenderer::CXFA_ImageRenderer()
m_Result(true),
m_bPrint(false) {}
-CXFA_ImageRenderer::~CXFA_ImageRenderer() {
- if (m_DeviceHandle)
- m_pDevice->CancelDIBits(m_DeviceHandle);
-}
+CXFA_ImageRenderer::~CXFA_ImageRenderer() {}
bool CXFA_ImageRenderer::Start(CFX_RenderDevice* pDevice,
const CFX_RetainPtr<CFX_DIBSource>& pDIBSource,
@@ -628,7 +626,7 @@ bool CXFA_ImageRenderer::Start(CFX_RenderDevice* pDevice,
bool CXFA_ImageRenderer::StartDIBSource() {
if (m_pDevice->StartDIBitsWithBlend(m_pDIBSource, m_BitmapAlpha, m_FillArgb,
- &m_ImageMatrix, m_Flags, m_DeviceHandle,
+ &m_ImageMatrix, m_Flags, &m_DeviceHandle,
m_BlendType)) {
if (m_DeviceHandle) {
m_Status = 3;
@@ -735,7 +733,7 @@ bool CXFA_ImageRenderer::Continue(IFX_Pause* pPause) {
return false;
}
if (m_Status == 3)
- return m_pDevice->ContinueDIBits(m_DeviceHandle, pPause);
+ return m_pDevice->ContinueDIBits(m_DeviceHandle.get(), pPause);
return false;
}