summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render/cpdf_imagerenderer.cpp
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 /core/fpdfapi/render/cpdf_imagerenderer.cpp
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 'core/fpdfapi/render/cpdf_imagerenderer.cpp')
-rw-r--r--core/fpdfapi/render/cpdf_imagerenderer.cpp36
1 files changed, 16 insertions, 20 deletions
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp
index 8c3cd6a23a..b4cc36f6c3 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.cpp
+++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp
@@ -40,23 +40,18 @@
#include "core/fxge/skia/fx_skia_device.h"
#endif
-CPDF_ImageRenderer::CPDF_ImageRenderer() {
- m_pRenderStatus = nullptr;
- m_pImageObject = nullptr;
- m_Result = true;
- m_Status = 0;
- m_DeviceHandle = nullptr;
- m_bStdCS = false;
- m_bPatternColor = false;
- m_BlendType = FXDIB_BLEND_NORMAL;
- m_pPattern = nullptr;
- m_pObj2Device = nullptr;
-}
-
-CPDF_ImageRenderer::~CPDF_ImageRenderer() {
- if (m_DeviceHandle)
- m_pRenderStatus->m_pDevice->CancelDIBits(m_DeviceHandle);
-}
+CPDF_ImageRenderer::CPDF_ImageRenderer()
+ : m_pRenderStatus(nullptr),
+ m_pImageObject(nullptr),
+ m_Status(0),
+ m_pObj2Device(nullptr),
+ m_bPatternColor(false),
+ m_pPattern(nullptr),
+ m_bStdCS(false),
+ m_BlendType(FXDIB_BLEND_NORMAL),
+ m_Result(true) {}
+
+CPDF_ImageRenderer::~CPDF_ImageRenderer() {}
bool CPDF_ImageRenderer::StartLoadDIBSource() {
CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
@@ -413,7 +408,7 @@ bool CPDF_ImageRenderer::StartDIBSource() {
CFX_SkiaDeviceDriver::PreMultiply(premultiplied);
if (m_pRenderStatus->m_pDevice->StartDIBitsWithBlend(
premultiplied, m_BitmapAlpha, m_FillArgb, &m_ImageMatrix, m_Flags,
- m_DeviceHandle, m_BlendType)) {
+ &m_DeviceHandle, m_BlendType)) {
if (m_DeviceHandle) {
m_Status = 3;
return true;
@@ -423,7 +418,7 @@ bool CPDF_ImageRenderer::StartDIBSource() {
#else
if (m_pRenderStatus->m_pDevice->StartDIBitsWithBlend(
m_pDIBSource, m_BitmapAlpha, m_FillArgb, &m_ImageMatrix, m_Flags,
- m_DeviceHandle, m_BlendType)) {
+ &m_DeviceHandle, m_BlendType)) {
if (m_DeviceHandle) {
m_Status = 3;
return true;
@@ -564,7 +559,8 @@ bool CPDF_ImageRenderer::Continue(IFX_Pause* pPause) {
return false;
}
if (m_Status == 3)
- return m_pRenderStatus->m_pDevice->ContinueDIBits(m_DeviceHandle, pPause);
+ return m_pRenderStatus->m_pDevice->ContinueDIBits(m_DeviceHandle.get(),
+ pPause);
if (m_Status == 4) {
if (m_Loader.Continue(pPause))