OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../../../third_party/base/nonstd_unique_ptr.h" | 7 #include "../../../../third_party/base/nonstd_unique_ptr.h" |
8 #include "../../../../third_party/zlib_v128/zlib.h" | 8 #include "../../../../third_party/zlib_v128/zlib.h" |
9 #include "../../../include/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" |
10 #include "../../../include/fxcodec/fx_codec_flate.h" | 10 #include "../../../include/fxcodec/fx_codec_flate.h" |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 | 640 |
641 CCodec_FlateScanlineDecoder::CCodec_FlateScanlineDecoder() { | 641 CCodec_FlateScanlineDecoder::CCodec_FlateScanlineDecoder() { |
642 m_pFlate = NULL; | 642 m_pFlate = NULL; |
643 m_pScanline = NULL; | 643 m_pScanline = NULL; |
644 m_pLastLine = NULL; | 644 m_pLastLine = NULL; |
645 m_pPredictBuffer = NULL; | 645 m_pPredictBuffer = NULL; |
646 m_pPredictRaw = NULL; | 646 m_pPredictRaw = NULL; |
647 m_LeftOver = 0; | 647 m_LeftOver = 0; |
648 } | 648 } |
649 CCodec_FlateScanlineDecoder::~CCodec_FlateScanlineDecoder() { | 649 CCodec_FlateScanlineDecoder::~CCodec_FlateScanlineDecoder() { |
650 if (m_pScanline) { | 650 FX_Free(m_pScanline); |
651 FX_Free(m_pScanline); | 651 FX_Free(m_pLastLine); |
652 } | 652 FX_Free(m_pPredictBuffer); |
653 if (m_pLastLine) { | 653 FX_Free(m_pPredictRaw); |
654 FX_Free(m_pLastLine); | |
655 } | |
656 if (m_pPredictBuffer) { | |
657 FX_Free(m_pPredictBuffer); | |
658 } | |
659 if (m_pPredictRaw) { | |
660 FX_Free(m_pPredictRaw); | |
661 } | |
662 if (m_pFlate) { | 654 if (m_pFlate) { |
663 FPDFAPI_FlateEnd(m_pFlate); | 655 FPDFAPI_FlateEnd(m_pFlate); |
664 } | 656 } |
665 } | 657 } |
666 void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf, | 658 void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf, |
667 FX_DWORD src_size, | 659 FX_DWORD src_size, |
668 int width, | 660 int width, |
669 int height, | 661 int height, |
670 int nComps, | 662 int nComps, |
671 int bpc, | 663 int bpc, |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 FX_DWORD src_size, | 966 FX_DWORD src_size, |
975 uint8_t*& dest_buf, | 967 uint8_t*& dest_buf, |
976 FX_DWORD& dest_size) { | 968 FX_DWORD& dest_size) { |
977 dest_size = src_size + src_size / 1000 + 12; | 969 dest_size = src_size + src_size / 1000 + 12; |
978 dest_buf = FX_Alloc(uint8_t, dest_size); | 970 dest_buf = FX_Alloc(uint8_t, dest_size); |
979 unsigned long temp_size = dest_size; | 971 unsigned long temp_size = dest_size; |
980 FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size); | 972 FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size); |
981 dest_size = (FX_DWORD)temp_size; | 973 dest_size = (FX_DWORD)temp_size; |
982 return TRUE; | 974 return TRUE; |
983 } | 975 } |
OLD | NEW |