summaryrefslogtreecommitdiff
path: root/core/fpdfapi
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
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')
-rw-r--r--core/fpdfapi/render/cpdf_imagerenderer.cpp36
-rw-r--r--core/fpdfapi/render/cpdf_imagerenderer.h3
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp4
3 files changed, 20 insertions, 23 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))
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.h b/core/fpdfapi/render/cpdf_imagerenderer.h
index 00b5d41601..79bb018886 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.h
+++ b/core/fpdfapi/render/cpdf_imagerenderer.h
@@ -11,6 +11,7 @@
#include "core/fpdfapi/render/cpdf_imageloader.h"
#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxge/dib/cfx_imagerenderer.h"
class CFX_DIBitmap;
class CFX_DIBSource;
@@ -74,7 +75,7 @@ class CPDF_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;
bool m_bStdCS;
int m_BlendType;
bool m_Result;
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 09e5bc1433..985d6ce8c5 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -2424,10 +2424,10 @@ void CPDF_RenderStatus::CompositeDIBitmap(
if (!pDIBitmap->IsAlphaMask()) {
if (bitmap_alpha < 255) {
#ifdef _SKIA_SUPPORT_
- void* dummy;
+ std::unique_ptr<CFX_ImageRenderer> dummy;
CFX_Matrix m(pDIBitmap->GetWidth(), 0, 0, -pDIBitmap->GetHeight(), left,
top + pDIBitmap->GetHeight());
- m_pDevice->StartDIBits(pDIBitmap, bitmap_alpha, 0, &m, 0, dummy);
+ m_pDevice->StartDIBits(pDIBitmap, bitmap_alpha, 0, &m, 0, &dummy);
return;
#else
pDIBitmap->MultiplyAlpha(bitmap_alpha);