| 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 "../../../include/fxcodec/fx_codec.h" | 7 #include "../../../include/fxcodec/fx_codec.h" |
| 8 #include "codec_int.h" | 8 #include "codec_int.h" |
| 9 const FX_BYTE OneLeadPos[256] = { | 9 const FX_BYTE OneLeadPos[256] = { |
| 10 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, | 10 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 { | 942 { |
| 943 m_pSrcBuf = src_buf; | 943 m_pSrcBuf = src_buf; |
| 944 m_Cols = width; | 944 m_Cols = width; |
| 945 m_Rows = height; | 945 m_Rows = height; |
| 946 m_Pitch = pitch; | 946 m_Pitch = pitch; |
| 947 m_pRefLine = FX_Alloc(FX_BYTE, m_Pitch); | 947 m_pRefLine = FX_Alloc(FX_BYTE, m_Pitch); |
| 948 if (m_pRefLine == NULL) { | 948 if (m_pRefLine == NULL) { |
| 949 return; | 949 return; |
| 950 } | 950 } |
| 951 FXSYS_memset8(m_pRefLine, 0xff, m_Pitch); | 951 FXSYS_memset8(m_pRefLine, 0xff, m_Pitch); |
| 952 m_pLineBuf = FX_Alloc(FX_BYTE, m_Pitch * 8); | 952 m_pLineBuf = FX_Alloc2D(FX_BYTE, m_Pitch, 8); |
| 953 if (m_pLineBuf == NULL) { | |
| 954 return; | |
| 955 } | |
| 956 m_DestBuf.EstimateSize(0, 10240); | 953 m_DestBuf.EstimateSize(0, 10240); |
| 957 } | 954 } |
| 958 CCodec_FaxEncoder::~CCodec_FaxEncoder() | 955 CCodec_FaxEncoder::~CCodec_FaxEncoder() |
| 959 { | 956 { |
| 960 if (m_pRefLine) { | 957 if (m_pRefLine) { |
| 961 FX_Free(m_pRefLine); | 958 FX_Free(m_pRefLine); |
| 962 } | 959 } |
| 963 if (m_pLineBuf) { | 960 if (m_pLineBuf) { |
| 964 FX_Free(m_pLineBuf); | 961 FX_Free(m_pLineBuf); |
| 965 } | 962 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 991 encoder.Encode(dest_buf, dest_size); | 988 encoder.Encode(dest_buf, dest_size); |
| 992 return TRUE; | 989 return TRUE; |
| 993 } | 990 } |
| 994 ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_D
WORD src_size, int width, int height, | 991 ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_D
WORD src_size, int width, int height, |
| 995 int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, in
t Columns, int Rows) | 992 int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, in
t Columns, int Rows) |
| 996 { | 993 { |
| 997 CCodec_FaxDecoder* pDecoder = new CCodec_FaxDecoder; | 994 CCodec_FaxDecoder* pDecoder = new CCodec_FaxDecoder; |
| 998 pDecoder->Create(src_buf, src_size, width, height, K, EndOfLine, EncodedByte
Align, BlackIs1, Columns, Rows); | 995 pDecoder->Create(src_buf, src_size, width, height, K, EndOfLine, EncodedByte
Align, BlackIs1, Columns, Rows); |
| 999 return pDecoder; | 996 return pDecoder; |
| 1000 } | 997 } |
| OLD | NEW |