From 1a1d7648d3e338b756e464cebb2ae1a815359afa Mon Sep 17 00:00:00 2001 From: tsepez Date: Tue, 6 Dec 2016 06:29:28 -0800 Subject: 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 --- core/fxcodec/codec/fx_codec_progress.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'core/fxcodec') 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 +#include #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 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; -- cgit v1.2.3