diff options
author | tsepez <tsepez@chromium.org> | 2016-12-13 12:48:13 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-12-13 12:48:13 -0800 |
commit | 974b4a6c4bceb50bbe5bf316e9e273b62eaeceac (patch) | |
tree | e243d34a04905b88a11e9146e698daaa0cee2416 /core/fxcodec/codec/fx_codec_fax.cpp | |
parent | 988599c5d81bbb568f949454580ec6001258f806 (diff) | |
download | pdfium-974b4a6c4bceb50bbe5bf316e9e273b62eaeceac.tar.xz |
Return unique_ptr<>s from fxcodec/chromium/2951
Review-Url: https://codereview.chromium.org/2572843002
Diffstat (limited to 'core/fxcodec/codec/fx_codec_fax.cpp')
-rw-r--r-- | core/fxcodec/codec/fx_codec_fax.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/core/fxcodec/codec/fx_codec_fax.cpp b/core/fxcodec/codec/fx_codec_fax.cpp index 5102c778a4..62ad38e19f 100644 --- a/core/fxcodec/codec/fx_codec_fax.cpp +++ b/core/fxcodec/codec/fx_codec_fax.cpp @@ -5,10 +5,12 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include <algorithm> +#include <memory> #include <vector> #include "core/fxcodec/codec/codec_int.h" #include "core/fxcodec/fx_codec.h" +#include "third_party/base/ptr_util.h" namespace { @@ -580,16 +582,17 @@ void FaxG4Decode(const uint8_t* src_buf, *pbitpos = bitpos; } -CCodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(const uint8_t* src_buf, - uint32_t src_size, - int width, - int height, - int K, - bool EndOfLine, - bool EncodedByteAlign, - bool BlackIs1, - int Columns, - int Rows) { +std::unique_ptr<CCodec_ScanlineDecoder> CCodec_FaxModule::CreateDecoder( + const uint8_t* src_buf, + uint32_t src_size, + int width, + int height, + int K, + bool EndOfLine, + bool EncodedByteAlign, + bool BlackIs1, + int Columns, + int Rows) { int actual_width = Columns ? Columns : width; int actual_height = Rows ? Rows : height; @@ -602,6 +605,7 @@ CCodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(const uint8_t* src_buf, return nullptr; uint32_t pitch = (static_cast<uint32_t>(actual_width) + 31) / 32 * 4; - return new CCodec_FaxDecoder(src_buf, src_size, actual_width, actual_height, - pitch, K, EndOfLine, EncodedByteAlign, BlackIs1); + return pdfium::MakeUnique<CCodec_FaxDecoder>( + src_buf, src_size, actual_width, actual_height, pitch, K, EndOfLine, + EncodedByteAlign, BlackIs1); } |