diff options
author | Nicolas Pena <npm@chromium.org> | 2017-04-04 13:38:29 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-04 18:21:06 +0000 |
commit | c3202a95773d7a2c95038ad45c5ba2c9e095e67b (patch) | |
tree | 4742e65e173bbfec56a10b249abee6d9934047bd /core/fxge/agg | |
parent | 6088612c21898eb79cfbde401984176dd94c385c (diff) | |
download | pdfium-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/agg')
-rw-r--r-- | core/fxge/agg/fx_agg_driver.cpp | 21 | ||||
-rw-r--r-- | core/fxge/agg/fx_agg_driver.h | 5 |
2 files changed, 8 insertions, 18 deletions
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index 031246b494..a04d716b8f 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -1650,29 +1650,20 @@ bool CFX_AggDeviceDriver::StartDIBits( uint32_t argb, const CFX_Matrix* pMatrix, uint32_t render_flags, - void*& handle, + std::unique_ptr<CFX_ImageRenderer>* handle, int blend_type) { if (!m_pBitmap->GetBuffer()) return true; - 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; return true; } -bool CFX_AggDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) { - return m_pBitmap->GetBuffer() - ? reinterpret_cast<CFX_ImageRenderer*>(pHandle)->Continue(pPause) - : true; -} - -void CFX_AggDeviceDriver::CancelDIBits(void* pHandle) { - if (!m_pBitmap->GetBuffer()) - return; - - delete reinterpret_cast<CFX_ImageRenderer*>(pHandle); +bool CFX_AggDeviceDriver::ContinueDIBits(CFX_ImageRenderer* pHandle, + IFX_Pause* pPause) { + return m_pBitmap->GetBuffer() ? pHandle->Continue(pPause) : true; } #ifndef _SKIA_SUPPORT_ diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h index 723ed6d98a..3eb56c507e 100644 --- a/core/fxge/agg/fx_agg_driver.h +++ b/core/fxge/agg/fx_agg_driver.h @@ -87,10 +87,9 @@ class CFX_AggDeviceDriver : 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 DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, |