diff options
author | Jane Liu <janeliulwq@google.com> | 2017-08-03 16:33:40 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-03 21:20:23 +0000 |
commit | 548334e57cae1039824d3db97bab5348fbe674e2 (patch) | |
tree | 5c547cc35c48fe5703fde77afd208f1bd1d01029 /core/fpdfapi | |
parent | 6a5b7872c838ba9e24ea6e1f9a306bb95a80ae6c (diff) | |
download | pdfium-548334e57cae1039824d3db97bab5348fbe674e2.tar.xz |
APIs and tests for retrieving raw/decoded data from image objects
Added FPDFImageObj_GetImageDataDecoded() for retrieving the uncompressed
data of an image, and FPDFImageObj_GetImageDataRaw() for retrieving the
raw data of an image.
* Refactored out DecodeStreamMaybeCopyAndReturnLength(), which is
used to decode both attachment data and image data.
* Within DecodeStreamMaybeCopyAndReturnLength(), used a different
decoder function which takes care of multiple filters if exist. As
a result, CPDF_StreamParser::DecodeInlineStream() which was made
static previously is now moved back into namespace.
Bug=pdfium:677
Change-Id: I22a22c99acaca98ef8c15f88911f2646a2c854d5
Reviewed-on: https://pdfium-review.googlesource.com/9811
Commit-Queue: Jane Liu <janeliulwq@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/page/cpdf_streamparser.cpp | 21 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_streamparser.h | 9 |
2 files changed, 10 insertions, 20 deletions
diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp index 964d600b3d..9d7dd1ed55 100644 --- a/core/fpdfapi/page/cpdf_streamparser.cpp +++ b/core/fpdfapi/page/cpdf_streamparser.cpp @@ -60,17 +60,14 @@ uint32_t DecodeAllScanlines(std::unique_ptr<CCodec_ScanlineDecoder> pDecoder, return pDecoder->GetSrcOffset(); } -} // namespace - -// Static -uint32_t CPDF_StreamParser::DecodeInlineStream(const uint8_t* src_buf, - uint32_t limit, - int width, - int height, - const CFX_ByteString& decoder, - CPDF_Dictionary* pParam, - uint8_t** dest_buf, - uint32_t* dest_size) { +uint32_t DecodeInlineStream(const uint8_t* src_buf, + uint32_t limit, + int width, + int height, + const CFX_ByteString& decoder, + CPDF_Dictionary* pParam, + uint8_t** dest_buf, + uint32_t* dest_size) { if (decoder == "CCITTFaxDecode" || decoder == "CCF") { std::unique_ptr<CCodec_ScanlineDecoder> pDecoder = FPDFAPI_CreateFaxDecoder(src_buf, limit, width, height, pParam); @@ -102,6 +99,8 @@ uint32_t CPDF_StreamParser::DecodeInlineStream(const uint8_t* src_buf, return 0xFFFFFFFF; } +} // namespace + CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize) : m_pBuf(pData), m_Size(dwSize), m_Pos(0), m_pPool(nullptr) {} diff --git a/core/fpdfapi/page/cpdf_streamparser.h b/core/fpdfapi/page/cpdf_streamparser.h index 9f9a8eaf12..fdc418c634 100644 --- a/core/fpdfapi/page/cpdf_streamparser.h +++ b/core/fpdfapi/page/cpdf_streamparser.h @@ -21,15 +21,6 @@ class CPDF_StreamParser { public: enum SyntaxType { EndOfData, Number, Keyword, Name, Others }; - static uint32_t DecodeInlineStream(const uint8_t* src_buf, - uint32_t limit, - int width, - int height, - const CFX_ByteString& decoder, - CPDF_Dictionary* pParam, - uint8_t** dest_buf, - uint32_t* dest_size); - CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize); CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize, |