Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3505)

Unified Diff: core/fxcodec/codec/fx_codec_progress.cpp

Issue 2534953004: Return unique_ptrs from CFX_DIBitmap::Clone(). (Closed)
Patch Set: nits Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/render/render_int.h ('k') | core/fxge/agg/fx_agg_driver.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcodec/codec/fx_codec_progress.cpp
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp
index 7d8a3203e9356000f04b94896cbf291652aa794d..8d29a7b3f3fbbf636e5671f531bc0ff352058295 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;
« no previous file with comments | « core/fpdfapi/render/render_int.h ('k') | core/fxge/agg/fx_agg_driver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698