summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/cjpx_decoder.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-06-27 18:02:30 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-27 18:02:30 +0000
commit00ba8bbea0ff57d6f11257736408e530e54ef642 (patch)
tree9fca07225ada3ccb705cd5f29a212a4d84b5b2b9 /core/fxcodec/codec/cjpx_decoder.h
parentd78a964c31f303e828453ee189d4998558bac8e1 (diff)
downloadpdfium-00ba8bbea0ff57d6f11257736408e530e54ef642.tar.xz
Use spans and UnownedPtrs in cjpx_decoder.h
Change-Id: I1c9f8221ce7a0e42407e93deec481be2e941cfde Reviewed-on: https://pdfium-review.googlesource.com/36210 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcodec/codec/cjpx_decoder.h')
-rw-r--r--core/fxcodec/codec/cjpx_decoder.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/core/fxcodec/codec/cjpx_decoder.h b/core/fxcodec/codec/cjpx_decoder.h
index 9de9d6c4ab..5be4b874d2 100644
--- a/core/fxcodec/codec/cjpx_decoder.h
+++ b/core/fxcodec/codec/cjpx_decoder.h
@@ -12,6 +12,7 @@
#include "core/fxcodec/codec/codec_int.h"
#include "core/fxcrt/unowned_ptr.h"
+#include "third_party/base/span.h"
#include "third_party/libopenjpeg20/openjpeg.h"
class CPDF_ColorSpace;
@@ -21,20 +22,18 @@ class CJPX_Decoder {
explicit CJPX_Decoder(CPDF_ColorSpace* cs);
~CJPX_Decoder();
- bool Init(const unsigned char* src_data, uint32_t src_size);
+ bool Init(pdfium::span<const uint8_t> src_data);
void GetInfo(uint32_t* width, uint32_t* height, uint32_t* components);
bool Decode(uint8_t* dest_buf,
uint32_t pitch,
const std::vector<uint8_t>& offsets);
private:
- const uint8_t* m_SrcData;
- uint32_t m_SrcSize;
- // TODO(rharrison): Convert these to unowned ptrs, if possible.
- opj_image_t* m_Image;
- opj_codec_t* m_Codec;
+ pdfium::span<const uint8_t> m_SrcData;
+ UnownedPtr<opj_image_t> m_Image;
+ UnownedPtr<opj_codec_t> m_Codec;
std::unique_ptr<DecodeData> m_DecodeData;
- opj_stream_t* m_Stream;
+ UnownedPtr<opj_stream_t> m_Stream;
opj_dparameters_t m_Parameters;
UnownedPtr<const CPDF_ColorSpace> const m_ColorSpace;
};