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 "core/fxcodec/codec/ccodec_jbig2module.h" | 7 #include "core/fxcodec/codec/ccodec_jbig2module.h" |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 | 10 |
11 #include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" | 11 #include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" |
12 #include "core/fxcodec/JBig2_DocumentContext.h" | 12 #include "core/fxcodec/JBig2_DocumentContext.h" |
13 #include "core/fxcodec/jbig2/JBig2_Context.h" | 13 #include "core/fxcodec/jbig2/JBig2_Context.h" |
14 #include "core/fxcodec/jbig2/JBig2_Image.h" | 14 #include "core/fxcodec/jbig2/JBig2_Image.h" |
15 #include "core/fxcrt/include/fx_memory.h" | 15 #include "core/fxcrt/fx_memory.h" |
16 | 16 |
17 JBig2_DocumentContext::JBig2_DocumentContext() {} | 17 JBig2_DocumentContext::JBig2_DocumentContext() {} |
18 | 18 |
19 JBig2_DocumentContext::~JBig2_DocumentContext() {} | 19 JBig2_DocumentContext::~JBig2_DocumentContext() {} |
20 | 20 |
21 JBig2_DocumentContext* GetJBig2DocumentContext( | 21 JBig2_DocumentContext* GetJBig2DocumentContext( |
22 std::unique_ptr<JBig2_DocumentContext>* pContextHolder) { | 22 std::unique_ptr<JBig2_DocumentContext>* pContextHolder) { |
23 if (!pContextHolder->get()) | 23 if (!pContextHolder->get()) |
24 pContextHolder->reset(new JBig2_DocumentContext()); | 24 pContextHolder->reset(new JBig2_DocumentContext()); |
25 return pContextHolder->get(); | 25 return pContextHolder->get(); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 pJbig2Context->m_pContext.reset(); | 95 pJbig2Context->m_pContext.reset(); |
96 if (ret != JBIG2_SUCCESS) | 96 if (ret != JBIG2_SUCCESS) |
97 return FXCODEC_STATUS_ERROR; | 97 return FXCODEC_STATUS_ERROR; |
98 | 98 |
99 int dword_size = pJbig2Context->m_height * pJbig2Context->m_dest_pitch / 4; | 99 int dword_size = pJbig2Context->m_height * pJbig2Context->m_dest_pitch / 4; |
100 uint32_t* dword_buf = (uint32_t*)pJbig2Context->m_dest_buf; | 100 uint32_t* dword_buf = (uint32_t*)pJbig2Context->m_dest_buf; |
101 for (int i = 0; i < dword_size; i++) | 101 for (int i = 0; i < dword_size; i++) |
102 dword_buf[i] = ~dword_buf[i]; | 102 dword_buf[i] = ~dword_buf[i]; |
103 return FXCODEC_STATUS_DECODE_FINISH; | 103 return FXCODEC_STATUS_DECODE_FINISH; |
104 } | 104 } |
OLD | NEW |