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 | 9 |
10 CCodec_Jbig2Context::CCodec_Jbig2Context() { | 10 CCodec_Jbig2Context::CCodec_Jbig2Context() { |
(...skipping 30 matching lines...) Expand all Loading... |
41 m_pJbig2Context->m_src_buf = (unsigned char*)src_buf; | 41 m_pJbig2Context->m_src_buf = (unsigned char*)src_buf; |
42 m_pJbig2Context->m_src_size = src_size; | 42 m_pJbig2Context->m_src_size = src_size; |
43 m_pJbig2Context->m_global_data = global_data; | 43 m_pJbig2Context->m_global_data = global_data; |
44 m_pJbig2Context->m_global_size = global_size; | 44 m_pJbig2Context->m_global_size = global_size; |
45 m_pJbig2Context->m_dest_buf = dest_buf; | 45 m_pJbig2Context->m_dest_buf = dest_buf; |
46 m_pJbig2Context->m_dest_pitch = dest_pitch; | 46 m_pJbig2Context->m_dest_pitch = dest_pitch; |
47 m_pJbig2Context->m_pPause = pPause; | 47 m_pJbig2Context->m_pPause = pPause; |
48 m_pJbig2Context->m_bFileReader = FALSE; | 48 m_pJbig2Context->m_bFileReader = FALSE; |
49 FXSYS_memset(dest_buf, 0, height * dest_pitch); | 49 FXSYS_memset(dest_buf, 0, height * dest_pitch); |
50 m_pJbig2Context->m_pContext = CJBig2_Context::CreateContext( | 50 m_pJbig2Context->m_pContext = CJBig2_Context::CreateContext( |
51 &m_Module, (uint8_t*)global_data, global_size, (uint8_t*)src_buf, | 51 (uint8_t*)global_data, global_size, (uint8_t*)src_buf, src_size, |
52 src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache, pPause); | 52 JBIG2_EMBED_STREAM, &m_SymbolDictCache, pPause); |
53 if (!m_pJbig2Context->m_pContext) { | 53 if (!m_pJbig2Context->m_pContext) { |
54 return FXCODEC_STATUS_ERROR; | 54 return FXCODEC_STATUS_ERROR; |
55 } | 55 } |
56 int ret = m_pJbig2Context->m_pContext->getFirstPage(dest_buf, width, height, | 56 int ret = m_pJbig2Context->m_pContext->getFirstPage(dest_buf, width, height, |
57 dest_pitch, pPause); | 57 dest_pitch, pPause); |
58 if (m_pJbig2Context->m_pContext->GetProcessiveStatus() == | 58 if (m_pJbig2Context->m_pContext->GetProcessiveStatus() == |
59 FXCODEC_STATUS_DECODE_FINISH) { | 59 FXCODEC_STATUS_DECODE_FINISH) { |
60 CJBig2_Context::DestroyContext(m_pJbig2Context->m_pContext); | 60 CJBig2_Context::DestroyContext(m_pJbig2Context->m_pContext); |
61 m_pJbig2Context->m_pContext = NULL; | 61 m_pJbig2Context->m_pContext = NULL; |
62 if (ret != JBIG2_SUCCESS) { | 62 if (ret != JBIG2_SUCCESS) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 return FXCODEC_STATUS_ERROR; | 97 return FXCODEC_STATUS_ERROR; |
98 } | 98 } |
99 int dword_size = | 99 int dword_size = |
100 m_pJbig2Context->m_height * m_pJbig2Context->m_dest_pitch / 4; | 100 m_pJbig2Context->m_height * m_pJbig2Context->m_dest_pitch / 4; |
101 FX_DWORD* dword_buf = (FX_DWORD*)m_pJbig2Context->m_dest_buf; | 101 FX_DWORD* dword_buf = (FX_DWORD*)m_pJbig2Context->m_dest_buf; |
102 for (int i = 0; i < dword_size; i++) { | 102 for (int i = 0; i < dword_size; i++) { |
103 dword_buf[i] = ~dword_buf[i]; | 103 dword_buf[i] = ~dword_buf[i]; |
104 } | 104 } |
105 return FXCODEC_STATUS_DECODE_FINISH; | 105 return FXCODEC_STATUS_DECODE_FINISH; |
106 } | 106 } |
OLD | NEW |