Chromium Code Reviews| 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 <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "core/fxcodec/codec/codec_int.h" | 9 #include "core/fxcodec/codec/codec_int.h" |
| 10 #include "core/fxcodec/include/fx_codec.h" | 10 #include "core/fxcodec/include/fx_codec.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 uint8_t* m_dest_buf; | 23 uint8_t* m_dest_buf; |
| 24 uint32_t m_dest_pitch; | 24 uint32_t m_dest_pitch; |
| 25 IFX_Pause* m_pPause; | 25 IFX_Pause* m_pPause; |
| 26 CJBig2_Context* m_pContext; | 26 CJBig2_Context* m_pContext; |
| 27 CJBig2_Image* m_dest_image; | 27 CJBig2_Image* m_dest_image; |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 // Holds per-document JBig2 related data. | 32 // Holds per-document JBig2 related data. |
| 33 class JBig2DocumentContext : public CFX_DestructObject { | 33 class JBig2DocumentContext : public CFX_Deletable { |
| 34 public: | 34 public: |
| 35 std::list<CJBig2_CachePair>* GetSymbolDictCache() { | 35 std::list<CJBig2_CachePair>* GetSymbolDictCache() { |
| 36 return &m_SymbolDictCache; | 36 return &m_SymbolDictCache; |
| 37 } | 37 } |
| 38 | 38 |
| 39 ~JBig2DocumentContext() override { | 39 ~JBig2DocumentContext() override { |
| 40 for (auto it : m_SymbolDictCache) { | 40 for (auto it : m_SymbolDictCache) { |
| 41 delete it.second; | 41 delete it.second; |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 std::list<CJBig2_CachePair> m_SymbolDictCache; | 46 std::list<CJBig2_CachePair> m_SymbolDictCache; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 JBig2DocumentContext* GetJBig2DocumentContext(CCodec_Jbig2Module* pModule, | 49 JBig2DocumentContext* GetJBig2DocumentContext(CCodec_Jbig2Module* pModule, |
| 50 CFX_PrivateData* pPrivateData) { | 50 CFX_PrivateData* pPrivateData) { |
| 51 void* pModulePrivateData = pPrivateData->GetPrivateData(pModule); | 51 void* pModulePrivateData = pPrivateData->GetPrivateData(pModule); |
| 52 if (pModulePrivateData) { | 52 if (pModulePrivateData) { |
| 53 CFX_DestructObject* pDestructObject = | 53 CFX_Deletable* pDestructObject = |
|
Lei Zhang
2016/05/24 21:34:58
pDeletableObject
Tom Sepez
2016/05/24 21:56:55
Done.
| |
| 54 reinterpret_cast<CFX_DestructObject*>(pModulePrivateData); | 54 reinterpret_cast<CFX_Deletable*>(pModulePrivateData); |
| 55 return static_cast<JBig2DocumentContext*>(pDestructObject); | 55 return static_cast<JBig2DocumentContext*>(pDestructObject); |
| 56 } | 56 } |
| 57 JBig2DocumentContext* pJBig2DocumentContext = new JBig2DocumentContext(); | 57 JBig2DocumentContext* pJBig2DocumentContext = new JBig2DocumentContext(); |
| 58 pPrivateData->SetPrivateObj(pModule, pJBig2DocumentContext); | 58 pPrivateData->SetPrivateObj(pModule, pJBig2DocumentContext); |
| 59 return pJBig2DocumentContext; | 59 return pJBig2DocumentContext; |
| 60 } | 60 } |
| 61 | 61 |
| 62 CCodec_Jbig2Context::CCodec_Jbig2Context() { | 62 CCodec_Jbig2Context::CCodec_Jbig2Context() { |
| 63 FXSYS_memset(this, 0, sizeof(CCodec_Jbig2Context)); | 63 FXSYS_memset(this, 0, sizeof(CCodec_Jbig2Context)); |
| 64 } | 64 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 return FXCODEC_STATUS_ERROR; | 137 return FXCODEC_STATUS_ERROR; |
| 138 } | 138 } |
| 139 int dword_size = | 139 int dword_size = |
| 140 m_pJbig2Context->m_height * m_pJbig2Context->m_dest_pitch / 4; | 140 m_pJbig2Context->m_height * m_pJbig2Context->m_dest_pitch / 4; |
| 141 uint32_t* dword_buf = (uint32_t*)m_pJbig2Context->m_dest_buf; | 141 uint32_t* dword_buf = (uint32_t*)m_pJbig2Context->m_dest_buf; |
| 142 for (int i = 0; i < dword_size; i++) { | 142 for (int i = 0; i < dword_size; i++) { |
| 143 dword_buf[i] = ~dword_buf[i]; | 143 dword_buf[i] = ~dword_buf[i]; |
| 144 } | 144 } |
| 145 return FXCODEC_STATUS_DECODE_FINISH; | 145 return FXCODEC_STATUS_DECODE_FINISH; |
| 146 } | 146 } |
| OLD | NEW |