summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/cjpx_decoder.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-30 16:12:02 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-30 20:26:02 +0000
commit0bb1333a9eff1190ddd68f34c71d6a779c69dfef (patch)
tree5a46946c4852f147309e2b1389e6f42d6553abf7 /core/fxcodec/codec/cjpx_decoder.h
parent908c848202ef137e98d96f82a4eadfae551403b7 (diff)
downloadpdfium-0bb1333a9eff1190ddd68f34c71d6a779c69dfef.tar.xz
Add some calls to MakeUnique
This CL replaces some new's with pdfium::MakeUnique. Change-Id: I50faf3ed55e7730b094c14a7989a9dd51cf33cbb Reviewed-on: https://pdfium-review.googlesource.com/3430 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcodec/codec/cjpx_decoder.h')
-rw-r--r--core/fxcodec/codec/cjpx_decoder.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/core/fxcodec/codec/cjpx_decoder.h b/core/fxcodec/codec/cjpx_decoder.h
new file mode 100644
index 0000000000..2e63caac73
--- /dev/null
+++ b/core/fxcodec/codec/cjpx_decoder.h
@@ -0,0 +1,36 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCODEC_CODEC_CJPX_DECODER_H_
+#define CORE_FXCODEC_CODEC_CJPX_DECODER_H_
+
+#include <vector>
+
+#include "third_party/libopenjpeg20/openjpeg.h"
+
+class CPDF_ColorSpace;
+
+class CJPX_Decoder {
+ public:
+ explicit CJPX_Decoder(CPDF_ColorSpace* cs);
+ ~CJPX_Decoder();
+
+ bool Init(const unsigned char* src_data, uint32_t src_size);
+ void GetInfo(uint32_t* width, uint32_t* height, uint32_t* components);
+ bool Decode(uint8_t* dest_buf,
+ int pitch,
+ const std::vector<uint8_t>& offsets);
+
+ private:
+ const uint8_t* m_SrcData;
+ uint32_t m_SrcSize;
+ opj_image_t* image;
+ opj_codec_t* l_codec;
+ opj_stream_t* l_stream;
+ const CPDF_ColorSpace* const m_ColorSpace;
+};
+
+#endif // CORE_FXCODEC_CODEC_CJPX_DECODER_H_