summaryrefslogtreecommitdiff
path: root/core/fxge/skia
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/fxge/skia
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/fxge/skia')
-rw-r--r--core/fxge/skia/fx_skia_device.cpp29
-rw-r--r--core/fxge/skia/fx_skia_device.h6
2 files changed, 12 insertions, 23 deletions
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 81ca95fbe8..429510d30e 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -1884,8 +1884,8 @@ bool CFX_SkiaDeviceDriver::SetDIBits(
#ifdef _SKIA_SUPPORT_
CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), left,
top + pBitmap->GetHeight());
- void* dummy;
- return StartDIBits(pBitmap, 0xFF, argb, &m, 0, dummy, blend_type);
+ std::unique_ptr<CFX_ImageRenderer> dummy;
+ return StartDIBits(pBitmap, 0xFF, argb, &m, 0, &dummy, blend_type);
#endif // _SKIA_SUPPORT_
#ifdef _SKIA_SUPPORT_PATHS_
@@ -1923,8 +1923,8 @@ bool CFX_SkiaDeviceDriver::StretchDIBits(
SkRect skClipRect = SkRect::MakeLTRB(pClipRect->left, pClipRect->bottom,
pClipRect->right, pClipRect->top);
m_pCanvas->clipRect(skClipRect, SkClipOp::kIntersect, true);
- void* dummy;
- bool result = StartDIBits(pSource, 0xFF, argb, &m, 0, dummy, blend_type);
+ std::unique_ptr<CFX_ImageRenderer> dummy;
+ bool result = StartDIBits(pSource, 0xFF, argb, &m, 0, &dummy, blend_type);
m_pCanvas->restore();
return result;
@@ -1960,7 +1960,7 @@ bool CFX_SkiaDeviceDriver::StartDIBits(
uint32_t argb,
const CFX_Matrix* pMatrix,
uint32_t render_flags,
- void*& handle,
+ std::unique_ptr<CFX_ImageRenderer>* handle,
int blend_type) {
#ifdef _SKIA_SUPPORT_
m_pCache->FlushForDraw();
@@ -2009,24 +2009,15 @@ bool CFX_SkiaDeviceDriver::StartDIBits(
if (!m_pBitmap->GetBuffer())
return true;
m_pBitmap->UnPreMultiply();
- CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer;
- pRenderer->Start(m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb,
+ *handle = pdfium::MakeUnique<CFX_ImageRenderer>();
+ (*handle)->Start(m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb,
pMatrix, render_flags, m_bRgbByteOrder, 0, nullptr);
- handle = pRenderer;
#endif // _SKIA_SUPPORT_PATHS_
return true;
}
-void CFX_SkiaDeviceDriver::CancelDIBits(void* handle) {
-#ifdef _SKIA_SUPPORT_PATHS_
- if (!m_pBitmap->GetBuffer())
- return;
-
- delete reinterpret_cast<CFX_ImageRenderer*>(handle);
-#endif // _SKIA_SUPPORT_PATHS_
-}
-
-bool CFX_SkiaDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) {
+bool CFX_SkiaDeviceDriver::ContinueDIBits(CFX_ImageRenderer* handle,
+ IFX_Pause* pPause) {
#ifdef _SKIA_SUPPORT_
m_pCache->FlushForDraw();
return false;
@@ -2037,7 +2028,7 @@ bool CFX_SkiaDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) {
if (!m_pBitmap->GetBuffer()) {
return true;
}
- return static_cast<CFX_ImageRenderer*>(handle)->Continue(pPause);
+ return handle->Continue(pPause);
#endif // _SKIA_SUPPORT_PATHS_
}
diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h
index 9b5e4b06fa..cde05eba67 100644
--- a/core/fxge/skia/fx_skia_device.h
+++ b/core/fxge/skia/fx_skia_device.h
@@ -119,12 +119,10 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
uint32_t color,
const CFX_Matrix* pMatrix,
uint32_t flags,
- void*& handle,
+ std::unique_ptr<CFX_ImageRenderer>* handle,
int blend_type) override;
- bool ContinueDIBits(void* handle, IFX_Pause* pPause) override;
-
- void CancelDIBits(void* handle) override;
+ bool ContinueDIBits(CFX_ImageRenderer* handle, IFX_Pause* pPause) override;
bool DrawBitsWithMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
const CFX_RetainPtr<CFX_DIBSource>& pMask,