From 2929d135d076fb6927a02ff94935d5efc45e7257 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 25 Apr 2018 18:37:31 +0000 Subject: Remove unused PNGEncode() code. BUG=pdfium:41 Change-Id: I98070a5a6c88a0769f2b571eae4fe62092f7dfcd Reviewed-on: https://pdfium-review.googlesource.com/31232 Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- core/fpdfapi/parser/fpdf_parser_decode.cpp | 9 ------- core/fpdfapi/parser/fpdf_parser_decode.h | 8 ------- core/fxcodec/codec/ccodec_flatemodule.h | 5 ---- core/fxcodec/codec/fx_codec_flate.cpp | 38 ------------------------------ 4 files changed, 60 deletions(-) diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp index edfbaf4331..e734183b2b 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp @@ -559,15 +559,6 @@ bool FlateEncode(const uint8_t* src_buf, dest_size); } -bool PngEncode(const uint8_t* src_buf, - uint32_t src_size, - uint8_t** dest_buf, - uint32_t* dest_size) { - CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); - return pEncoders->GetFlateModule()->PngEncode(src_buf, src_size, dest_buf, - dest_size); -} - uint32_t FlateDecode(const uint8_t* src_buf, uint32_t src_size, uint8_t** dest_buf, diff --git a/core/fpdfapi/parser/fpdf_parser_decode.h b/core/fpdfapi/parser/fpdf_parser_decode.h index d60e551e80..825d431019 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode.h +++ b/core/fpdfapi/parser/fpdf_parser_decode.h @@ -28,14 +28,6 @@ bool FlateEncode(const uint8_t* src_buf, uint8_t** dest_buf, uint32_t* dest_size); -// This used to have more parameters like the predictor and bpc, but there was -// only one caller, so the interface has been simplified, the values are hard -// coded, and dead code has been removed. -bool PngEncode(const uint8_t* src_buf, - uint32_t src_size, - uint8_t** dest_buf, - uint32_t* dest_size); - uint32_t FlateDecode(const uint8_t* src_buf, uint32_t src_size, uint8_t** dest_buf, diff --git a/core/fxcodec/codec/ccodec_flatemodule.h b/core/fxcodec/codec/ccodec_flatemodule.h index ae34103f3b..c84be7cc87 100644 --- a/core/fxcodec/codec/ccodec_flatemodule.h +++ b/core/fxcodec/codec/ccodec_flatemodule.h @@ -41,11 +41,6 @@ class CCodec_FlateModule { uint32_t src_size, uint8_t** dest_buf, uint32_t* dest_size); - - bool PngEncode(const uint8_t* src_buf, - uint32_t src_size, - uint8_t** dest_buf, - uint32_t* dest_size); }; #endif // CORE_FXCODEC_CODEC_CCODEC_FLATEMODULE_H_ diff --git a/core/fxcodec/codec/fx_codec_flate.cpp b/core/fxcodec/codec/fx_codec_flate.cpp index 8cef6c7125..7b446f6445 100644 --- a/core/fxcodec/codec/fx_codec_flate.cpp +++ b/core/fxcodec/codec/fx_codec_flate.cpp @@ -265,32 +265,6 @@ uint8_t PathPredictor(int a, int b, int c) { return (uint8_t)c; } -void PNG_PredictorEncode(uint8_t** data_buf, uint32_t* data_size) { - const int row_size = 7; - const int row_count = (*data_size + row_size - 1) / row_size; - const int last_row_size = *data_size % row_size; - uint8_t* dest_buf = FX_Alloc2D(uint8_t, row_size + 1, row_count); - int byte_cnt = 0; - uint8_t* pSrcData = *data_buf; - uint8_t* pDestData = dest_buf; - for (int row = 0; row < row_count; row++) { - for (int byte = 0; byte < row_size && byte_cnt < (int)*data_size; byte++) { - pDestData[0] = 2; - uint8_t up = 0; - if (row) - up = pSrcData[byte - row_size]; - pDestData[byte + 1] = pSrcData[byte] - up; - ++byte_cnt; - } - pDestData += (row_size + 1); - pSrcData += row_size; - } - FX_Free(*data_buf); - *data_buf = dest_buf; - *data_size = (row_size + 1) * row_count - - (last_row_size > 0 ? (row_size - last_row_size) : 0); -} - void PNG_PredictLine(uint8_t* pDestData, const uint8_t* pSrcData, const uint8_t* pLastLine, @@ -827,15 +801,3 @@ bool CCodec_FlateModule::Encode(const uint8_t* src_buf, *dest_size = (uint32_t)temp_size; return true; } - -bool CCodec_FlateModule::PngEncode(const uint8_t* src_buf, - uint32_t src_size, - uint8_t** dest_buf, - uint32_t* dest_size) { - uint8_t* pSrcBuf = FX_Alloc(uint8_t, src_size); - memcpy(pSrcBuf, src_buf, src_size); - PNG_PredictorEncode(&pSrcBuf, &src_size); - bool ret = Encode(pSrcBuf, src_size, dest_buf, dest_size); - FX_Free(pSrcBuf); - return ret; -} -- cgit v1.2.3