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 "core/include/fxcodec/fx_codec.h" | 7 #include "core/include/fxcodec/fx_codec.h" |
8 #include "core/src/fxcodec/codec/codec_int.h" | 8 #include "core/src/fxcodec/codec/codec_int.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 m_pLineBuf[0] = last_byte; | 792 m_pLineBuf[0] = last_byte; |
793 FaxEncode2DLine(m_pLineBuf, dest_bitpos, scan_line, m_pRefLine, m_Cols); | 793 FaxEncode2DLine(m_pLineBuf, dest_bitpos, scan_line, m_pRefLine, m_Cols); |
794 m_DestBuf.AppendBlock(m_pLineBuf, dest_bitpos / 8); | 794 m_DestBuf.AppendBlock(m_pLineBuf, dest_bitpos / 8); |
795 last_byte = m_pLineBuf[dest_bitpos / 8]; | 795 last_byte = m_pLineBuf[dest_bitpos / 8]; |
796 dest_bitpos %= 8; | 796 dest_bitpos %= 8; |
797 FXSYS_memcpy(m_pRefLine, scan_line, m_Pitch); | 797 FXSYS_memcpy(m_pRefLine, scan_line, m_Pitch); |
798 } | 798 } |
799 if (dest_bitpos) { | 799 if (dest_bitpos) { |
800 m_DestBuf.AppendByte(last_byte); | 800 m_DestBuf.AppendByte(last_byte); |
801 } | 801 } |
802 dest_buf = m_DestBuf.GetBuffer(); | |
803 dest_size = m_DestBuf.GetSize(); | 802 dest_size = m_DestBuf.GetSize(); |
804 m_DestBuf.DetachBuffer(); | 803 dest_buf = m_DestBuf.DetachBuffer(); |
805 } | 804 } |
806 FX_BOOL CCodec_FaxModule::Encode(const uint8_t* src_buf, | 805 FX_BOOL CCodec_FaxModule::Encode(const uint8_t* src_buf, |
807 int width, | 806 int width, |
808 int height, | 807 int height, |
809 int pitch, | 808 int pitch, |
810 uint8_t*& dest_buf, | 809 uint8_t*& dest_buf, |
811 FX_DWORD& dest_size) { | 810 FX_DWORD& dest_size) { |
812 CCodec_FaxEncoder encoder(src_buf, width, height, pitch); | 811 CCodec_FaxEncoder encoder(src_buf, width, height, pitch); |
813 encoder.Encode(dest_buf, dest_size); | 812 encoder.Encode(dest_buf, dest_size); |
814 return TRUE; | 813 return TRUE; |
815 } | 814 } |
816 ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder( | 815 ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder( |
817 const uint8_t* src_buf, | 816 const uint8_t* src_buf, |
818 FX_DWORD src_size, | 817 FX_DWORD src_size, |
819 int width, | 818 int width, |
820 int height, | 819 int height, |
821 int K, | 820 int K, |
822 FX_BOOL EndOfLine, | 821 FX_BOOL EndOfLine, |
823 FX_BOOL EncodedByteAlign, | 822 FX_BOOL EncodedByteAlign, |
824 FX_BOOL BlackIs1, | 823 FX_BOOL BlackIs1, |
825 int Columns, | 824 int Columns, |
826 int Rows) { | 825 int Rows) { |
827 CCodec_FaxDecoder* pDecoder = new CCodec_FaxDecoder; | 826 CCodec_FaxDecoder* pDecoder = new CCodec_FaxDecoder; |
828 pDecoder->Create(src_buf, src_size, width, height, K, EndOfLine, | 827 pDecoder->Create(src_buf, src_size, width, height, K, EndOfLine, |
829 EncodedByteAlign, BlackIs1, Columns, Rows); | 828 EncodedByteAlign, BlackIs1, Columns, Rows); |
830 return pDecoder; | 829 return pDecoder; |
831 } | 830 } |
OLD | NEW |