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/fxcodec/codec/codec_int.h" | 7 #include "core/fxcodec/codec/codec_int.h" |
8 #include "core/fxcodec/include/fx_codec.h" | 8 #include "core/fxcodec/include/fx_codec.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 | 614 |
615 int m_Encoding, m_bEndOfLine, m_bByteAlign, m_bBlack; | 615 int m_Encoding, m_bEndOfLine, m_bByteAlign, m_bBlack; |
616 int bitpos; | 616 int bitpos; |
617 const uint8_t* m_pSrcBuf; | 617 const uint8_t* m_pSrcBuf; |
618 uint32_t m_SrcSize; | 618 uint32_t m_SrcSize; |
619 uint8_t* m_pScanlineBuf; | 619 uint8_t* m_pScanlineBuf; |
620 uint8_t* m_pRefBuf; | 620 uint8_t* m_pRefBuf; |
621 }; | 621 }; |
622 | 622 |
623 CCodec_FaxDecoder::CCodec_FaxDecoder() { | 623 CCodec_FaxDecoder::CCodec_FaxDecoder() { |
624 m_pScanlineBuf = NULL; | 624 m_pScanlineBuf = nullptr; |
625 m_pRefBuf = NULL; | 625 m_pRefBuf = nullptr; |
626 } | 626 } |
627 CCodec_FaxDecoder::~CCodec_FaxDecoder() { | 627 CCodec_FaxDecoder::~CCodec_FaxDecoder() { |
628 FX_Free(m_pScanlineBuf); | 628 FX_Free(m_pScanlineBuf); |
629 FX_Free(m_pRefBuf); | 629 FX_Free(m_pRefBuf); |
630 } | 630 } |
631 FX_BOOL CCodec_FaxDecoder::Create(const uint8_t* src_buf, | 631 FX_BOOL CCodec_FaxDecoder::Create(const uint8_t* src_buf, |
632 uint32_t src_size, | 632 uint32_t src_size, |
633 int width, | 633 int width, |
634 int height, | 634 int height, |
635 int K, | 635 int K, |
(...skipping 28 matching lines...) Expand all Loading... |
664 } | 664 } |
665 FX_BOOL CCodec_FaxDecoder::v_Rewind() { | 665 FX_BOOL CCodec_FaxDecoder::v_Rewind() { |
666 FXSYS_memset(m_pRefBuf, 0xff, m_Pitch); | 666 FXSYS_memset(m_pRefBuf, 0xff, m_Pitch); |
667 bitpos = 0; | 667 bitpos = 0; |
668 return TRUE; | 668 return TRUE; |
669 } | 669 } |
670 uint8_t* CCodec_FaxDecoder::v_GetNextLine() { | 670 uint8_t* CCodec_FaxDecoder::v_GetNextLine() { |
671 int bitsize = m_SrcSize * 8; | 671 int bitsize = m_SrcSize * 8; |
672 FaxSkipEOL(m_pSrcBuf, bitsize, bitpos); | 672 FaxSkipEOL(m_pSrcBuf, bitsize, bitpos); |
673 if (bitpos >= bitsize) { | 673 if (bitpos >= bitsize) { |
674 return NULL; | 674 return nullptr; |
675 } | 675 } |
676 FXSYS_memset(m_pScanlineBuf, 0xff, m_Pitch); | 676 FXSYS_memset(m_pScanlineBuf, 0xff, m_Pitch); |
677 if (m_Encoding < 0) { | 677 if (m_Encoding < 0) { |
678 FaxG4GetRow(m_pSrcBuf, bitsize, bitpos, m_pScanlineBuf, m_pRefBuf, | 678 FaxG4GetRow(m_pSrcBuf, bitsize, bitpos, m_pScanlineBuf, m_pRefBuf, |
679 m_OrigWidth); | 679 m_OrigWidth); |
680 FXSYS_memcpy(m_pRefBuf, m_pScanlineBuf, m_Pitch); | 680 FXSYS_memcpy(m_pRefBuf, m_pScanlineBuf, m_Pitch); |
681 } else if (m_Encoding == 0) { | 681 } else if (m_Encoding == 0) { |
682 FaxGet1DLine(m_pSrcBuf, bitsize, bitpos, m_pScanlineBuf, m_OrigWidth); | 682 FaxGet1DLine(m_pSrcBuf, bitsize, bitpos, m_pScanlineBuf, m_OrigWidth); |
683 } else { | 683 } else { |
684 FX_BOOL bNext1D = m_pSrcBuf[bitpos / 8] & (1 << (7 - bitpos % 8)); | 684 FX_BOOL bNext1D = m_pSrcBuf[bitpos / 8] & (1 << (7 - bitpos % 8)); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 FX_BOOL EndOfLine, | 814 FX_BOOL EndOfLine, |
815 FX_BOOL EncodedByteAlign, | 815 FX_BOOL EncodedByteAlign, |
816 FX_BOOL BlackIs1, | 816 FX_BOOL BlackIs1, |
817 int Columns, | 817 int Columns, |
818 int Rows) { | 818 int Rows) { |
819 CCodec_FaxDecoder* pDecoder = new CCodec_FaxDecoder; | 819 CCodec_FaxDecoder* pDecoder = new CCodec_FaxDecoder; |
820 pDecoder->Create(src_buf, src_size, width, height, K, EndOfLine, | 820 pDecoder->Create(src_buf, src_size, width, height, K, EndOfLine, |
821 EncodedByteAlign, BlackIs1, Columns, Rows); | 821 EncodedByteAlign, BlackIs1, Columns, Rows); |
822 return pDecoder; | 822 return pDecoder; |
823 } | 823 } |
OLD | NEW |