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 "../../fx_zlib.h" | 7 #include "../../fx_zlib.h" |
8 #include "../../../include/fxcodec/fx_codec.h" | 8 #include "../../../include/fxcodec/fx_codec.h" |
9 #include "codec_int.h" | 9 #include "codec_int.h" |
10 extern "C" | 10 extern "C" |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 Columns = m_OrigWidth; | 647 Columns = m_OrigWidth; |
648 } | 648 } |
649 m_Colors = Colors; | 649 m_Colors = Colors; |
650 m_BitsPerComponent = BitsPerComponent; | 650 m_BitsPerComponent = BitsPerComponent; |
651 m_Columns = Columns; | 651 m_Columns = Columns; |
652 m_PredictPitch = (m_BitsPerComponent * m_Colors * m_Columns + 7) / 8
; | 652 m_PredictPitch = (m_BitsPerComponent * m_Colors * m_Columns + 7) / 8
; |
653 m_pLastLine = FX_Alloc(FX_BYTE, m_PredictPitch); | 653 m_pLastLine = FX_Alloc(FX_BYTE, m_PredictPitch); |
654 if (m_pLastLine == NULL) { | 654 if (m_pLastLine == NULL) { |
655 return FALSE; | 655 return FALSE; |
656 } | 656 } |
657 FXSYS_memset32(m_pLastLine, 0, m_PredictPitch); | |
658 m_pPredictRaw = FX_Alloc(FX_BYTE, m_PredictPitch + 1); | 657 m_pPredictRaw = FX_Alloc(FX_BYTE, m_PredictPitch + 1); |
659 if (m_pPredictRaw == NULL) { | 658 if (m_pPredictRaw == NULL) { |
660 return FALSE; | 659 return FALSE; |
661 } | 660 } |
662 m_pPredictBuffer = FX_Alloc(FX_BYTE, m_PredictPitch); | 661 m_pPredictBuffer = FX_Alloc(FX_BYTE, m_PredictPitch); |
663 if (m_pPredictBuffer == NULL) { | 662 if (m_pPredictBuffer == NULL) { |
664 return FALSE; | 663 return FALSE; |
665 } | 664 } |
666 } | 665 } |
667 } | 666 } |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 dest_size = src_size + src_size / 1000 + 12; | 935 dest_size = src_size + src_size / 1000 + 12; |
937 dest_buf = FX_Alloc( FX_BYTE, dest_size); | 936 dest_buf = FX_Alloc( FX_BYTE, dest_size); |
938 if (dest_buf == NULL) { | 937 if (dest_buf == NULL) { |
939 return FALSE; | 938 return FALSE; |
940 } | 939 } |
941 unsigned long temp_size = dest_size; | 940 unsigned long temp_size = dest_size; |
942 FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size); | 941 FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size); |
943 dest_size = (FX_DWORD)temp_size; | 942 dest_size = (FX_DWORD)temp_size; |
944 return TRUE; | 943 return TRUE; |
945 } | 944 } |
OLD | NEW |