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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 m_pJbig2Context->m_src_buf = (unsigned char*)src_buf; | 47 m_pJbig2Context->m_src_buf = (unsigned char*)src_buf; |
48 m_pJbig2Context->m_src_size = src_size; | 48 m_pJbig2Context->m_src_size = src_size; |
49 m_pJbig2Context->m_global_data = global_data; | 49 m_pJbig2Context->m_global_data = global_data; |
50 m_pJbig2Context->m_global_size = global_size; | 50 m_pJbig2Context->m_global_size = global_size; |
51 m_pJbig2Context->m_dest_buf = dest_buf; | 51 m_pJbig2Context->m_dest_buf = dest_buf; |
52 m_pJbig2Context->m_dest_pitch = dest_pitch; | 52 m_pJbig2Context->m_dest_pitch = dest_pitch; |
53 m_pJbig2Context->m_pPause = pPause; | 53 m_pJbig2Context->m_pPause = pPause; |
54 m_pJbig2Context->m_bFileReader = FALSE; | 54 m_pJbig2Context->m_bFileReader = FALSE; |
55 FXSYS_memset(dest_buf, 0, height * dest_pitch); | 55 FXSYS_memset(dest_buf, 0, height * dest_pitch); |
56 m_pJbig2Context->m_pContext = CJBig2_Context::CreateContext( | 56 m_pJbig2Context->m_pContext = CJBig2_Context::CreateContext( |
57 global_data, global_size, src_buf, src_size, JBIG2_EMBED_STREAM, | 57 global_data, global_size, src_buf, src_size, &m_SymbolDictCache, pPause); |
58 &m_SymbolDictCache, pPause); | |
59 if (!m_pJbig2Context->m_pContext) { | 58 if (!m_pJbig2Context->m_pContext) { |
60 return FXCODEC_STATUS_ERROR; | 59 return FXCODEC_STATUS_ERROR; |
61 } | 60 } |
62 int ret = m_pJbig2Context->m_pContext->getFirstPage(dest_buf, width, height, | 61 int ret = m_pJbig2Context->m_pContext->getFirstPage(dest_buf, width, height, |
63 dest_pitch, pPause); | 62 dest_pitch, pPause); |
64 if (m_pJbig2Context->m_pContext->GetProcessingStatus() == | 63 if (m_pJbig2Context->m_pContext->GetProcessingStatus() == |
65 FXCODEC_STATUS_DECODE_FINISH) { | 64 FXCODEC_STATUS_DECODE_FINISH) { |
66 CJBig2_Context::DestroyContext(m_pJbig2Context->m_pContext); | 65 CJBig2_Context::DestroyContext(m_pJbig2Context->m_pContext); |
67 m_pJbig2Context->m_pContext = NULL; | 66 m_pJbig2Context->m_pContext = NULL; |
68 if (ret != JBIG2_SUCCESS) { | 67 if (ret != JBIG2_SUCCESS) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 return FXCODEC_STATUS_ERROR; | 102 return FXCODEC_STATUS_ERROR; |
104 } | 103 } |
105 int dword_size = | 104 int dword_size = |
106 m_pJbig2Context->m_height * m_pJbig2Context->m_dest_pitch / 4; | 105 m_pJbig2Context->m_height * m_pJbig2Context->m_dest_pitch / 4; |
107 FX_DWORD* dword_buf = (FX_DWORD*)m_pJbig2Context->m_dest_buf; | 106 FX_DWORD* dword_buf = (FX_DWORD*)m_pJbig2Context->m_dest_buf; |
108 for (int i = 0; i < dword_size; i++) { | 107 for (int i = 0; i < dword_size; i++) { |
109 dword_buf[i] = ~dword_buf[i]; | 108 dword_buf[i] = ~dword_buf[i]; |
110 } | 109 } |
111 return FXCODEC_STATUS_DECODE_FINISH; | 110 return FXCODEC_STATUS_DECODE_FINISH; |
112 } | 111 } |
OLD | NEW |