| OLD | NEW |
| 1 // Copyright 2015 PDFium Authors. All rights reserved. | 1 // Copyright 2015 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 "JBig2_GrdProc.h" | 7 #include "JBig2_GrdProc.h" |
| 8 | 8 |
| 9 #include "../../../../third_party/base/nonstd_unique_ptr.h" | 9 #include "../../../../third_party/base/nonstd_unique_ptr.h" |
| 10 #include "../../../include/fxcodec/fx_codec.h" |
| 10 #include "JBig2_ArithDecoder.h" | 11 #include "JBig2_ArithDecoder.h" |
| 11 #include "JBig2_BitStream.h" | 12 #include "JBig2_BitStream.h" |
| 12 #include "JBig2_Image.h" | 13 #include "JBig2_Image.h" |
| 13 | 14 |
| 14 CJBig2_GRDProc::CJBig2_GRDProc() | 15 CJBig2_GRDProc::CJBig2_GRDProc() |
| 15 : m_loopIndex(0), | 16 : m_loopIndex(0), |
| 16 m_pLine(nullptr), | 17 m_pLine(nullptr), |
| 17 m_pPause(nullptr), | 18 m_pPause(nullptr), |
| 18 m_DecodeType(0), | 19 m_DecodeType(0), |
| 19 LTP(0) { | 20 LTP(0) { |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 IFX_Pause* pPause) { | 662 IFX_Pause* pPause) { |
| 662 int bitpos, i; | 663 int bitpos, i; |
| 663 *pImage = new CJBig2_Image(GBW, GBH); | 664 *pImage = new CJBig2_Image(GBW, GBH); |
| 664 if (!(*pImage)->m_pData) { | 665 if (!(*pImage)->m_pData) { |
| 665 delete (*pImage); | 666 delete (*pImage); |
| 666 (*pImage) = nullptr; | 667 (*pImage) = nullptr; |
| 667 m_ProssiveStatus = FXCODEC_STATUS_ERROR; | 668 m_ProssiveStatus = FXCODEC_STATUS_ERROR; |
| 668 return m_ProssiveStatus; | 669 return m_ProssiveStatus; |
| 669 } | 670 } |
| 670 bitpos = (int)pStream->getBitPos(); | 671 bitpos = (int)pStream->getBitPos(); |
| 671 _FaxG4Decode(pStream->getBuf(), pStream->getLength(), &bitpos, | 672 FaxG4Decode(pStream->getBuf(), pStream->getLength(), &bitpos, |
| 672 (*pImage)->m_pData, GBW, GBH, (*pImage)->m_nStride); | 673 (*pImage)->m_pData, GBW, GBH, (*pImage)->m_nStride); |
| 673 pStream->setBitPos(bitpos); | 674 pStream->setBitPos(bitpos); |
| 674 for (i = 0; (FX_DWORD)i < (*pImage)->m_nStride * GBH; i++) { | 675 for (i = 0; (FX_DWORD)i < (*pImage)->m_nStride * GBH; i++) { |
| 675 (*pImage)->m_pData[i] = ~(*pImage)->m_pData[i]; | 676 (*pImage)->m_pData[i] = ~(*pImage)->m_pData[i]; |
| 676 } | 677 } |
| 677 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; | 678 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; |
| 678 return m_ProssiveStatus; | 679 return m_ProssiveStatus; |
| 679 } | 680 } |
| 680 | 681 |
| 681 FXCODEC_STATUS CJBig2_GRDProc::Continue_decode(IFX_Pause* pPause) { | 682 FXCODEC_STATUS CJBig2_GRDProc::Continue_decode(IFX_Pause* pPause) { |
| 682 if (m_ProssiveStatus != FXCODEC_STATUS_DECODE_TOBECONTINUE) | 683 if (m_ProssiveStatus != FXCODEC_STATUS_DECODE_TOBECONTINUE) |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 } | 1249 } |
| 1249 if (pPause && pPause->NeedToPauseNow()) { | 1250 if (pPause && pPause->NeedToPauseNow()) { |
| 1250 m_loopIndex++; | 1251 m_loopIndex++; |
| 1251 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; | 1252 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; |
| 1252 return FXCODEC_STATUS_DECODE_TOBECONTINUE; | 1253 return FXCODEC_STATUS_DECODE_TOBECONTINUE; |
| 1253 } | 1254 } |
| 1254 } | 1255 } |
| 1255 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; | 1256 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; |
| 1256 return FXCODEC_STATUS_DECODE_FINISH; | 1257 return FXCODEC_STATUS_DECODE_FINISH; |
| 1257 } | 1258 } |
| OLD | NEW |