| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "../../../include/fxcodec/fx_codec.h" | 10 #include "../../../include/fxcodec/fx_codec.h" |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 return FALSE; | 794 return FALSE; |
| 795 } | 795 } |
| 796 void initialize_transition_table(); | 796 void initialize_transition_table(); |
| 797 void initialize_significance_luts(); | 797 void initialize_significance_luts(); |
| 798 void initialize_sign_lut(); | 798 void initialize_sign_lut(); |
| 799 CCodec_JpxModule::CCodec_JpxModule() | 799 CCodec_JpxModule::CCodec_JpxModule() |
| 800 { | 800 { |
| 801 } | 801 } |
| 802 void* CCodec_JpxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size , FX
_BOOL useColorSpace) | 802 void* CCodec_JpxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size , FX
_BOOL useColorSpace) |
| 803 { | 803 { |
| 804 CJPX_Decoder* pDecoder = FX_NEW CJPX_Decoder; | 804 CJPX_Decoder* pDecoder = new CJPX_Decoder; |
| 805 if (pDecoder == NULL) { | |
| 806 return NULL; | |
| 807 } | |
| 808 pDecoder->m_useColorSpace = useColorSpace; | 805 pDecoder->m_useColorSpace = useColorSpace; |
| 809 if (!pDecoder->Init(src_buf, src_size)) { | 806 if (!pDecoder->Init(src_buf, src_size)) { |
| 810 delete pDecoder; | 807 delete pDecoder; |
| 811 return NULL; | 808 return NULL; |
| 812 } | 809 } |
| 813 return pDecoder; | 810 return pDecoder; |
| 814 } | 811 } |
| 815 void CCodec_JpxModule::GetImageInfo(FX_LPVOID ctx, FX_DWORD& width, FX_DWORD& he
ight, | 812 void CCodec_JpxModule::GetImageInfo(FX_LPVOID ctx, FX_DWORD& width, FX_DWORD& he
ight, |
| 816 FX_DWORD& codestream_nComps, FX_DWORD& outpu
t_nComps) | 813 FX_DWORD& codestream_nComps, FX_DWORD& outpu
t_nComps) |
| 817 { | 814 { |
| 818 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; | 815 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; |
| 819 pDecoder->GetInfo(width, height, codestream_nComps, output_nComps); | 816 pDecoder->GetInfo(width, height, codestream_nComps, output_nComps); |
| 820 } | 817 } |
| 821 FX_BOOL CCodec_JpxModule::Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_B
OOL bTranslateColor, FX_LPBYTE offsets) | 818 FX_BOOL CCodec_JpxModule::Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_B
OOL bTranslateColor, FX_LPBYTE offsets) |
| 822 { | 819 { |
| 823 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; | 820 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; |
| 824 return pDecoder->Decode(dest_data, pitch, bTranslateColor, offsets); | 821 return pDecoder->Decode(dest_data, pitch, bTranslateColor, offsets); |
| 825 } | 822 } |
| 826 void CCodec_JpxModule::DestroyDecoder(void* ctx) | 823 void CCodec_JpxModule::DestroyDecoder(void* ctx) |
| 827 { | 824 { |
| 828 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; | 825 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; |
| 829 delete pDecoder; | 826 delete pDecoder; |
| 830 } | 827 } |
| OLD | NEW |