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 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 } | 919 } |
920 _FaxEncodeRun(dest_buf, dest_bitpos, a1 - a0, a0color); | 920 _FaxEncodeRun(dest_buf, dest_bitpos, a1 - a0, a0color); |
921 _FaxEncodeRun(dest_buf, dest_bitpos, a2 - a1, 1 - a0color); | 921 _FaxEncodeRun(dest_buf, dest_bitpos, a2 - a1, 1 - a0color); |
922 a0 = a2; | 922 a0 = a2; |
923 } | 923 } |
924 if (a0 >= cols) { | 924 if (a0 >= cols) { |
925 return; | 925 return; |
926 } | 926 } |
927 } | 927 } |
928 } | 928 } |
929 class CCodec_FaxEncoder : public CFX_Object | 929 class CCodec_FaxEncoder |
930 { | 930 { |
931 public: | 931 public: |
932 CCodec_FaxEncoder(FX_LPCBYTE src_buf, int width, int height, int pitch); | 932 CCodec_FaxEncoder(FX_LPCBYTE src_buf, int width, int height, int pitch); |
933 ~CCodec_FaxEncoder(); | 933 ~CCodec_FaxEncoder(); |
934 void Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
; | 934 void Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
; |
935 void Encode2DLine(FX_LPCBYTE scan_line); | 935 void Encode2DLine(FX_LPCBYTE scan_line); |
936 CFX_BinaryBuf m_DestBuf; | 936 CFX_BinaryBuf m_DestBuf; |
937 FX_LPBYTE m_pRefLine, m_pLineBuf; | 937 FX_LPBYTE m_pRefLine, m_pLineBuf; |
938 int m_Cols, m_Rows, m_Pitch; | 938 int m_Cols, m_Rows, m_Pitch; |
939 FX_LPCBYTE m_pSrcBuf; | 939 FX_LPCBYTE m_pSrcBuf; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_D
WORD src_size, int width, int height, | 994 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) | 995 int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, in
t Columns, int Rows) |
996 { | 996 { |
997 CCodec_FaxDecoder* pDecoder = FX_NEW CCodec_FaxDecoder; | 997 CCodec_FaxDecoder* pDecoder = FX_NEW CCodec_FaxDecoder; |
998 if (pDecoder == NULL) { | 998 if (pDecoder == NULL) { |
999 return NULL; | 999 return NULL; |
1000 } | 1000 } |
1001 pDecoder->Create(src_buf, src_size, width, height, K, EndOfLine, EncodedByte
Align, BlackIs1, Columns, Rows); | 1001 pDecoder->Create(src_buf, src_size, width, height, K, EndOfLine, EncodedByte
Align, BlackIs1, Columns, Rows); |
1002 return pDecoder; | 1002 return pDecoder; |
1003 } | 1003 } |
OLD | NEW |