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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 }; | 634 }; |
635 CCodec_FlateScanlineDecoder::CCodec_FlateScanlineDecoder() { | 635 CCodec_FlateScanlineDecoder::CCodec_FlateScanlineDecoder() { |
636 m_pFlate = NULL; | 636 m_pFlate = NULL; |
637 m_pScanline = NULL; | 637 m_pScanline = NULL; |
638 m_pLastLine = NULL; | 638 m_pLastLine = NULL; |
639 m_pPredictBuffer = NULL; | 639 m_pPredictBuffer = NULL; |
640 m_pPredictRaw = NULL; | 640 m_pPredictRaw = NULL; |
641 m_LeftOver = 0; | 641 m_LeftOver = 0; |
642 } | 642 } |
643 CCodec_FlateScanlineDecoder::~CCodec_FlateScanlineDecoder() { | 643 CCodec_FlateScanlineDecoder::~CCodec_FlateScanlineDecoder() { |
644 if (m_pScanline) { | |
645 FX_Free(m_pScanline); | 644 FX_Free(m_pScanline); |
646 } | |
647 if (m_pLastLine) { | |
648 FX_Free(m_pLastLine); | 645 FX_Free(m_pLastLine); |
649 } | |
650 if (m_pPredictBuffer) { | |
651 FX_Free(m_pPredictBuffer); | 646 FX_Free(m_pPredictBuffer); |
652 } | |
653 if (m_pPredictRaw) { | |
654 FX_Free(m_pPredictRaw); | 647 FX_Free(m_pPredictRaw); |
655 } | |
656 if (m_pFlate) { | 648 if (m_pFlate) { |
657 FPDFAPI_FlateEnd(m_pFlate); | 649 FPDFAPI_FlateEnd(m_pFlate); |
658 } | 650 } |
659 } | 651 } |
660 void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf, | 652 void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf, |
661 FX_DWORD src_size, | 653 FX_DWORD src_size, |
662 int width, | 654 int width, |
663 int height, | 655 int height, |
664 int nComps, | 656 int nComps, |
665 int bpc, | 657 int bpc, |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 FX_DWORD src_size, | 960 FX_DWORD src_size, |
969 uint8_t*& dest_buf, | 961 uint8_t*& dest_buf, |
970 FX_DWORD& dest_size) { | 962 FX_DWORD& dest_size) { |
971 dest_size = src_size + src_size / 1000 + 12; | 963 dest_size = src_size + src_size / 1000 + 12; |
972 dest_buf = FX_Alloc(uint8_t, dest_size); | 964 dest_buf = FX_Alloc(uint8_t, dest_size); |
973 unsigned long temp_size = dest_size; | 965 unsigned long temp_size = dest_size; |
974 FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size); | 966 FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size); |
975 dest_size = (FX_DWORD)temp_size; | 967 dest_size = (FX_DWORD)temp_size; |
976 return TRUE; | 968 return TRUE; |
977 } | 969 } |
OLD | NEW |