| 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 CCodec_ModuleMgr::CCodec_ModuleMgr() | 9 CCodec_ModuleMgr::CCodec_ModuleMgr() |
| 10 { | 10 { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 dest_height = -dest_height; | 116 dest_height = -dest_height; |
| 117 } | 117 } |
| 118 v_DownScale(dest_width, dest_height); | 118 v_DownScale(dest_width, dest_height); |
| 119 if (m_pDataCache) { | 119 if (m_pDataCache) { |
| 120 if (m_pDataCache->m_Height == m_OutputHeight && m_pDataCache->m_Width ==
m_OutputWidth) { | 120 if (m_pDataCache->m_Height == m_OutputHeight && m_pDataCache->m_Width ==
m_OutputWidth) { |
| 121 return; | 121 return; |
| 122 } | 122 } |
| 123 FX_Free(m_pDataCache); | 123 FX_Free(m_pDataCache); |
| 124 m_pDataCache = NULL; | 124 m_pDataCache = NULL; |
| 125 } | 125 } |
| 126 m_pDataCache = (CCodec_ImageDataCache*)FX_AllocNL(FX_BYTE, sizeof(CCodec_Ima
geDataCache) + m_Pitch * m_OutputHeight); | 126 m_pDataCache = (CCodec_ImageDataCache*)FX_TryAlloc(FX_BYTE, sizeof(CCodec_Im
ageDataCache) + m_Pitch * m_OutputHeight); |
| 127 if (m_pDataCache == NULL) { | 127 if (m_pDataCache == NULL) { |
| 128 return; | 128 return; |
| 129 } | 129 } |
| 130 m_pDataCache->m_Height = m_OutputHeight; | 130 m_pDataCache->m_Height = m_OutputHeight; |
| 131 m_pDataCache->m_Width = m_OutputWidth; | 131 m_pDataCache->m_Width = m_OutputWidth; |
| 132 m_pDataCache->m_nCachedLines = 0; | 132 m_pDataCache->m_nCachedLines = 0; |
| 133 } | 133 } |
| 134 FX_BOOL CCodec_BasicModule::RunLengthEncode(const FX_BYTE* src_buf, FX_DWORD src
_size, FX_LPBYTE& dest_buf, | 134 FX_BOOL CCodec_BasicModule::RunLengthEncode(const FX_BYTE* src_buf, FX_DWORD src
_size, FX_LPBYTE& dest_buf, |
| 135 FX_DWORD& dest_size) | 135 FX_DWORD& dest_size) |
| 136 { | 136 { |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(FX_LPCBYTE sr
c_buf, FX_DWORD src_size, int width, int height, | 774 ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(FX_LPCBYTE sr
c_buf, FX_DWORD src_size, int width, int height, |
| 775 int nComps, int bpc) | 775 int nComps, int bpc) |
| 776 { | 776 { |
| 777 CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder; | 777 CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder; |
| 778 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, bp
c)) { | 778 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, bp
c)) { |
| 779 delete pRLScanlineDecoder; | 779 delete pRLScanlineDecoder; |
| 780 return NULL; | 780 return NULL; |
| 781 } | 781 } |
| 782 return pRLScanlineDecoder; | 782 return pRLScanlineDecoder; |
| 783 } | 783 } |
| OLD | NEW |