diff options
author | tsepez <tsepez@chromium.org> | 2016-12-06 06:29:28 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-12-06 06:29:28 -0800 |
commit | 1a1d7648d3e338b756e464cebb2ae1a815359afa (patch) | |
tree | defa2de6d2cb61efd95ef212eb3e89e1a5811032 /core/fxcodec/codec | |
parent | 7341149c634e0ab9a619898826440f6e952cf0aa (diff) | |
download | pdfium-1a1d7648d3e338b756e464cebb2ae1a815359afa.tar.xz |
Return unique_ptrs from CFX_DIBitmap::Clone().
Because that's what clone does. Perform immediate release
in some spots to avoid disrupting too much at once.
Review-Url: https://codereview.chromium.org/2534953004
Diffstat (limited to 'core/fxcodec/codec')
-rw-r--r-- | core/fxcodec/codec/fx_codec_progress.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp index 7d8a3203e9..8d29a7b3f3 100644 --- a/core/fxcodec/codec/fx_codec_progress.cpp +++ b/core/fxcodec/codec/fx_codec_progress.cpp @@ -7,6 +7,7 @@ #include "core/fxcodec/codec/ccodec_progressivedecoder.h" #include <algorithm> +#include <memory> #include "core/fxcodec/fx_codec.h" #include "core/fxge/fx_dib.h" @@ -2261,7 +2262,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) { (m_clipBox.left == 0 && m_clipBox.top == 0 && m_clipBox.right == m_SrcWidth && m_clipBox.bottom == m_SrcHeight) ? pDIBitmap - : pDIBitmap->Clone(&m_clipBox); + : pDIBitmap->Clone(&m_clipBox).release(); if (pDIBitmap != pClipBitmap) { delete pDIBitmap; } @@ -2346,7 +2347,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) { m_status = FXCODEC_STATUS_ERR_MEMORY; return m_status; } - CFX_DIBitmap* pStrechBitmap = pFormatBitmap->StretchTo( + std::unique_ptr<CFX_DIBitmap> pStrechBitmap = pFormatBitmap->StretchTo( m_sizeX, m_sizeY, m_bInterpol ? FXDIB_INTERPOL : FXDIB_DOWNSAMPLE); delete pFormatBitmap; pFormatBitmap = nullptr; @@ -2357,9 +2358,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) { return m_status; } m_pDeviceBitmap->TransferBitmap(m_startX, m_startY, m_sizeX, m_sizeY, - pStrechBitmap, 0, 0); - delete pStrechBitmap; - pStrechBitmap = nullptr; + pStrechBitmap.get(), 0, 0); m_pDeviceBitmap = nullptr; m_pFile = nullptr; m_status = FXCODEC_STATUS_DECODE_FINISH; |