| 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 #ifndef CORE_FXCODEC_CODEC_INCLUDE_CCODEC_PROGRESSIVEDECODER_H_ | 7 #ifndef CORE_FXCODEC_CODEC_INCLUDE_CCODEC_PROGRESSIVEDECODER_H_ |
| 8 #define CORE_FXCODEC_CODEC_INCLUDE_CCODEC_PROGRESSIVEDECODER_H_ | 8 #define CORE_FXCODEC_CODEC_INCLUDE_CCODEC_PROGRESSIVEDECODER_H_ |
| 9 | 9 |
| 10 #include <vector> |
| 11 |
| 10 #include "core/fxcodec/include/fx_codec_def.h" | 12 #include "core/fxcodec/include/fx_codec_def.h" |
| 11 #include "core/fxcrt/include/fx_system.h" | 13 #include "core/fxcrt/include/fx_system.h" |
| 12 #include "core/fxge/include/fx_dib.h" | 14 #include "core/fxge/include/fx_dib.h" |
| 13 | 15 |
| 14 class CCodec_BmpModule; | 16 class CCodec_BmpModule; |
| 15 class CCodec_GifContext; | 17 class CCodec_GifContext; |
| 16 class CCodec_GifModule; | 18 class CCodec_GifModule; |
| 17 class CCodec_JpegModule; | 19 class CCodec_JpegModule; |
| 18 class CCodec_ModuleMgr; | 20 class CCodec_ModuleMgr; |
| 19 class CCodec_PngContext; | 21 class CCodec_PngContext; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 33 FXCodec_1bppGray = 0x101, | 35 FXCodec_1bppGray = 0x101, |
| 34 FXCodec_1bppRgb = 0x001, | 36 FXCodec_1bppRgb = 0x001, |
| 35 FXCodec_8bppGray = 0x108, | 37 FXCodec_8bppGray = 0x108, |
| 36 FXCodec_8bppRgb = 0x008, | 38 FXCodec_8bppRgb = 0x008, |
| 37 FXCodec_Rgb = 0x018, | 39 FXCodec_Rgb = 0x018, |
| 38 FXCodec_Rgb32 = 0x020, | 40 FXCodec_Rgb32 = 0x020, |
| 39 FXCodec_Argb = 0x220, | 41 FXCodec_Argb = 0x220, |
| 40 FXCodec_Cmyk = 0x120 | 42 FXCodec_Cmyk = 0x120 |
| 41 }; | 43 }; |
| 42 | 44 |
| 43 CCodec_ProgressiveDecoder(CCodec_ModuleMgr* pCodecMgr); | 45 explicit CCodec_ProgressiveDecoder(CCodec_ModuleMgr* pCodecMgr); |
| 44 ~CCodec_ProgressiveDecoder(); | 46 ~CCodec_ProgressiveDecoder(); |
| 45 | 47 |
| 46 FXCODEC_STATUS LoadImageInfo(IFX_FileRead* pFile, | 48 FXCODEC_STATUS LoadImageInfo(IFX_FileRead* pFile, |
| 47 FXCODEC_IMAGE_TYPE imageType, | 49 FXCODEC_IMAGE_TYPE imageType, |
| 48 CFX_DIBAttribute* pAttribute); | 50 CFX_DIBAttribute* pAttribute); |
| 49 | 51 |
| 50 FXCODEC_IMAGE_TYPE GetType() const { return m_imagType; } | 52 FXCODEC_IMAGE_TYPE GetType() const { return m_imagType; } |
| 51 int32_t GetWidth() const { return m_SrcWidth; } | 53 int32_t GetWidth() const { return m_SrcWidth; } |
| 52 int32_t GetHeight() const { return m_SrcHeight; } | 54 int32_t GetHeight() const { return m_SrcHeight; } |
| 53 int32_t GetNumComponents() const { return m_SrcComponents; } | 55 int32_t GetNumComponents() const { return m_SrcComponents; } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 66 FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause = nullptr); | 68 FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause = nullptr); |
| 67 | 69 |
| 68 struct PixelWeight { | 70 struct PixelWeight { |
| 69 int m_SrcStart; | 71 int m_SrcStart; |
| 70 int m_SrcEnd; | 72 int m_SrcEnd; |
| 71 int m_Weights[1]; | 73 int m_Weights[1]; |
| 72 }; | 74 }; |
| 73 | 75 |
| 74 class CFXCODEC_WeightTable { | 76 class CFXCODEC_WeightTable { |
| 75 public: | 77 public: |
| 76 CFXCODEC_WeightTable() { m_pWeightTables = nullptr; } | 78 CFXCODEC_WeightTable() {} |
| 77 ~CFXCODEC_WeightTable() { FX_Free(m_pWeightTables); } | 79 ~CFXCODEC_WeightTable() {} |
| 78 | 80 |
| 79 void Calc(int dest_len, | 81 void Calc(int dest_len, |
| 80 int dest_min, | 82 int dest_min, |
| 81 int dest_max, | 83 int dest_max, |
| 82 int src_len, | 84 int src_len, |
| 83 int src_min, | 85 int src_min, |
| 84 int src_max, | 86 int src_max, |
| 85 FX_BOOL bInterpol); | 87 FX_BOOL bInterpol); |
| 86 PixelWeight* GetPixelWeight(int pixel) { | 88 PixelWeight* GetPixelWeight(int pixel) { |
| 87 return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize); | 89 return reinterpret_cast<PixelWeight*>(m_pWeightTables.data() + |
| 90 (pixel - m_DestMin) * m_ItemSize); |
| 88 } | 91 } |
| 89 | 92 |
| 90 int m_DestMin, m_ItemSize; | 93 int m_DestMin; |
| 91 uint8_t* m_pWeightTables; | 94 int m_ItemSize; |
| 95 std::vector<uint8_t> m_pWeightTables; |
| 92 }; | 96 }; |
| 93 | 97 |
| 94 class CFXCODEC_HorzTable { | 98 class CFXCODEC_HorzTable { |
| 95 public: | 99 public: |
| 96 CFXCODEC_HorzTable() { m_pWeightTables = nullptr; } | 100 CFXCODEC_HorzTable() {} |
| 97 ~CFXCODEC_HorzTable() { FX_Free(m_pWeightTables); } | 101 ~CFXCODEC_HorzTable() {} |
| 98 | 102 |
| 99 void Calc(int dest_len, int src_len, FX_BOOL bInterpol); | 103 void Calc(int dest_len, int src_len, FX_BOOL bInterpol); |
| 100 PixelWeight* GetPixelWeight(int pixel) { | 104 PixelWeight* GetPixelWeight(int pixel) { |
| 101 return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize); | 105 return reinterpret_cast<PixelWeight*>(m_pWeightTables.data() + |
| 106 pixel * m_ItemSize); |
| 102 } | 107 } |
| 103 | 108 |
| 104 int m_ItemSize; | 109 int m_ItemSize; |
| 105 uint8_t* m_pWeightTables; | 110 std::vector<uint8_t> m_pWeightTables; |
| 106 }; | 111 }; |
| 107 | 112 |
| 108 class CFXCODEC_VertTable { | 113 class CFXCODEC_VertTable { |
| 109 public: | 114 public: |
| 110 CFXCODEC_VertTable() { m_pWeightTables = nullptr; } | 115 CFXCODEC_VertTable() {} |
| 111 ~CFXCODEC_VertTable() { FX_Free(m_pWeightTables); } | 116 ~CFXCODEC_VertTable() {} |
| 112 void Calc(int dest_len, int src_len); | 117 void Calc(int dest_len, int src_len); |
| 113 PixelWeight* GetPixelWeight(int pixel) { | 118 PixelWeight* GetPixelWeight(int pixel) { |
| 114 return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize); | 119 return reinterpret_cast<PixelWeight*>(m_pWeightTables.data() + |
| 120 pixel * m_ItemSize); |
| 115 } | 121 } |
| 116 int m_ItemSize; | 122 int m_ItemSize; |
| 117 uint8_t* m_pWeightTables; | 123 std::vector<uint8_t> m_pWeightTables; |
| 118 }; | 124 }; |
| 119 | 125 |
| 120 IFX_FileRead* m_pFile; | 126 IFX_FileRead* m_pFile; |
| 121 CCodec_ModuleMgr* m_pCodecMgr; | 127 CCodec_ModuleMgr* m_pCodecMgr; |
| 122 FXJPEG_Context* m_pJpegContext; | 128 FXJPEG_Context* m_pJpegContext; |
| 123 FXPNG_Context* m_pPngContext; | 129 FXPNG_Context* m_pPngContext; |
| 124 FXGIF_Context* m_pGifContext; | 130 FXGIF_Context* m_pGifContext; |
| 125 FXBMP_Context* m_pBmpContext; | 131 FXBMP_Context* m_pBmpContext; |
| 126 CCodec_TiffContext* m_pTiffContext; | 132 CCodec_TiffContext* m_pTiffContext; |
| 127 FXCODEC_IMAGE_TYPE m_imagType; | 133 FXCODEC_IMAGE_TYPE m_imagType; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 FXCODEC_STATUS& err_status); | 227 FXCODEC_STATUS& err_status); |
| 222 void GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceBitmap, | 228 void GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceBitmap, |
| 223 double scale_y, | 229 double scale_y, |
| 224 int des_row); | 230 int des_row); |
| 225 FX_BOOL BmpReadMoreData(CCodec_BmpModule* pBmpModule, | 231 FX_BOOL BmpReadMoreData(CCodec_BmpModule* pBmpModule, |
| 226 FXCODEC_STATUS& err_status); | 232 FXCODEC_STATUS& err_status); |
| 227 void ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row); | 233 void ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row); |
| 228 }; | 234 }; |
| 229 | 235 |
| 230 #endif // CORE_FXCODEC_CODEC_INCLUDE_CCODEC_PROGRESSIVEDECODER_H_ | 236 #endif // CORE_FXCODEC_CODEC_INCLUDE_CCODEC_PROGRESSIVEDECODER_H_ |
| OLD | NEW |