diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-06-10 14:33:37 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-06-10 14:33:37 -0700 |
commit | d7e5cc754a937605d1f73db5e7967c58ddd80742 (patch) | |
tree | ed28e012c4d6a46b7f29f15a0c060474c27d4286 /core/src/fxcodec | |
parent | bfa9a824a20f37c2dd7111012b46c929cf2ed8a0 (diff) | |
download | pdfium-d7e5cc754a937605d1f73db5e7967c58ddd80742.tar.xz |
Merge to XFA: Remove typdefs for pointer types in fx_system.h.
Original Review URL: https://codereview.chromium.org/1171733003
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1178613002.
Diffstat (limited to 'core/src/fxcodec')
23 files changed, 504 insertions, 498 deletions
diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h index c50faaa936..90e8b8c02c 100644 --- a/core/src/fxcodec/codec/codec_int.h +++ b/core/src/fxcodec/codec/codec_int.h @@ -17,11 +17,11 @@ class CCodec_BasicModule : public ICodec_BasicModule { public: - virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); - virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); - virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, + virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc); }; struct CCodec_ImageDataCache { @@ -44,7 +44,7 @@ public: virtual void DownScale(int dest_width, int dest_height); - FX_LPBYTE GetScanline(int line); + uint8_t* GetScanline(int line); FX_BOOL SkipToScanline(int line, IFX_Pause* pPause); @@ -100,39 +100,39 @@ protected: FX_BOOL m_bColorTransformed; - FX_LPBYTE ReadNextLine(); + uint8_t* ReadNextLine(); virtual FX_BOOL v_Rewind() = 0; - virtual FX_LPBYTE v_GetNextLine() = 0; + virtual uint8_t* v_GetNextLine() = 0; virtual void v_DownScale(int dest_width, int dest_height) = 0; int m_NextLine; - FX_LPBYTE m_pLastScanline; + uint8_t* m_pLastScanline; CCodec_ImageDataCache* m_pDataCache; }; class CCodec_FaxModule : public ICodec_FaxModule { public: - virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, + virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows); - FX_BOOL Encode(FX_LPCBYTE src_buf, int width, int height, int pitch, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); + FX_BOOL Encode(const uint8_t* src_buf, int width, int height, int pitch, uint8_t*& dest_buf, FX_DWORD& dest_size); }; class CCodec_FlateModule : public ICodec_FlateModule { public: - virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, + virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns); virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); + FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size); virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_LPBYTE& dest_buf, FX_DWORD& dest_size); - virtual FX_BOOL Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); + uint8_t*& dest_buf, FX_DWORD& dest_size); + virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); }; class CCodec_JpegModule : public ICodec_JpegModule { @@ -142,19 +142,19 @@ public: { m_pExtProvider = pJP; } - ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, + ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform); - FX_BOOL LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& width, int& height, + FX_BOOL LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, - FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length); - FX_BOOL Encode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_STRSIZE& dest_size, int quality, FX_LPCBYTE icc_buf, FX_DWORD icc_length); + uint8_t** icc_buf_ptr, FX_DWORD* icc_length); + FX_BOOL Encode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, FX_DWORD icc_length); virtual void* Start(); virtual void Finish(void* pContext); - virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size); + virtual void Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size); virtual int ReadHeader(void* pContext, int* width, int* height, int* nComps, CFX_DIBAttribute* pAttribute = NULL); virtual FX_BOOL StartScanline(void* pContext, int down_scale); - virtual FX_BOOL ReadScanline(void* pContext, FX_LPBYTE dest_buf); - virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr); + virtual FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf); + virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr); protected: IFX_JpegProvider* m_pExtProvider; }; @@ -169,7 +169,7 @@ public: virtual void* Start(void* pModule); virtual void Finish(void* pContext); - virtual FX_BOOL Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_DIBAttribute* pAttribute); + virtual FX_BOOL Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size, CFX_DIBAttribute* pAttribute); protected: FX_CHAR m_szLastError[PNG_ERROR_SIZE]; }; @@ -182,8 +182,8 @@ public: } virtual void* Start(void* pModule); virtual void Finish(void* pContext); - virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr); - virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size); + virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr); + virtual void Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size); virtual int32_t ReadHeader(void* pContext, int* width, int* height, int* pal_num, void** pal_pp, int* bg_index, CFX_DIBAttribute* pAttribute); @@ -204,8 +204,8 @@ public: } virtual void* Start(void* pModule); virtual void Finish(void* pContext); - virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr); - virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size); + virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr); + virtual void Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size); virtual int32_t ReadHeader(void* pContext, int32_t* width, int32_t* height, FX_BOOL* tb_flag, int32_t* components, int32_t* pal_num, FX_DWORD** pal_pp, CFX_DIBAttribute* pAttribute); virtual int32_t LoadImage(void* pContext); @@ -215,9 +215,9 @@ protected: class CCodec_IccModule : public ICodec_IccModule { public: - virtual IccCS GetProfileCS(FX_LPCBYTE pProfileData, unsigned int dwProfileSize); + virtual IccCS GetProfileCS(const uint8_t* pProfileData, unsigned int dwProfileSize); virtual IccCS GetProfileCS(IFX_FileRead* pFile); - virtual FX_LPVOID CreateTransform(ICodec_IccModule::IccParam* pInputParam, + virtual void* CreateTransform(ICodec_IccModule::IccParam* pInputParam, ICodec_IccModule::IccParam* pOutputParam, ICodec_IccModule::IccParam* pProofParam = NULL, FX_DWORD dwIntent = Icc_INTENT_PERCEPTUAL, @@ -225,16 +225,16 @@ public: FX_DWORD dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC, FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTPROOFING ); - virtual FX_LPVOID CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent = 0, + virtual void* CreateTransform_sRGB(const uint8_t* pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent = 0, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT); - virtual FX_LPVOID CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, - FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent = 0, + virtual void* CreateTransform_CMYK(const uint8_t* pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + const uint8_t* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent = 0, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT ); - virtual void DestroyTransform(FX_LPVOID pTransform); - virtual void Translate(FX_LPVOID pTransform, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues); - virtual void TranslateScanline(FX_LPVOID pTransform, FX_LPBYTE pDest, FX_LPCBYTE pSrc, int pixels); + virtual void DestroyTransform(void* pTransform); + virtual void Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues); + virtual void TranslateScanline(void* pTransform, uint8_t* pDest, const uint8_t* pSrc, int pixels); virtual void SetComponents(FX_DWORD nComponents) {m_nComponents = nComponents;} virtual ~CCodec_IccModule(); protected: @@ -247,26 +247,26 @@ protected: Icc_CLASS_PROOF, Icc_CLASS_MAX } Icc_CLASS; - FX_LPVOID CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc_CLASS ic, CFX_BinaryBuf* pTransformKey); + void* CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc_CLASS ic, CFX_BinaryBuf* pTransformKey); }; class CCodec_JpxModule : public ICodec_JpxModule { public: CCodec_JpxModule(); - void* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_BOOL useColorSpace = FALSE); - void GetImageInfo(FX_LPVOID ctx, FX_DWORD& width, FX_DWORD& height, + void* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL useColorSpace = FALSE); + void GetImageInfo(void* ctx, FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestream_nComps, FX_DWORD& output_nComps); - FX_BOOL Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_BOOL bTranslateColor, FX_LPBYTE offsets); + FX_BOOL Decode(void* ctx, uint8_t* dest_data, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets); void DestroyDecoder(void* ctx); }; class CCodec_TiffModule : public ICodec_TiffModule { public: - virtual FX_LPVOID CreateDecoder(IFX_FileRead* file_ptr); - virtual void GetFrames(FX_LPVOID ctx, int32_t& frames); - virtual FX_BOOL LoadFrameInfo(FX_LPVOID ctx, int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute = NULL); - virtual FX_BOOL Decode(FX_LPVOID ctx, class CFX_DIBitmap* pDIBitmap); - virtual void DestroyDecoder(FX_LPVOID ctx); + virtual void* CreateDecoder(IFX_FileRead* file_ptr); + virtual void GetFrames(void* ctx, int32_t& frames); + virtual FX_BOOL LoadFrameInfo(void* ctx, int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute = NULL); + virtual FX_BOOL Decode(void* ctx, class CFX_DIBitmap* pDIBitmap); + virtual void DestroyDecoder(void* ctx); }; class CPDF_Jbig2Interface : public CJBig2_Module { @@ -293,11 +293,11 @@ public: } return FX_Alloc(uint8_t, num * size); } - virtual void *JBig2_Realloc(FX_LPVOID pMem, FX_DWORD dwSize) + virtual void *JBig2_Realloc(void* pMem, FX_DWORD dwSize) { return FX_Realloc(uint8_t, pMem, dwSize); } - virtual void JBig2_Free(FX_LPVOID pMem) + virtual void JBig2_Free(void* pMem) { FX_Free(pMem); } @@ -310,11 +310,11 @@ public: IFX_FileRead* m_file_ptr; FX_DWORD m_width; FX_DWORD m_height; - FX_LPBYTE m_src_buf; + uint8_t* m_src_buf; FX_DWORD m_src_size; - FX_LPCBYTE m_global_data; + const uint8_t* m_global_data; FX_DWORD m_global_size; - FX_LPBYTE m_dest_buf; + uint8_t* m_dest_buf; FX_DWORD m_dest_pitch; FX_BOOL m_bFileReader; IFX_Pause* m_pPause; @@ -326,16 +326,16 @@ class CCodec_Jbig2Module : public ICodec_Jbig2Module public: CCodec_Jbig2Module() {}; ~CCodec_Jbig2Module(); - FX_BOOL Decode(FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch); + FX_BOOL Decode(FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, + const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch); FX_BOOL Decode(IFX_FileRead* file_ptr, - FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf); + FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf); void* CreateJbig2Context(); - FXCODEC_STATUS StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause); + FXCODEC_STATUS StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, + const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause); FXCODEC_STATUS StartDecode(void* pJbig2Context, IFX_FileRead* file_ptr, - FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf, IFX_Pause* pPause); + FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf, IFX_Pause* pPause); FXCODEC_STATUS ContinueDecode(void* pJbig2Context, IFX_Pause* pPause); void DestroyJbig2Context(void* pJbig2Context); CPDF_Jbig2Interface m_Module; @@ -347,24 +347,24 @@ class CFX_DIBAttributeExif : public IFX_DIBAttributeExif public: CFX_DIBAttributeExif(); ~CFX_DIBAttributeExif(); - virtual FX_BOOL GetInfo(FX_WORD tag, FX_LPVOID val); + virtual FX_BOOL GetInfo(FX_WORD tag, void* val); - FX_BOOL ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* pHead, FX_LPBYTE data, FX_DWORD len, CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* pVal); + FX_BOOL ParseExif(CFX_MapPtrTemplate<FX_DWORD, uint8_t*>* pHead, uint8_t* data, FX_DWORD len, CFX_MapPtrTemplate<FX_DWORD, uint8_t*>* pVal); - typedef FX_WORD (*_Read2Bytes)(FX_LPBYTE data); - typedef FX_DWORD (*_Read4Bytes)(FX_LPBYTE data); - FX_LPBYTE ParseExifIFH(FX_LPBYTE data, FX_DWORD len, _Read2Bytes* pReadWord, _Read4Bytes* pReadDword); - FX_BOOL ParseExifIFD(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* pMap, FX_LPBYTE data, FX_DWORD len); + typedef FX_WORD (*_Read2Bytes)(uint8_t* data); + typedef FX_DWORD (*_Read4Bytes)(uint8_t* data); + uint8_t* ParseExifIFH(uint8_t* data, FX_DWORD len, _Read2Bytes* pReadWord, _Read4Bytes* pReadDword); + FX_BOOL ParseExifIFD(CFX_MapPtrTemplate<FX_DWORD, uint8_t*>* pMap, uint8_t* data, FX_DWORD len); - FX_LPBYTE m_pExifData; + uint8_t* m_pExifData; FX_DWORD m_dwExifDataLen; void clear(); _Read2Bytes m_readWord; _Read4Bytes m_readDword; - CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE> m_TagHead; - CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE> m_TagVal; + CFX_MapPtrTemplate<FX_DWORD, uint8_t*> m_TagHead; + CFX_MapPtrTemplate<FX_DWORD, uint8_t*> m_TagVal; }; struct DecodeData { diff --git a/core/src/fxcodec/codec/fx_codec.cpp b/core/src/fxcodec/codec/fx_codec.cpp index 5676e46be0..ed007fdcb1 100644 --- a/core/src/fxcodec/codec/fx_codec.cpp +++ b/core/src/fxcodec/codec/fx_codec.cpp @@ -51,7 +51,7 @@ CCodec_ScanlineDecoder::~CCodec_ScanlineDecoder() FX_Free(m_pDataCache); } } -FX_LPBYTE CCodec_ScanlineDecoder::GetScanline(int line) +uint8_t* CCodec_ScanlineDecoder::GetScanline(int line) { if (m_pDataCache && line < m_pDataCache->m_nCachedLines) { return &m_pDataCache->m_Data + line * m_Pitch; @@ -95,9 +95,9 @@ FX_BOOL CCodec_ScanlineDecoder::SkipToScanline(int line, IFX_Pause* pPause) } return FALSE; } -FX_LPBYTE CCodec_ScanlineDecoder::ReadNextLine() +uint8_t* CCodec_ScanlineDecoder::ReadNextLine() { - FX_LPBYTE pLine = v_GetNextLine(); + uint8_t* pLine = v_GetNextLine(); if (pLine == NULL) { return NULL; } @@ -131,7 +131,7 @@ void CCodec_ScanlineDecoder::DownScale(int dest_width, int dest_height) m_pDataCache->m_Width = m_OutputWidth; m_pDataCache->m_nCachedLines = 0; } -FX_BOOL CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, +FX_BOOL CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { return FALSE; @@ -240,7 +240,7 @@ extern "C" double FXstrtod(const char* nptr, char** endptr) } return is_negative ? -ret : ret; } -FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, +FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { return FALSE; @@ -283,7 +283,7 @@ void CFX_DIBAttributeExif::clear() } m_pExifData = NULL; FX_DWORD key = 0; - FX_LPBYTE buf = NULL; + uint8_t* buf = NULL; FX_POSITION pos = NULL; pos = m_TagHead.GetStartPosition(); while (pos) { @@ -302,29 +302,29 @@ void CFX_DIBAttributeExif::clear() } m_TagVal.RemoveAll(); } -static FX_WORD _Read2BytesL(FX_LPBYTE data) +static FX_WORD _Read2BytesL(uint8_t* data) { ASSERT(data); return data[0] | (data[1] << 8); } -static FX_WORD _Read2BytesB(FX_LPBYTE data) +static FX_WORD _Read2BytesB(uint8_t* data) { ASSERT(data); return data[1] | (data[0] << 8); } -static FX_DWORD _Read4BytesL(FX_LPBYTE data) +static FX_DWORD _Read4BytesL(uint8_t* data) { return _Read2BytesL(data) | (_Read2BytesL(data + 2) << 16); } -static FX_DWORD _Read4BytesB(FX_LPBYTE data) +static FX_DWORD _Read4BytesB(uint8_t* data) { return _Read2BytesB(data + 2) | (_Read2BytesB(data) << 16); } -typedef FX_WORD (*_Read2Bytes) (FX_LPBYTE data); -typedef FX_DWORD (*_Read4Bytes) (FX_LPBYTE data); -typedef void (*_Write2Bytes) (FX_LPBYTE data, FX_WORD val); -typedef void (*_Write4Bytes) (FX_LPBYTE data, FX_DWORD val); -FX_LPBYTE CFX_DIBAttributeExif::ParseExifIFH(FX_LPBYTE data, FX_DWORD len, _Read2Bytes* pReadWord, _Read4Bytes* pReadDword) +typedef FX_WORD (*_Read2Bytes) (uint8_t* data); +typedef FX_DWORD (*_Read4Bytes) (uint8_t* data); +typedef void (*_Write2Bytes) (uint8_t* data, FX_WORD val); +typedef void (*_Write4Bytes) (uint8_t* data, FX_DWORD val); +uint8_t* CFX_DIBAttributeExif::ParseExifIFH(uint8_t* data, FX_DWORD len, _Read2Bytes* pReadWord, _Read4Bytes* pReadDword) { if (len > 8) { FX_BOOL tag = FALSE; @@ -356,14 +356,14 @@ FX_LPBYTE CFX_DIBAttributeExif::ParseExifIFH(FX_LPBYTE data, FX_DWORD len, _Read } return data; } -FX_BOOL CFX_DIBAttributeExif::ParseExifIFD(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* pMap, FX_LPBYTE data, FX_DWORD len) +FX_BOOL CFX_DIBAttributeExif::ParseExifIFD(CFX_MapPtrTemplate<FX_DWORD, uint8_t*>* pMap, uint8_t* data, FX_DWORD len) { if (pMap && data) { if (len > 8) { FX_WORD wTagNum = m_readWord(data); data += 2; FX_DWORD wTag; - FX_LPBYTE buf; + uint8_t* buf; while (wTagNum--) { wTag = m_readWord(data); data += 2; @@ -417,11 +417,11 @@ enum FX_ExifDataType { FX_SignedFloat, FX_DoubleFloat }; -FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* pHead, FX_LPBYTE data, FX_DWORD len, CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* pVal) +FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, uint8_t*>* pHead, uint8_t* data, FX_DWORD len, CFX_MapPtrTemplate<FX_DWORD, uint8_t*>* pVal) { if (pHead && data && pVal) { if (len > 8) { - FX_LPBYTE old_data = data; + uint8_t* old_data = data; data = ParseExifIFH(data, len, &m_readWord, &m_readDword); if (data == old_data) { return FALSE; @@ -435,11 +435,13 @@ FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* FX_WORD type; FX_DWORD dwSize; FX_DWORD tag; - FX_LPBYTE head; + uint8_t* head; FX_POSITION pos = pHead->GetStartPosition(); while (pos) { pHead->GetNextAssoc(pos, tag, head); - FX_LPBYTE val = NULL, buf = NULL, temp = NULL; + uint8_t* val = NULL; + uint8_t* buf = NULL; + uint8_t* temp = NULL; int i; if (head) { type = m_readWord(head); @@ -558,14 +560,14 @@ FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* return FALSE; } #define FXEXIF_INFOCONVERT(T) {T* src = (T*)ptr; T* dst = (T*)val; *dst = *src;} -FX_BOOL CFX_DIBAttributeExif::GetInfo( FX_WORD tag, FX_LPVOID val ) +FX_BOOL CFX_DIBAttributeExif::GetInfo( FX_WORD tag, void* val ) { if (m_TagVal.GetCount() == 0) { if (!ParseExif(&m_TagHead, m_pExifData, m_dwExifDataLen, &m_TagVal)) { return FALSE; } } - FX_LPBYTE ptr = NULL; + uint8_t* ptr = NULL; if (m_TagVal.Lookup(tag, ptr)) { switch (tag) { case EXIFTAG_USHORT_RESUNIT: @@ -583,7 +585,7 @@ FX_BOOL CFX_DIBAttributeExif::GetInfo( FX_WORD tag, FX_LPVOID val ) FXEXIF_INFOCONVERT(FX_WORD); break; default: { - FX_LPBYTE* dst = (FX_LPBYTE*)val; + uint8_t** dst = (uint8_t**)val; *dst = ptr; } } @@ -595,10 +597,10 @@ class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder public: CCodec_RLScanlineDecoder(); virtual ~CCodec_RLScanlineDecoder(); - FX_BOOL Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc); + FX_BOOL Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc); virtual void v_DownScale(int dest_width, int dest_height) {} virtual FX_BOOL v_Rewind(); - virtual FX_LPBYTE v_GetNextLine(); + virtual uint8_t* v_GetNextLine(); virtual FX_DWORD GetSrcOffset() { return m_SrcOffset; @@ -608,8 +610,8 @@ protected: void GetNextOperator(); void UpdateOperator(uint8_t used_bytes); - FX_LPBYTE m_pScanline; - FX_LPCBYTE m_pSrcBuf; + uint8_t* m_pScanline; + const uint8_t* m_pSrcBuf; FX_DWORD m_SrcSize; FX_DWORD m_dwLineBytes; FX_DWORD m_SrcOffset; @@ -661,7 +663,7 @@ FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() } return TRUE; } -FX_BOOL CCodec_RLScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc) +FX_BOOL CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc) { m_pSrcBuf = src_buf; m_SrcSize = src_size; @@ -684,7 +686,7 @@ FX_BOOL CCodec_RLScanlineDecoder::v_Rewind() m_Operator = 0; return TRUE; } -FX_LPBYTE CCodec_RLScanlineDecoder::v_GetNextLine() +uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() { if (m_SrcOffset == 0) { GetNextOperator(); @@ -768,7 +770,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) count -= used_bytes; m_Operator = 257 - count; } -ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc) { CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder; diff --git a/core/src/fxcodec/codec/fx_codec_bmp.cpp b/core/src/fxcodec/codec/fx_codec_bmp.cpp index 924eaa91a4..554ce358e0 100644 --- a/core/src/fxcodec/codec/fx_codec_bmp.cpp +++ b/core/src/fxcodec/codec/fx_codec_bmp.cpp @@ -28,12 +28,12 @@ extern "C" { }
}
};
-static void _bmp_error_data(bmp_decompress_struct_p bmp_ptr, FX_LPCSTR err_msg)
+static void _bmp_error_data(bmp_decompress_struct_p bmp_ptr, const FX_CHAR* err_msg)
{
FXSYS_strncpy((char*)bmp_ptr->err_ptr, err_msg, BMP_MAX_ERROR_SIZE - 1);
longjmp(bmp_ptr->jmpbuf, 1);
}
-static void _bmp_read_scanline(bmp_decompress_struct_p bmp_ptr, int32_t row_num, FX_LPBYTE row_buf)
+static void _bmp_read_scanline(bmp_decompress_struct_p bmp_ptr, int32_t row_num, uint8_t* row_buf)
{
FXBMP_Context* p = (FXBMP_Context*)bmp_ptr->context_ptr;
CCodec_BmpModule* pModule = (CCodec_BmpModule*)p->parent_ptr;
@@ -112,13 +112,13 @@ int32_t CCodec_BmpModule::LoadImage(void* pContext) }
return _bmp_decode_image(p->bmp_ptr);
}
-FX_DWORD CCodec_BmpModule::GetAvailInput(void* pContext, FX_LPBYTE* avial_buf_ptr)
+FX_DWORD CCodec_BmpModule::GetAvailInput(void* pContext, uint8_t** avial_buf_ptr)
{
FXBMP_Context* p = (FXBMP_Context*)pContext;
return _bmp_get_avail_input(p->bmp_ptr, avial_buf_ptr);
}
-void CCodec_BmpModule::Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size)
+void CCodec_BmpModule::Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size)
{
FXBMP_Context* p = (FXBMP_Context*)pContext;
- _bmp_input_buffer(p->bmp_ptr, (FX_LPBYTE)src_buf, src_size);
+ _bmp_input_buffer(p->bmp_ptr, (uint8_t*)src_buf, src_size);
}
diff --git a/core/src/fxcodec/codec/fx_codec_fax.cpp b/core/src/fxcodec/codec/fx_codec_fax.cpp index 869751e05b..40502362d5 100644 --- a/core/src/fxcodec/codec/fx_codec_fax.cpp +++ b/core/src/fxcodec/codec/fx_codec_fax.cpp @@ -48,7 +48,7 @@ int _FindBit(const uint8_t* data_buf, int max_pos, int start_pos, int bit) if (start_pos >= max_pos) { return max_pos; } - FX_LPCBYTE leading_pos = bit ? OneLeadPos : ZeroLeadPos; + const uint8_t* leading_pos = bit ? OneLeadPos : ZeroLeadPos; if (start_pos % 8) { uint8_t data = data_buf[start_pos / 8]; if (bit) { @@ -100,7 +100,7 @@ void _FaxG4FindB1B2(const uint8_t* ref_buf, int columns, int a0, FX_BOOL a0color } b2 = _FindBit(ref_buf, columns, b1 + 1, first_bit); } -void _FaxFillBits(FX_LPBYTE dest_buf, int columns, int startpos, int endpos) +void _FaxFillBits(uint8_t* dest_buf, int columns, int startpos, int endpos) { if (startpos < 0) { startpos = 0; @@ -375,7 +375,7 @@ static const uint8_t FaxWhiteRunIns[] = { 0x1f, 2560 % 256, 2560 / 256, 0xff, }; -int _FaxGetRun(FX_LPCBYTE ins_array, const uint8_t* src_buf, int& bitpos, int bitsize) +int _FaxGetRun(const uint8_t* ins_array, const uint8_t* src_buf, int& bitpos, int bitsize) { FX_DWORD code = 0; int ins_off = 0; @@ -400,7 +400,7 @@ int _FaxGetRun(FX_LPCBYTE ins_array, const uint8_t* src_buf, int& bitpos, int bi } } } -FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const uint8_t* ref_buf, int columns) +FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, const uint8_t* ref_buf, int columns) { int a0 = -1, a0color = 1; while (1) { @@ -536,7 +536,7 @@ FX_BOOL _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos) } return FALSE; } -FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns) +FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, int columns) { int color = TRUE; int startpos = 0; @@ -577,17 +577,18 @@ class CCodec_FaxDecoder : public CCodec_ScanlineDecoder public: CCodec_FaxDecoder(); virtual ~CCodec_FaxDecoder(); - FX_BOOL Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, + FX_BOOL Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows); virtual void v_DownScale(int dest_width, int dest_height) {} virtual FX_BOOL v_Rewind(); - virtual FX_LPBYTE v_GetNextLine(); + virtual uint8_t* v_GetNextLine(); virtual FX_DWORD GetSrcOffset(); int m_Encoding, m_bEndOfLine, m_bByteAlign, m_bBlack; int bitpos; - FX_LPCBYTE m_pSrcBuf; + const uint8_t* m_pSrcBuf; FX_DWORD m_SrcSize; - FX_LPBYTE m_pScanlineBuf, m_pRefBuf; + uint8_t* m_pScanlineBuf; + uint8_t* m_pRefBuf; }; CCodec_FaxDecoder::CCodec_FaxDecoder() { @@ -603,7 +604,7 @@ CCodec_FaxDecoder::~CCodec_FaxDecoder() FX_Free(m_pRefBuf); } } -FX_BOOL CCodec_FaxDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +FX_BOOL CCodec_FaxDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows) { m_Encoding = K; @@ -636,7 +637,7 @@ FX_BOOL CCodec_FaxDecoder::v_Rewind() bitpos = 0; return TRUE; } -FX_LPBYTE CCodec_FaxDecoder::v_GetNextLine() +uint8_t* CCodec_FaxDecoder::v_GetNextLine() { int bitsize = m_SrcSize * 8; _FaxSkipEOL(m_pSrcBuf, bitsize, bitpos); @@ -693,16 +694,16 @@ FX_DWORD CCodec_FaxDecoder::GetSrcOffset() return ret; } extern "C" { - void _FaxG4Decode(void*, FX_LPCBYTE src_buf, FX_DWORD src_size, int* pbitpos, FX_LPBYTE dest_buf, int width, int height, int pitch) + void _FaxG4Decode(void*, const uint8_t* src_buf, FX_DWORD src_size, int* pbitpos, uint8_t* dest_buf, int width, int height, int pitch) { if (pitch == 0) { pitch = (width + 7) / 8; } - FX_LPBYTE ref_buf = FX_Alloc(uint8_t, pitch); + uint8_t* ref_buf = FX_Alloc(uint8_t, pitch); FXSYS_memset8(ref_buf, 0xff, pitch); int bitpos = *pbitpos; for (int iRow = 0; iRow < height; iRow ++) { - FX_LPBYTE line_buf = dest_buf + iRow * pitch; + uint8_t* line_buf = dest_buf + iRow * pitch; FXSYS_memset8(line_buf, 0xff, pitch); _FaxG4GetRow(src_buf, src_size << 3, bitpos, line_buf, ref_buf, width); FXSYS_memcpy32(ref_buf, line_buf, pitch); @@ -836,7 +837,7 @@ static const uint8_t WhiteRunMarkup[80] = { 0x1e, 12, 0x1f, 12, }; -static void _AddBitStream(FX_LPBYTE dest_buf, int& dest_bitpos, int data, int bitlen) +static void _AddBitStream(uint8_t* dest_buf, int& dest_bitpos, int data, int bitlen) { for (int i = bitlen - 1; i >= 0; i --) { if (data & (1 << i)) { @@ -845,7 +846,7 @@ static void _AddBitStream(FX_LPBYTE dest_buf, int& dest_bitpos, int data, int bi dest_bitpos ++; } } -static void _FaxEncodeRun(FX_LPBYTE dest_buf, int& dest_bitpos, int run, FX_BOOL bWhite) +static void _FaxEncodeRun(uint8_t* dest_buf, int& dest_bitpos, int run, FX_BOOL bWhite) { while (run >= 2560) { _AddBitStream(dest_buf, dest_bitpos, 0x1f, 12); @@ -853,16 +854,16 @@ static void _FaxEncodeRun(FX_LPBYTE dest_buf, int& dest_bitpos, int run, FX_BOOL } if (run >= 64) { int markup = run - run % 64; - FX_LPCBYTE p = bWhite ? WhiteRunMarkup : BlackRunMarkup; + const uint8_t* p = bWhite ? WhiteRunMarkup : BlackRunMarkup; p += (markup / 64 - 1) * 2; _AddBitStream(dest_buf, dest_bitpos, *p, p[1]); } run %= 64; - FX_LPCBYTE p = bWhite ? WhiteRunTerminator : BlackRunTerminator; + const uint8_t* p = bWhite ? WhiteRunTerminator : BlackRunTerminator; p += run * 2; _AddBitStream(dest_buf, dest_bitpos, *p, p[1]); } -static void _FaxEncode2DLine(FX_LPBYTE dest_buf, int& dest_bitpos, FX_LPCBYTE src_buf, FX_LPCBYTE ref_buf, int cols) +static void _FaxEncode2DLine(uint8_t* dest_buf, int& dest_bitpos, const uint8_t* src_buf, const uint8_t* ref_buf, int cols) { int a0 = -1, a0color = 1; while (1) { @@ -920,16 +921,17 @@ static void _FaxEncode2DLine(FX_LPBYTE dest_buf, int& dest_bitpos, FX_LPCBYTE sr class CCodec_FaxEncoder { public: - CCodec_FaxEncoder(FX_LPCBYTE src_buf, int width, int height, int pitch); + CCodec_FaxEncoder(const uint8_t* src_buf, int width, int height, int pitch); ~CCodec_FaxEncoder(); - void Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size); - void Encode2DLine(FX_LPCBYTE scan_line); + void Encode(uint8_t*& dest_buf, FX_DWORD& dest_size); + void Encode2DLine(const uint8_t* scan_line); CFX_BinaryBuf m_DestBuf; - FX_LPBYTE m_pRefLine, m_pLineBuf; + uint8_t* m_pRefLine; + uint8_t* m_pLineBuf; int m_Cols, m_Rows, m_Pitch; - FX_LPCBYTE m_pSrcBuf; + const uint8_t* m_pSrcBuf; }; -CCodec_FaxEncoder::CCodec_FaxEncoder(FX_LPCBYTE src_buf, int width, int height, int pitch) +CCodec_FaxEncoder::CCodec_FaxEncoder(const uint8_t* src_buf, int width, int height, int pitch) { m_pSrcBuf = src_buf; m_Cols = width; @@ -949,12 +951,12 @@ CCodec_FaxEncoder::~CCodec_FaxEncoder() FX_Free(m_pLineBuf); } } -void CCodec_FaxEncoder::Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +void CCodec_FaxEncoder::Encode(uint8_t*& dest_buf, FX_DWORD& dest_size) { int dest_bitpos = 0; uint8_t last_byte = 0; for (int i = 0; i < m_Rows; i ++) { - FX_LPCBYTE scan_line = m_pSrcBuf + i * m_Pitch; + const uint8_t* scan_line = m_pSrcBuf + i * m_Pitch; FXSYS_memset32(m_pLineBuf, 0, m_Pitch * 8); m_pLineBuf[0] = last_byte; _FaxEncode2DLine(m_pLineBuf, dest_bitpos, scan_line, m_pRefLine, m_Cols); @@ -970,13 +972,13 @@ void CCodec_FaxEncoder::Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size) dest_size = m_DestBuf.GetSize(); m_DestBuf.DetachBuffer(); } -FX_BOOL CCodec_FaxModule::Encode(FX_LPCBYTE src_buf, int width, int height, int pitch, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_BOOL CCodec_FaxModule::Encode(const uint8_t* src_buf, int width, int height, int pitch, uint8_t*& dest_buf, FX_DWORD& dest_size) { CCodec_FaxEncoder encoder(src_buf, width, height, pitch); encoder.Encode(dest_buf, dest_size); return TRUE; } -ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows) { CCodec_FaxDecoder* pDecoder = new CCodec_FaxDecoder; diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp index 9997a570d6..2e6cf4e8db 100644 --- a/core/src/fxcodec/codec/fx_codec_flate.cpp +++ b/core/src/fxcodec/codec/fx_codec_flate.cpp @@ -79,11 +79,11 @@ extern "C" class CLZWDecoder { public: - FX_BOOL Decode(FX_LPBYTE output, FX_DWORD& outlen, const uint8_t* input, FX_DWORD& size, FX_BOOL bEarlyChange); + FX_BOOL Decode(uint8_t* output, FX_DWORD& outlen, const uint8_t* input, FX_DWORD& size, FX_BOOL bEarlyChange); private: FX_DWORD m_InPos; FX_DWORD m_OutPos; - FX_LPBYTE m_pOutput; + uint8_t* m_pOutput; const uint8_t* m_pInput; FX_BOOL m_Early; void AddCode(FX_DWORD prefix_code, uint8_t append_char); @@ -127,7 +127,7 @@ void CLZWDecoder::DecodeString(FX_DWORD code) } m_DecodeStack[m_StackLen++] = (uint8_t)code; } -int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const uint8_t* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange) +int CLZWDecoder::Decode(uint8_t* dest_buf, FX_DWORD& dest_size, const uint8_t* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange) { m_CodeLen = 9; m_InPos = 0; @@ -231,7 +231,7 @@ static uint8_t PaethPredictor(int a, int b, int c) } return (uint8_t)c; } -static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, +static FX_BOOL PNG_PredictorEncode(uint8_t*& data_buf, FX_DWORD& data_size, int predictor, int Colors, int BitsPerComponent, int Columns) { @@ -241,10 +241,10 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, return FALSE; const int row_count = (data_size + row_size - 1) / row_size; const int last_row_size = data_size % row_size; - FX_LPBYTE dest_buf = FX_Alloc2D(uint8_t, row_size + 1, row_count); + uint8_t* dest_buf = FX_Alloc2D(uint8_t, row_size + 1, row_count); int byte_cnt = 0; - FX_LPBYTE pSrcData = data_buf; - FX_LPBYTE pDestData = dest_buf; + uint8_t* pSrcData = data_buf; + uint8_t* pDestData = dest_buf; for (int row = 0; row < row_count; row++) { if (predictor == 10) { pDestData[0] = 0; @@ -323,7 +323,7 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, data_size = (row_size + 1) * row_count - (last_row_size > 0 ? (row_size - last_row_size) : 0); return TRUE; } -static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE pLastLine, +static void PNG_PredictLine(uint8_t* pDestData, const uint8_t* pSrcData, const uint8_t* pLastLine, int bpc, int nColors, int nPixels) { int row_size = (nPixels * bpc * nColors + 7) / 8; @@ -386,7 +386,7 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE } } } -static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, +static FX_BOOL PNG_Predictor(uint8_t*& data_buf, FX_DWORD& data_size, int Colors, int BitsPerComponent, int Columns) { const int BytesPerPixel = (Colors * BitsPerComponent + 7) / 8; @@ -395,10 +395,10 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, return FALSE; const int row_count = (data_size + row_size) / (row_size + 1); const int last_row_size = data_size % (row_size + 1); - FX_LPBYTE dest_buf = FX_Alloc2D(uint8_t, row_size, row_count); + uint8_t* dest_buf = FX_Alloc2D(uint8_t, row_size, row_count); int byte_cnt = 0; - FX_LPBYTE pSrcData = data_buf; - FX_LPBYTE pDestData = dest_buf; + uint8_t* pSrcData = data_buf; + uint8_t* pDestData = dest_buf; for (int row = 0; row < row_count; row ++) { uint8_t tag = pSrcData[0]; byte_cnt++; @@ -474,7 +474,7 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, data_size = row_size * row_count - (last_row_size > 0 ? (row_size + 1 - last_row_size) : 0); return TRUE; } -static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns) +static void TIFF_PredictorEncodeLine(uint8_t* dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns) { int BytesPerPixel = BitsPerComponent * Colors / 8; if (BitsPerComponent < 8) { @@ -511,7 +511,7 @@ static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsP } } } -static FX_BOOL TIFF_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, +static FX_BOOL TIFF_PredictorEncode(uint8_t*& data_buf, FX_DWORD& data_size, int Colors, int BitsPerComponent, int Columns) { int row_size = (Colors * BitsPerComponent * Columns + 7) / 8; @@ -520,7 +520,7 @@ static FX_BOOL TIFF_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, const int row_count = (data_size + row_size - 1) / row_size; const int last_row_size = data_size % row_size; for (int row = 0; row < row_count; row++) { - FX_LPBYTE scan_line = data_buf + row * row_size; + uint8_t* scan_line = data_buf + row * row_size; if ((row + 1) * row_size > (int)data_size) { row_size = last_row_size; } @@ -528,7 +528,7 @@ static FX_BOOL TIFF_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, } return TRUE; } -static void TIFF_PredictLine(FX_LPBYTE dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns) +static void TIFF_PredictLine(uint8_t* dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns) { if (BitsPerComponent == 1) { int row_bits = FX_MIN(BitsPerComponent * Colors * Columns, row_size * 8); @@ -561,7 +561,7 @@ static void TIFF_PredictLine(FX_LPBYTE dest_buf, int row_size, int BitsPerCompon } } } -static FX_BOOL TIFF_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, +static FX_BOOL TIFF_Predictor(uint8_t*& data_buf, FX_DWORD& data_size, int Colors, int BitsPerComponent, int Columns) { int row_size = (Colors * BitsPerComponent * Columns + 7) / 8; @@ -570,7 +570,7 @@ static FX_BOOL TIFF_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, const int row_count = (data_size + row_size - 1) / row_size; const int last_row_size = data_size % row_size; for (int row = 0; row < row_count; row ++) { - FX_LPBYTE scan_line = data_buf + row * row_size; + uint8_t* scan_line = data_buf + row * row_size; if ((row + 1) * row_size > (int)data_size) { row_size = last_row_size; } @@ -583,7 +583,7 @@ class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder public: CCodec_FlateScanlineDecoder(); ~CCodec_FlateScanlineDecoder(); - void Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, + void Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns); virtual void Destroy() { @@ -591,15 +591,15 @@ public: } virtual void v_DownScale(int dest_width, int dest_height) {} virtual FX_BOOL v_Rewind(); - virtual FX_LPBYTE v_GetNextLine(); + virtual uint8_t* v_GetNextLine(); virtual FX_DWORD GetSrcOffset(); void* m_pFlate; - FX_LPCBYTE m_SrcBuf; + const uint8_t* m_SrcBuf; FX_DWORD m_SrcSize; - FX_LPBYTE m_pScanline; - FX_LPBYTE m_pLastLine; - FX_LPBYTE m_pPredictBuffer; - FX_LPBYTE m_pPredictRaw; + uint8_t* m_pScanline; + uint8_t* m_pLastLine; + uint8_t* m_pPredictBuffer; + uint8_t* m_pPredictRaw; int m_Predictor; int m_Colors, m_BitsPerComponent, m_Columns, m_PredictPitch, m_LeftOver; }; @@ -630,7 +630,7 @@ CCodec_FlateScanlineDecoder::~CCodec_FlateScanlineDecoder() FPDFAPI_FlateEnd(m_pFlate); } } -void CCodec_FlateScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns) { m_SrcBuf = src_buf; @@ -678,7 +678,7 @@ FX_BOOL CCodec_FlateScanlineDecoder::v_Rewind() m_LeftOver = 0; return TRUE; } -FX_LPBYTE CCodec_FlateScanlineDecoder::v_GetNextLine() +uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() { if (m_Predictor) { if (m_Pitch == m_PredictPitch) { @@ -722,8 +722,8 @@ FX_DWORD CCodec_FlateScanlineDecoder::GetSrcOffset() { return FPDFAPI_FlateGetTotalIn(m_pFlate); } -static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig_size, - FX_LPBYTE& dest_buf, FX_DWORD& dest_size, FX_DWORD& offset) +static void FlateUncompress(const uint8_t* src_buf, FX_DWORD src_size, FX_DWORD orig_size, + uint8_t*& dest_buf, FX_DWORD& dest_size, FX_DWORD& offset) { const FX_BOOL useOldImpl = src_size < 10240; FX_DWORD guess_size = orig_size ? orig_size : src_size * 2; @@ -737,8 +737,8 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig FX_DWORD last_buf_size = buf_size; void* context = nullptr; - FX_LPBYTE guess_buf = FX_Alloc(uint8_t, guess_size + 1); - FX_LPBYTE cur_buf = guess_buf; + uint8_t* guess_buf = FX_Alloc(uint8_t, guess_size + 1); + uint8_t* cur_buf = guess_buf; guess_buf[guess_size] = '\0'; context = FPDFAPI_FlateInit(my_alloc_func, my_free_func); if (!context) @@ -776,7 +776,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig } dest_buf = guess_buf; } else { - CFX_ArrayTemplate<FX_LPBYTE> result_tmp_bufs; + CFX_ArrayTemplate<uint8_t*> result_tmp_bufs; while (1) { int32_t ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); int32_t avail_buf_size = FPDFAPI_FlateGetAvailOut(context); @@ -801,10 +801,10 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig if (result_tmp_bufs.GetSize() == 1) { dest_buf = result_tmp_bufs[0]; } else { - FX_LPBYTE result_buf = FX_Alloc(uint8_t, dest_size); + uint8_t* result_buf = FX_Alloc(uint8_t, dest_size); FX_DWORD result_pos = 0; for (int32_t i = 0; i < result_tmp_bufs.GetSize(); i++) { - FX_LPBYTE tmp_buf = result_tmp_bufs[i]; + uint8_t* tmp_buf = result_tmp_bufs[i]; FX_DWORD tmp_buf_size = buf_size; if (i == result_tmp_bufs.GetSize() - 1) { tmp_buf_size = last_buf_size; @@ -825,7 +825,7 @@ fail: dest_size = 0; return; } -ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns) { CCodec_FlateScanlineDecoder* pDecoder = new CCodec_FlateScanlineDecoder; @@ -834,7 +834,7 @@ ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(FX_LPCBYTE src_buf, FX } FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) + FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { dest_buf = NULL; FX_DWORD offset = 0; @@ -881,12 +881,12 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_b } FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_LPBYTE& dest_buf, FX_DWORD& dest_size) + uint8_t*& dest_buf, FX_DWORD& dest_size) { if (predictor != 2 && predictor < 10) { return Encode(src_buf, src_size, dest_buf, dest_size); } - FX_LPBYTE pSrcBuf = NULL; + uint8_t* pSrcBuf = NULL; pSrcBuf = FX_Alloc(uint8_t, src_size); FXSYS_memcpy32(pSrcBuf, src_buf, src_size); FX_BOOL ret = TRUE; @@ -902,7 +902,7 @@ FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_Free(pSrcBuf); return ret; } -FX_BOOL CCodec_FlateModule::Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { dest_size = src_size + src_size / 1000 + 12; dest_buf = FX_Alloc( uint8_t, dest_size); diff --git a/core/src/fxcodec/codec/fx_codec_gif.cpp b/core/src/fxcodec/codec/fx_codec_gif.cpp index 218b58a946..d22c156fdb 100644 --- a/core/src/fxcodec/codec/fx_codec_gif.cpp +++ b/core/src/fxcodec/codec/fx_codec_gif.cpp @@ -28,12 +28,12 @@ extern "C" { }
}
};
-static void _gif_error_data(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg)
+static void _gif_error_data(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg)
{
FXSYS_strncpy((char*)gif_ptr->err_ptr, err_msg, GIF_MAX_ERROR_SIZE - 1);
longjmp(gif_ptr->jmpbuf, 1);
}
-static FX_LPBYTE _gif_ask_buf_for_pal(gif_decompress_struct_p gif_ptr, int32_t pal_size)
+static uint8_t* _gif_ask_buf_for_pal(gif_decompress_struct_p gif_ptr, int32_t pal_size)
{
FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr;
CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
@@ -47,7 +47,7 @@ static void _gif_record_current_position(gif_decompress_struct_p gif_ptr, FX_DWO CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
pModule->RecordCurrentPositionCallback(p->child_ptr, *cur_pos_ptr);
}
-static void _gif_read_scanline(gif_decompress_struct_p gif_ptr, int32_t row_num, FX_LPBYTE row_buf)
+static void _gif_read_scanline(gif_decompress_struct_p gif_ptr, int32_t row_num, uint8_t* row_buf)
{
FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr;
CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
@@ -144,7 +144,7 @@ int32_t CCodec_GifModule::LoadFrame(void* pContext, int frame_num, CFX_DIBAttrib pAttribute->m_nGifTop = p->gif_ptr->img_ptr_arr_ptr->GetAt(frame_num)->image_info_ptr->top;
pAttribute->m_fAspectRatio = p->gif_ptr->pixel_aspect;
if (p->gif_ptr->cmt_data_ptr) {
- FX_LPCBYTE buf = (FX_LPCBYTE)p->gif_ptr->cmt_data_ptr->GetBuffer(0);
+ const uint8_t* buf = (const uint8_t*)p->gif_ptr->cmt_data_ptr->GetBuffer(0);
FX_DWORD len = p->gif_ptr->cmt_data_ptr->GetLength();
if (len > 21) {
uint8_t size = *buf++;
@@ -164,13 +164,13 @@ int32_t CCodec_GifModule::LoadFrame(void* pContext, int frame_num, CFX_DIBAttrib }
return ret;
}
-FX_DWORD CCodec_GifModule::GetAvailInput(void* pContext, FX_LPBYTE* avial_buf_ptr)
+FX_DWORD CCodec_GifModule::GetAvailInput(void* pContext, uint8_t** avial_buf_ptr)
{
FXGIF_Context* p = (FXGIF_Context*)pContext;
return _gif_get_avail_input(p->gif_ptr, avial_buf_ptr);
}
-void CCodec_GifModule::Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size)
+void CCodec_GifModule::Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size)
{
FXGIF_Context* p = (FXGIF_Context*)pContext;
- _gif_input_buffer(p->gif_ptr, (FX_LPBYTE)src_buf, src_size);
+ _gif_input_buffer(p->gif_ptr, (uint8_t*)src_buf, src_size);
}
diff --git a/core/src/fxcodec/codec/fx_codec_icc.cpp b/core/src/fxcodec/codec/fx_codec_icc.cpp index cde5d4c1bd..6fe92ff240 100644 --- a/core/src/fxcodec/codec/fx_codec_icc.cpp +++ b/core/src/fxcodec/codec/fx_codec_icc.cpp @@ -13,7 +13,7 @@ const FX_DWORD N_COMPONENT_RGB = 3; const FX_DWORD N_COMPONENT_CMYK = 4; const FX_DWORD N_COMPONENT_DEFAULT = 3; -FX_BOOL MD5ComputeID( FX_LPCVOID buf, FX_DWORD dwSize, uint8_t ID[16] ) +FX_BOOL MD5ComputeID( const void* buf, FX_DWORD dwSize, uint8_t ID[16] ) { return cmsMD5computeIDExt(buf, dwSize, ID); } @@ -218,7 +218,7 @@ void IccLib_TranslateImage(void* pTransform, unsigned char* pDest, const unsigne { cmsDoTransform(((CLcmsCmm*)pTransform)->m_hTransform, (void*)pSrc, pDest, pixels); } -FX_LPVOID CreateProfile_Gray(double gamma) +void* CreateProfile_Gray(double gamma) { cmsCIExyY* D50 = (cmsCIExyY*)cmsD50_xyY(); if (!cmsWhitePointFromTemp(D50, 6504)) { @@ -228,11 +228,11 @@ FX_LPVOID CreateProfile_Gray(double gamma) if (curve == NULL) { return NULL; } - FX_LPVOID profile = cmsCreateGrayProfile(D50, curve); + void* profile = cmsCreateGrayProfile(D50, curve); cmsFreeToneCurve(curve); return profile; } -ICodec_IccModule::IccCS GetProfileCSFromHandle(FX_LPVOID pProfile) +ICodec_IccModule::IccCS GetProfileCSFromHandle(void* pProfile) { if (pProfile == NULL) { return ICodec_IccModule::IccCS_Unknown; @@ -264,7 +264,7 @@ ICodec_IccModule::IccCS GetProfileCSFromHandle(FX_LPVOID pProfile) return ICodec_IccModule::IccCS_Unknown; } } -ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize) +ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(const uint8_t* pProfileData, FX_DWORD dwProfileSize) { ICodec_IccModule::IccCS cs; cmsHPROFILE hProfile = cmsOpenProfileFromMem((void*)pProfileData, dwProfileSize); @@ -284,13 +284,13 @@ ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(IFX_FileRead* pFile) } ICodec_IccModule::IccCS cs; FX_DWORD dwSize = (FX_DWORD)pFile->GetSize(); - FX_LPBYTE pBuf = FX_Alloc(uint8_t, dwSize); + uint8_t* pBuf = FX_Alloc(uint8_t, dwSize); pFile->ReadBlock(pBuf, 0, dwSize); cs = GetProfileCS(pBuf, dwSize); FX_Free(pBuf); return cs; } -FX_DWORD TransferProfileType(FX_LPVOID pProfile, FX_DWORD dwFormat) +FX_DWORD TransferProfileType(void* pProfile, FX_DWORD dwFormat) { cmsColorSpaceSignature cs = cmsGetColorSpace(pProfile); switch (cs) { @@ -341,7 +341,7 @@ class CFX_IccProfileCache public: CFX_IccProfileCache(); ~CFX_IccProfileCache(); - FX_LPVOID m_pProfile; + void* m_pProfile; FX_DWORD m_dwRate; protected: void Purge(); @@ -365,7 +365,7 @@ class CFX_IccTransformCache public: CFX_IccTransformCache(CLcmsCmm* pCmm = NULL); ~CFX_IccTransformCache(); - FX_LPVOID m_pIccTransform; + void* m_pIccTransform; FX_DWORD m_dwRate; CLcmsCmm* m_pCmm; protected: @@ -400,7 +400,7 @@ CFX_ByteStringKey& CFX_ByteStringKey::operator << (FX_DWORD i) AppendBlock(&i, sizeof(FX_DWORD)); return *this; } -FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc_CLASS ic, CFX_BinaryBuf* pTransformKey) +void* CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc_CLASS ic, CFX_BinaryBuf* pTransformKey) { CFX_IccProfileCache* pCache = NULL; CFX_ByteStringKey key; @@ -431,7 +431,7 @@ FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, CFX_ByteString ProfileKey(key.GetBuffer(), key.GetSize()); ASSERT(pTransformKey); pTransformKey->AppendBlock(ProfileKey.GetBuffer(0), ProfileKey.GetLength()); - if (!m_MapProfile.Lookup(ProfileKey, (FX_LPVOID&)pCache)) { + if (!m_MapProfile.Lookup(ProfileKey, (void*&)pCache)) { pCache = new CFX_IccProfileCache; switch (pIccParam->dwProfileType) { case Icc_PARAMTYPE_BUFFER: @@ -458,7 +458,7 @@ FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, } return pCache->m_pProfile; } -FX_LPVOID CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputParam, +void* CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputParam, ICodec_IccModule::IccParam* pOutputParam, ICodec_IccModule::IccParam* pProofParam, FX_DWORD dwIntent, FX_DWORD dwFlag, FX_DWORD dwPrfIntent, FX_DWORD dwPrfFlag) @@ -466,11 +466,11 @@ FX_LPVOID CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputPa CLcmsCmm* pCmm = NULL; ASSERT(pInputParam && pOutputParam); CFX_ByteStringKey key; - FX_LPVOID pInputProfile = CreateProfile(pInputParam, Icc_CLASS_INPUT, &key); + void* pInputProfile = CreateProfile(pInputParam, Icc_CLASS_INPUT, &key); if (pInputProfile == NULL) { return NULL; } - FX_LPVOID pOutputProfile = CreateProfile(pOutputParam, Icc_CLASS_OUTPUT, &key); + void* pOutputProfile = CreateProfile(pOutputParam, Icc_CLASS_OUTPUT, &key); if (pOutputProfile == NULL) { return NULL; } @@ -479,14 +479,14 @@ FX_LPVOID CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputPa if (dwInputProfileType == 0 || dwOutputProfileType == 0) { return NULL; } - FX_LPVOID pProofProfile = NULL; + void* pProofProfile = NULL; if (pProofParam) { pProofProfile = CreateProfile(pProofParam, Icc_CLASS_PROOF, &key); } key << dwInputProfileType << dwOutputProfileType << dwIntent << dwFlag << (pProofProfile != NULL) << dwPrfIntent << dwPrfFlag; CFX_ByteStringC TransformKey(key.GetBuffer(), key.GetSize()); CFX_IccTransformCache* pTransformCache; - if (!m_MapTranform.Lookup(TransformKey, (FX_LPVOID&)pTransformCache)) { + if (!m_MapTranform.Lookup(TransformKey, (void*&)pTransformCache)) { pCmm = FX_Alloc(CLcmsCmm, 1); pCmm->m_nSrcComponents = T_CHANNELS(dwInputProfileType); pCmm->m_nDstComponents = T_CHANNELS(dwOutputProfileType); @@ -512,7 +512,7 @@ CCodec_IccModule::~CCodec_IccModule() CFX_ByteString key; CFX_IccProfileCache* pProfileCache; while (pos) { - m_MapProfile.GetNextAssoc(pos, key, (FX_LPVOID&)pProfileCache); + m_MapProfile.GetNextAssoc(pos, key, (void*&)pProfileCache); if (pProfileCache) { delete pProfileCache; } @@ -520,18 +520,18 @@ CCodec_IccModule::~CCodec_IccModule() pos = m_MapTranform.GetStartPosition(); CFX_IccTransformCache* pTransformCache; while (pos) { - m_MapTranform.GetNextAssoc(pos, key, (FX_LPVOID&)pTransformCache); + m_MapTranform.GetNextAssoc(pos, key, (void*&)pTransformCache); if (pTransformCache) { delete pTransformCache; } } } -void* CCodec_IccModule::CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat) +void* CCodec_IccModule::CreateTransform_sRGB(const uint8_t* pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat) { return IccLib_CreateTransform_sRGB(pProfileData, dwProfileSize, nComponents, intent, dwSrcFormat); } -void* CCodec_IccModule::CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, - FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent, +void* CCodec_IccModule::CreateTransform_CMYK(const uint8_t* pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + const uint8_t* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent, FX_DWORD dwSrcFormat , FX_DWORD dwDstFormat) { return IccLib_CreateTransform(pSrcProfileData, dwSrcProfileSize, nSrcComponents, @@ -545,7 +545,7 @@ void CCodec_IccModule::Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOA { IccLib_Translate(pTransform, m_nComponents, pSrcValues, pDestValues); } -void CCodec_IccModule::TranslateScanline(void* pTransform, FX_LPBYTE pDest, FX_LPCBYTE pSrc, int32_t pixels) +void CCodec_IccModule::TranslateScanline(void* pTransform, uint8_t* pDest, const uint8_t* pSrc, int32_t pixels) { IccLib_TranslateImage(pTransform, pDest, pSrc, pixels); } diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp index 622448d659..b908915227 100644 --- a/core/src/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp @@ -25,12 +25,12 @@ void CCodec_Jbig2Module::DestroyJbig2Context(void* pJbig2Content) } pJbig2Content = NULL; } -FX_BOOL CCodec_Jbig2Module::Decode(FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch) +FX_BOOL CCodec_Jbig2Module::Decode(FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, + const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch) { FXSYS_memset32(dest_buf, 0, height * dest_pitch); CJBig2_Context* pContext = CJBig2_Context::CreateContext(&m_Module, - (FX_LPBYTE)global_data, global_size, (FX_LPBYTE)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache); + (uint8_t*)global_data, global_size, (uint8_t*)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache); if (pContext == NULL) { return FALSE; } @@ -47,12 +47,12 @@ FX_BOOL CCodec_Jbig2Module::Decode(FX_DWORD width, FX_DWORD height, FX_LPCBYTE s return TRUE; } FX_BOOL CCodec_Jbig2Module::Decode(IFX_FileRead* file_ptr, - FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf) + FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf) { CJBig2_Context* pContext = NULL; CJBig2_Image* dest_image = NULL; FX_DWORD src_size = (FX_DWORD)file_ptr->GetSize(); - FX_LPBYTE src_buf = FX_Alloc(uint8_t, src_size); + uint8_t* src_buf = FX_Alloc(uint8_t, src_size); int ret = 0; if(!file_ptr->ReadBlock(src_buf, 0, src_size)) { goto failed; @@ -80,8 +80,8 @@ failed: } return FALSE; } -FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause) +FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, + const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause) { if(!pJbig2Context) { return FXCODEC_STATUS_ERR_PARAMS; @@ -99,7 +99,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD wid m_pJbig2Context->m_bFileReader = FALSE; FXSYS_memset32(dest_buf, 0, height * dest_pitch); m_pJbig2Context->m_pContext = CJBig2_Context::CreateContext(&m_Module, - (FX_LPBYTE)global_data, global_size, (FX_LPBYTE)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache, pPause); + (uint8_t*)global_data, global_size, (uint8_t*)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache, pPause); if(!m_pJbig2Context->m_pContext) { return FXCODEC_STATUS_ERROR; } @@ -120,7 +120,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD wid return m_pJbig2Context->m_pContext->GetProcessiveStatus(); } FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, IFX_FileRead* file_ptr, - FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf, IFX_Pause* pPause) + FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf, IFX_Pause* pPause) { if(!pJbig2Context) { return FXCODEC_STATUS_ERR_PARAMS; diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp index 4d06a77067..df0ef5e9b6 100644 --- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp @@ -86,14 +86,14 @@ static FX_BOOL _JpegIsIccMarker(jpeg_saved_marker_ptr marker) } return FALSE; } -static FX_BOOL _JpegLoadIccProfile(j_decompress_ptr cinfo, FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length) +static FX_BOOL _JpegLoadIccProfile(j_decompress_ptr cinfo, uint8_t** icc_buf_ptr, FX_DWORD* icc_length) { if(icc_buf_ptr == NULL || icc_length == NULL) { return FALSE; } *icc_buf_ptr = NULL; *icc_length = 0; - FX_LPBYTE icc_data_ptr = NULL; + uint8_t* icc_data_ptr = NULL; FX_DWORD icc_data_len = 0; uint8_t count_icc_marker = 0; uint8_t num_icc_marker = 0; @@ -139,7 +139,7 @@ static FX_BOOL _JpegLoadIccProfile(j_decompress_ptr cinfo, FX_LPBYTE* icc_buf_pt } return TRUE; } -static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, FX_LPCBYTE icc_buf_ptr, FX_DWORD icc_length) +static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, const uint8_t* icc_buf_ptr, FX_DWORD icc_length) { if(icc_buf_ptr == NULL || icc_length == 0) { return FALSE; @@ -150,7 +150,7 @@ static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, FX_LPCBYTE icc_buf_ptr return FALSE; } FX_DWORD icc_data_length = JPEG_OVERHEAD_LEN + (icc_segment_num > 1 ? icc_segment_size : icc_length); - FX_LPBYTE icc_data = FX_Alloc(uint8_t, icc_data_length); + uint8_t* icc_data = FX_Alloc(uint8_t, icc_data_length); FXSYS_memcpy32(icc_data, "\x49\x43\x43\x5f\x50\x52\x4f\x46\x49\x4c\x45\x00", 12); icc_data[13] = (uint8_t)icc_segment_num; for (uint8_t i = 0; i < (icc_segment_num - 1); i++) { @@ -175,7 +175,7 @@ extern "C" { } }; #define JPEG_BLOCK_SIZE 1048576 -static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_STRSIZE& dest_size, int quality, FX_LPCBYTE icc_buf, FX_DWORD icc_length) +static void _JpegEncode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, FX_DWORD icc_length) { struct jpeg_error_mgr jerr; jerr.error_exit = _error_do_nothing; @@ -233,7 +233,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST } else { cinfo.in_color_space = JCS_CMYK; } - FX_LPBYTE line_buf = NULL; + uint8_t* line_buf = NULL; if (nComponents > 1) { line_buf = FX_Alloc2D(uint8_t, width, nComponents); } @@ -246,9 +246,9 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST JSAMPROW row_pointer[1]; JDIMENSION row; while (cinfo.next_scanline < cinfo.image_height) { - FX_LPCBYTE src_scan = pSource->GetScanline(cinfo.next_scanline); + const uint8_t* src_scan = pSource->GetScanline(cinfo.next_scanline); if (nComponents > 1) { - FX_LPBYTE dest_scan = line_buf; + uint8_t* dest_scan = line_buf; if (nComponents == 3) { for (int i = 0; i < width; i ++) { dest_scan[0] = src_scan[2]; @@ -264,7 +264,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST } row_pointer[0] = line_buf; } else { - row_pointer[0] = (FX_LPBYTE)src_scan; + row_pointer[0] = (uint8_t*)src_scan; } row = cinfo.next_scanline; jpeg_write_scanlines(&cinfo, row_pointer, 1); @@ -293,9 +293,9 @@ static void _JpegLoadAttribute(struct jpeg_decompress_struct* pInfo, CFX_DIBAttr pAttribute->m_wDPIUnit = pInfo->density_unit; } } -static FX_BOOL _JpegLoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& width, int& height, +static FX_BOOL _JpegLoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, - FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length) + uint8_t** icc_buf_ptr, FX_DWORD* icc_length) { _JpegScanSOI(src_buf, src_size); struct jpeg_decompress_struct cinfo; @@ -353,7 +353,7 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder public: CCodec_JpegDecoder(); ~CCodec_JpegDecoder(); - FX_BOOL Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, + FX_BOOL Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform, IFX_JpegProvider* pJP); virtual void Destroy() { @@ -361,15 +361,15 @@ public: } virtual void v_DownScale(int dest_width, int dest_height); virtual FX_BOOL v_Rewind(); - virtual FX_LPBYTE v_GetNextLine(); + virtual uint8_t* v_GetNextLine(); virtual FX_DWORD GetSrcOffset(); jmp_buf m_JmpBuf; struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; struct jpeg_source_mgr src; - FX_LPCBYTE m_SrcBuf; + const uint8_t* m_SrcBuf; FX_DWORD m_SrcSize; - FX_LPBYTE m_pScanlineBuf; + uint8_t* m_pScanlineBuf; FX_BOOL InitDecode(); FX_BOOL m_bInited, m_bStarted, m_bJpegTransform; protected: @@ -439,7 +439,7 @@ FX_BOOL CCodec_JpegDecoder::InitDecode() m_nDefaultScaleDenom = cinfo.scale_denom; return TRUE; } -FX_BOOL CCodec_JpegDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +FX_BOOL CCodec_JpegDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform, IFX_JpegProvider* pJP) { if (pJP) { @@ -462,8 +462,8 @@ FX_BOOL CCodec_JpegDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int wi src.resync_to_restart = _src_resync; m_bJpegTransform = ColorTransform; if(src_size > 1 && FXSYS_memcmp32(src_buf + src_size - 2, "\xFF\xD9", 2) != 0) { - ((FX_LPBYTE)src_buf)[src_size - 2] = 0xFF; - ((FX_LPBYTE)src_buf)[src_size - 1] = 0xD9; + ((uint8_t*)src_buf)[src_size - 2] = 0xFF; + ((uint8_t*)src_buf)[src_size - 1] = 0xD9; } m_OutputWidth = m_OrigWidth = width; m_OutputHeight = m_OrigHeight = height; @@ -543,7 +543,7 @@ FX_BOOL CCodec_JpegDecoder::v_Rewind() m_bStarted = TRUE; return TRUE; } -FX_LPBYTE CCodec_JpegDecoder::v_GetNextLine() +uint8_t* CCodec_JpegDecoder::v_GetNextLine() { if (m_pExtProvider) { return m_pExtProvider->GetNextLine(m_pExtContext); @@ -561,7 +561,7 @@ FX_DWORD CCodec_JpegDecoder::GetSrcOffset() } return (FX_DWORD)(m_SrcSize - src.bytes_in_buffer); } -ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, +ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform) { if (src_buf == NULL || src_size == 0) { @@ -574,9 +574,9 @@ ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(FX_LPCBYTE src_buf, FX_ } return pDecoder; } -FX_BOOL CCodec_JpegModule::LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& width, int& height, +FX_BOOL CCodec_JpegModule::LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, - FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length) + uint8_t** icc_buf_ptr, FX_DWORD* icc_length) { if (m_pExtProvider) { return m_pExtProvider->LoadInfo(src_buf, src_size, width, height, @@ -585,7 +585,7 @@ FX_BOOL CCodec_JpegModule::LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& } return _JpegLoadInfo(src_buf, src_size, width, height, num_components, bits_per_components, color_transform, icc_buf_ptr, icc_length); } -FX_BOOL CCodec_JpegModule::Encode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_STRSIZE& dest_size, int quality, FX_LPCBYTE icc_buf, FX_DWORD icc_length) +FX_BOOL CCodec_JpegModule::Encode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, FX_DWORD icc_length) { if (m_pExtProvider) { return m_pExtProvider->Encode(pSource, dest_buf, dest_size, quality, icc_buf, icc_length); @@ -736,7 +736,7 @@ FX_BOOL CCodec_JpegModule::ReadScanline(void* pContext, unsigned char* dest_buf) int nlines = jpeg_read_scanlines(&p->m_Info, &dest_buf, 1); return nlines == 1; } -FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr) +FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) { if (m_pExtProvider) { return m_pExtProvider->GetAvailInput(pContext, avail_buf_ptr); @@ -744,7 +744,7 @@ FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_p if(avail_buf_ptr != NULL) { *avail_buf_ptr = NULL; if(((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { - *avail_buf_ptr = (FX_LPBYTE)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte; + *avail_buf_ptr = (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte; } } return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp index 01faf67a30..312ce78759 100644 --- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -589,8 +589,8 @@ public: ~CJPX_Decoder(); FX_BOOL Init(const unsigned char* src_data, int src_size); void GetInfo(FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestream_nComps, FX_DWORD& output_nComps); - FX_BOOL Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateColor, FX_LPBYTE offsets); - FX_LPCBYTE m_SrcData; + FX_BOOL Decode(uint8_t* dest_buf, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets); + const uint8_t* m_SrcData; int m_SrcSize; opj_image_t *image; opj_codec_t* l_codec; @@ -702,10 +702,12 @@ void CJPX_Decoder::GetInfo(FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestre height = (FX_DWORD)image->y1; output_nComps = codestream_nComps = (FX_DWORD)image->numcomps; } -FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateColor, FX_LPBYTE offsets) +FX_BOOL CJPX_Decoder::Decode(uint8_t* dest_buf, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets) { int i, wid, hei, row, col, channel, src; - FX_LPBYTE pChannel, pScanline, pPixel; + uint8_t* pChannel; + uint8_t* pScanline; + uint8_t* pPixel; if(image->comps[0].w != image->x1 || image->comps[0].h != image->y1) { return FALSE; @@ -784,7 +786,7 @@ void initialize_sign_lut(); CCodec_JpxModule::CCodec_JpxModule() { } -void* CCodec_JpxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size , FX_BOOL useColorSpace) +void* CCodec_JpxModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size , FX_BOOL useColorSpace) { CJPX_Decoder* pDecoder = new CJPX_Decoder; pDecoder->m_useColorSpace = useColorSpace; @@ -794,13 +796,13 @@ void* CCodec_JpxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size , FX } return pDecoder; } -void CCodec_JpxModule::GetImageInfo(FX_LPVOID ctx, FX_DWORD& width, FX_DWORD& height, +void CCodec_JpxModule::GetImageInfo(void* ctx, FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestream_nComps, FX_DWORD& output_nComps) { CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; pDecoder->GetInfo(width, height, codestream_nComps, output_nComps); } -FX_BOOL CCodec_JpxModule::Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_BOOL bTranslateColor, FX_LPBYTE offsets) +FX_BOOL CCodec_JpxModule::Decode(void* ctx, uint8_t* dest_data, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets) { CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; return pDecoder->Decode(dest_data, pitch, bTranslateColor, offsets); diff --git a/core/src/fxcodec/codec/fx_codec_png.cpp b/core/src/fxcodec/codec/fx_codec_png.cpp index 8cb24ba2fa..55d66a3ccf 100644 --- a/core/src/fxcodec/codec/fx_codec_png.cpp +++ b/core/src/fxcodec/codec/fx_codec_png.cpp @@ -51,7 +51,7 @@ static void _png_load_bmp_attribute(png_structp png_ptr, png_infop info_ptr, CFX png_get_tIME(png_ptr, info_ptr, &t);
if (t) {
FXSYS_memset32(pAttribute->m_strTime, 0, sizeof(pAttribute->m_strTime));
- FXSYS_snprintf((FX_LPSTR)pAttribute->m_strTime, sizeof(pAttribute->m_strTime), "%4d:%2d:%2d %2d:%2d:%2d",
+ FXSYS_snprintf((FX_CHAR*)pAttribute->m_strTime, sizeof(pAttribute->m_strTime), "%4d:%2d:%2d %2d:%2d:%2d",
t->year, t->month, t->day, t->hour, t->minute, t->second);
pAttribute->m_strTime[sizeof(pAttribute->m_strTime) - 1] = 0;
bTime = 1;
@@ -60,7 +60,7 @@ static void _png_load_bmp_attribute(png_structp png_ptr, png_infop info_ptr, CFX #if defined(PNG_TEXT_SUPPORTED)
int i;
FX_DWORD len;
- FX_LPCSTR buf;
+ const FX_CHAR* buf;
int num_text;
png_textp text = NULL;
png_get_text(png_ptr, info_ptr, &text, &num_text);
@@ -77,7 +77,7 @@ static void _png_load_bmp_attribute(png_structp png_ptr, png_infop info_ptr, CFX buf = "Author";
if (!FXSYS_memcmp32(buf, text[i].key, FX_MIN(len, FXSYS_strlen(buf)))) {
pAttribute->m_strAuthor.Empty();
- pAttribute->m_strAuthor.Load((FX_LPBYTE)text[i].text, (FX_STRSIZE)text[i].text_length);
+ pAttribute->m_strAuthor.Load((uint8_t*)text[i].text, (FX_STRSIZE)text[i].text_length);
}
}
}
@@ -180,7 +180,7 @@ static void _png_get_row_func(png_structp png_ptr, png_bytep new_row, png_uint_3 return;
}
CCodec_PngModule* pModule = (CCodec_PngModule*)p->parent_ptr;
- FX_LPBYTE src_buf = NULL;
+ uint8_t* src_buf = NULL;
if(!pModule->AskScanlineBufCallback(p->child_ptr, row_num, src_buf)) {
png_error(png_ptr, "Ask Scanline buffer Callback Error");
}
@@ -234,7 +234,7 @@ void CCodec_PngModule::Finish(void* pContext) p->m_FreeFunc(p);
}
}
-FX_BOOL CCodec_PngModule::Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_DIBAttribute* pAttribute)
+FX_BOOL CCodec_PngModule::Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size, CFX_DIBAttribute* pAttribute)
{
FXPNG_Context* p = (FXPNG_Context*)pContext;
if(setjmp(png_jmpbuf(p->png_ptr))) {
@@ -243,6 +243,6 @@ FX_BOOL CCodec_PngModule::Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src }
return FALSE;
}
- png_process_data(p->png_ptr, p->info_ptr, (FX_LPBYTE)src_buf, src_size);
+ png_process_data(p->png_ptr, p->info_ptr, (uint8_t*)src_buf, src_size);
return TRUE;
}
diff --git a/core/src/fxcodec/codec/fx_codec_progress.cpp b/core/src/fxcodec/codec/fx_codec_progress.cpp index d6ef06311c..da64eed42f 100644 --- a/core/src/fxcodec/codec/fx_codec_progress.cpp +++ b/core/src/fxcodec/codec/fx_codec_progress.cpp @@ -350,7 +350,7 @@ FX_BOOL CCodec_ProgressiveDecoder::PngReadHeaderFunc(void* pModule, int width, i *gamma = FXCODEC_PNG_GAMMA;
return TRUE;
}
-FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line, FX_LPBYTE& src_buf)
+FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line, uint8_t*& src_buf)
{
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
CFX_DIBitmap* pDIBitmap = pCodec->m_pDeviceBitmap;
@@ -361,8 +361,8 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line if(line >= pCodec->m_clipBox.top && line < pCodec->m_clipBox.bottom) {
double scale_y = (double)pCodec->m_sizeY / (double)pCodec->m_clipBox.Height();
int32_t row = (int32_t)((line - pCodec->m_clipBox.top) * scale_y) + pCodec->m_startY;
- FX_LPBYTE src_scan = (FX_LPBYTE)pDIBitmap->GetScanline(row);
- FX_LPBYTE des_scan = pCodec->m_pDecodeBuf;
+ uint8_t* src_scan = (uint8_t*)pDIBitmap->GetScanline(row);
+ uint8_t* des_scan = pCodec->m_pDecodeBuf;
src_buf = pCodec->m_pDecodeBuf;
int32_t src_Bpp = pDIBitmap->GetBPP() >> 3;
int32_t des_Bpp = (pCodec->m_SrcFormat & 0xff) >> 3;
@@ -393,11 +393,11 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line case FXDIB_Rgb:
case FXDIB_Rgb32: {
FX_DWORD des_b = 0, des_g = 0, des_r = 0;
- FX_LPCBYTE p = src_scan + src_col * src_Bpp;
+ const uint8_t* p = src_scan + src_col * src_Bpp;
des_b += pPixelWeights->m_Weights[0] * (*p++);
des_g += pPixelWeights->m_Weights[0] * (*p++);
des_r += pPixelWeights->m_Weights[0] * (*p);
- FX_LPBYTE pDes = &des_scan[pPixelWeights->m_SrcStart * des_Bpp];
+ uint8_t* pDes = &des_scan[pPixelWeights->m_SrcStart * des_Bpp];
*pDes++ = (uint8_t)((des_b) >> 16);
*pDes++ = (uint8_t)((des_g) >> 16);
*pDes = (uint8_t)((des_r) >> 16);
@@ -405,11 +405,11 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line break;
case FXDIB_Argb: {
FX_DWORD des_r = 0, des_g = 0, des_b = 0;
- FX_LPCBYTE p = src_scan + src_col * src_Bpp;
+ const uint8_t* p = src_scan + src_col * src_Bpp;
des_b += pPixelWeights->m_Weights[0] * (*p++);
des_g += pPixelWeights->m_Weights[0] * (*p++);
des_r += pPixelWeights->m_Weights[0] * (*p++);
- FX_LPBYTE pDes = &des_scan[pPixelWeights->m_SrcStart * des_Bpp];
+ uint8_t* pDes = &des_scan[pPixelWeights->m_SrcStart * des_Bpp];
*pDes++ = (uint8_t)((des_b) >> 16);
*pDes++ = (uint8_t)((des_g) >> 16);
*pDes++ = (uint8_t)((des_r) >> 16);
@@ -423,9 +423,9 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line }
return TRUE;
}
-void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, FX_LPBYTE src_scan, FXCodec_Format src_format)
+void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, uint8_t* src_scan, FXCodec_Format src_format)
{
- FX_LPBYTE des_scan = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_line);
+ uint8_t* des_scan = (uint8_t*)pDeviceBitmap->GetScanline(des_line);
int32_t src_Bpp = (m_SrcFormat & 0xff) >> 3;
int32_t des_Bpp = pDeviceBitmap->GetBPP() >> 3;
int32_t src_left = m_clipBox.left;
@@ -453,7 +453,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBi case FXDIB_Rgb:
case FXDIB_Rgb32: {
FX_DWORD des_b = 0, des_g = 0, des_r = 0;
- FX_LPCBYTE p = src_scan;
+ const uint8_t* p = src_scan;
p = src_scan + pPixelWeights->m_SrcStart * src_Bpp;
des_b += pPixelWeights->m_Weights[0] * (*p++);
des_g += pPixelWeights->m_Weights[0] * (*p++);
@@ -470,7 +470,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBi break;
case FXDIB_Argb: {
FX_DWORD des_a = 0, des_b = 0, des_g = 0, des_r = 0;
- FX_LPCBYTE p = src_scan;
+ const uint8_t* p = src_scan;
p = src_scan + pPixelWeights->m_SrcStart * src_Bpp;
des_b += pPixelWeights->m_Weights[0] * (*p++);
des_g += pPixelWeights->m_Weights[0] * (*p++);
@@ -560,7 +560,7 @@ void CCodec_ProgressiveDecoder::GifRecordCurrentPositionCallback(void* pModule, FX_DWORD remain_size = pCodec->m_pCodecMgr->GetGifModule()->GetAvailInput(pCodec->m_pGifContext);
cur_pos = pCodec->m_offSet - remain_size;
}
-FX_LPBYTE CCodec_ProgressiveDecoder::GifAskLocalPaletteBufCallback(void* pModule, int32_t frame_num, int32_t pal_size)
+uint8_t* CCodec_ProgressiveDecoder::GifAskLocalPaletteBufCallback(void* pModule, int32_t frame_num, int32_t pal_size)
{
return FX_Alloc(uint8_t, pal_size);
}
@@ -575,9 +575,9 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(void* pModu if(!pCodec->GifReadMoreData(pCodec->m_pCodecMgr->GetGifModule(), error_status)) {
return FALSE;
}
- FX_LPBYTE pPalette = NULL;
+ uint8_t* pPalette = NULL;
if(pal_num != 0 && pal_ptr) {
- pPalette = (FX_LPBYTE)pal_ptr;
+ pPalette = (uint8_t*)pal_ptr;
} else {
pal_num = pCodec->m_GifPltNumber;
pPalette = pCodec->m_pGifPalette;
@@ -617,7 +617,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(void* pModu int Bpp = pDevice->GetBPP() / 8;
FX_ARGB argb = pCodec->m_pSrcPalette[pal_index];
for (int row = 0; row < sizeY; row ++) {
- FX_LPBYTE pScanline = (FX_LPBYTE)pDevice->GetScanline(row + startY) + startX * Bpp;
+ uint8_t* pScanline = (uint8_t*)pDevice->GetScanline(row + startY) + startX * Bpp;
switch(pCodec->m_TransMethod) {
case 3: {
uint8_t gray = FXRGB2GRAY(FXARGB_R(argb), FXARGB_G(argb), FXARGB_B(argb));
@@ -644,14 +644,14 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(void* pModu }
return TRUE;
}
-void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, int32_t row_num, FX_LPBYTE row_buf)
+void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, int32_t row_num, uint8_t* row_buf)
{
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
CFX_DIBitmap* pDIBitmap = pCodec->m_pDeviceBitmap;
ASSERT(pDIBitmap != NULL);
int32_t img_width = pCodec->m_GifFrameRect.Width();
if (!pDIBitmap->HasAlpha()) {
- FX_LPBYTE byte_ptr = row_buf;
+ uint8_t* byte_ptr = row_buf;
for (int i = 0; i < img_width; i++ ) {
if(*byte_ptr == pCodec->m_GifTransIndex) {
*byte_ptr = pCodec->m_GifBgIndex;
@@ -690,10 +690,10 @@ void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, int32_t r int des_Bpp = pDIBitmap->GetBPP() >> 3;
FX_DWORD des_ScanOffet = pCodec->m_startX * des_Bpp;
if(des_row + (int)scale_y >= des_bottom - 1) {
- FX_LPBYTE scan_src = (FX_LPBYTE)pDIBitmap->GetScanline(des_row) + des_ScanOffet;
+ uint8_t* scan_src = (uint8_t*)pDIBitmap->GetScanline(des_row) + des_ScanOffet;
int cur_row = des_row;
while (++cur_row < des_bottom) {
- FX_LPBYTE scan_des = (FX_LPBYTE)pDIBitmap->GetScanline(cur_row) + des_ScanOffet;
+ uint8_t* scan_des = (uint8_t*)pDIBitmap->GetScanline(cur_row) + des_ScanOffet;
FX_DWORD size = pCodec->m_sizeX * des_Bpp;
FXSYS_memcpy32(scan_des, scan_src, size);
}
@@ -714,10 +714,10 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceB des_row_1 = des_top;
}
for (; des_row_1 < des_row; des_row_1++) {
- FX_LPBYTE scan_des = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row_1) + des_ScanOffet;
+ uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row_1) + des_ScanOffet;
PixelWeight* pWeight = m_WeightVert.GetPixelWeight(des_row_1 - des_top);
- FX_LPCBYTE scan_src1 = pDeviceBitmap->GetScanline(pWeight->m_SrcStart + des_top) + des_ScanOffet;
- FX_LPCBYTE scan_src2 = pDeviceBitmap->GetScanline(pWeight->m_SrcEnd + des_top) + des_ScanOffet;
+ const uint8_t* scan_src1 = pDeviceBitmap->GetScanline(pWeight->m_SrcStart + des_top) + des_ScanOffet;
+ const uint8_t* scan_src2 = pDeviceBitmap->GetScanline(pWeight->m_SrcEnd + des_top) + des_ScanOffet;
for (int des_col = 0; des_col < m_sizeX; des_col++) {
switch(pDeviceBitmap->GetFormat()) {
case FXDIB_Invalid:
@@ -823,7 +823,7 @@ FX_BOOL CCodec_ProgressiveDecoder::BmpInputImagePositionBufCallback(void* pModul }
return TRUE;
}
-void CCodec_ProgressiveDecoder::BmpReadScanlineCallback(void* pModule, int32_t row_num, FX_LPBYTE row_buf)
+void CCodec_ProgressiveDecoder::BmpReadScanlineCallback(void* pModule, int32_t row_num, uint8_t* row_buf)
{
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
CFX_DIBitmap* pDIBitmap = pCodec->m_pDeviceBitmap;
@@ -860,19 +860,19 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, doub int des_bottom = m_startY + m_sizeY;
int des_row_1 = des_row + int(scale_y);
if(des_row_1 >= des_bottom - 1) {
- FX_LPBYTE scan_src = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
+ uint8_t* scan_src = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
while (++des_row < des_bottom) {
- FX_LPBYTE scan_des = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
+ uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
FX_DWORD size = m_sizeX * des_Bpp;
FXSYS_memcpy32(scan_des, scan_src, size);
}
return;
}
for (; des_row_1 > des_row; des_row_1--) {
- FX_LPBYTE scan_des = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row_1) + des_ScanOffet;
+ uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row_1) + des_ScanOffet;
PixelWeight* pWeight = m_WeightVert.GetPixelWeight(des_row_1 - des_top);
- FX_LPCBYTE scan_src1 = pDeviceBitmap->GetScanline(pWeight->m_SrcStart + des_top) + des_ScanOffet;
- FX_LPCBYTE scan_src2 = pDeviceBitmap->GetScanline(pWeight->m_SrcEnd + des_top) + des_ScanOffet;
+ const uint8_t* scan_src1 = pDeviceBitmap->GetScanline(pWeight->m_SrcStart + des_top) + des_ScanOffet;
+ const uint8_t* scan_src2 = pDeviceBitmap->GetScanline(pWeight->m_SrcEnd + des_top) + des_ScanOffet;
for (int des_col = 0; des_col < m_sizeX; des_col++) {
switch(pDeviceBitmap->GetFormat()) {
case FXDIB_Invalid:
@@ -1377,7 +1377,7 @@ void CCodec_ProgressiveDecoder::GetTransMethod(FXDIB_Format des_format, FXCodec_ m_TransMethod = -1;
}
}
-void _RGB2BGR(FX_LPBYTE buffer, int width = 1)
+void _RGB2BGR(uint8_t* buffer, int width = 1)
{
if (buffer && width > 0) {
uint8_t temp;
@@ -1390,11 +1390,11 @@ void _RGB2BGR(FX_LPBYTE buffer, int width = 1) }
}
}
-void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, int des_line, FX_LPBYTE src_scan, FXCodec_Format src_format)
+void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, int des_line, uint8_t* src_scan, FXCodec_Format src_format)
{
int src_left = m_clipBox.left;
int des_left = m_startX;
- FX_LPBYTE des_scan = pDeviceBitmap->GetBuffer() + des_line * pDeviceBitmap->GetPitch();
+ uint8_t* des_scan = pDeviceBitmap->GetBuffer() + des_line * pDeviceBitmap->GetPitch();
int src_bpp = src_format & 0xff;
int des_bpp = pDeviceBitmap->GetBPP();
int src_Bpp = src_bpp >> 3;
@@ -1435,7 +1435,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in FX_DWORD des_b = 0, des_g = 0, des_r = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
- FX_LPCBYTE src_pixel = src_scan + j * src_Bpp;
+ const uint8_t* src_pixel = src_scan + j * src_Bpp;
des_b += pixel_weight * (*src_pixel++);
des_g += pixel_weight * (*src_pixel++);
des_r += pixel_weight * (*src_pixel);
@@ -1447,7 +1447,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in FX_DWORD des_b = 0, des_g = 0, des_r = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
- FX_LPCBYTE src_pixel = src_scan + j * src_Bpp;
+ const uint8_t* src_pixel = src_scan + j * src_Bpp;
uint8_t src_b = 0, src_g = 0, src_r = 0;
AdobeCMYK_to_sRGB1(255 - src_pixel[0], 255 - src_pixel[1], 255 - src_pixel[2], 255 - src_pixel[3],
src_r, src_g, src_b);
@@ -1520,7 +1520,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in FX_DWORD des_b = 0, des_g = 0, des_r = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
- FX_LPCBYTE src_pixel = src_scan + j * src_Bpp;
+ const uint8_t* src_pixel = src_scan + j * src_Bpp;
des_b += pixel_weight * (*src_pixel++);
des_g += pixel_weight * (*src_pixel++);
des_r += pixel_weight * (*src_pixel);
@@ -1535,7 +1535,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in FX_DWORD des_b = 0, des_g = 0, des_r = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
- FX_LPCBYTE src_pixel = src_scan + j * src_Bpp;
+ const uint8_t* src_pixel = src_scan + j * src_Bpp;
uint8_t src_b = 0, src_g = 0, src_r = 0;
AdobeCMYK_to_sRGB1(255 - src_pixel[0], 255 - src_pixel[1], 255 - src_pixel[2], 255 - src_pixel[3],
src_r, src_g, src_b);
@@ -1553,7 +1553,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in FX_DWORD des_alpha = 0, des_r = 0, des_g = 0, des_b = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
- FX_LPCBYTE src_pixel = src_scan + j * src_Bpp;
+ const uint8_t* src_pixel = src_scan + j * src_Bpp;
pixel_weight = pixel_weight * src_pixel[3] / 255;
des_b += pixel_weight * (*src_pixel++);
des_g += pixel_weight * (*src_pixel++);
@@ -1581,9 +1581,9 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double if(des_row_1 < des_top) {
int des_bottom = des_top + m_sizeY;
if(des_row + (int)scale_y >= des_bottom - 1) {
- FX_LPBYTE scan_src = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
+ uint8_t* scan_src = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
while (++des_row < des_bottom) {
- FX_LPBYTE scan_des = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
+ uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
FX_DWORD size = m_sizeX * des_Bpp;
FXSYS_memcpy32(scan_des, scan_src, size);
}
@@ -1591,10 +1591,10 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double return;
}
for (; des_row_1 < des_row; des_row_1++) {
- FX_LPBYTE scan_des = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row_1) + des_ScanOffet;
+ uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row_1) + des_ScanOffet;
PixelWeight* pWeight = m_WeightVert.GetPixelWeight(des_row_1 - des_top);
- FX_LPCBYTE scan_src1 = pDeviceBitmap->GetScanline(pWeight->m_SrcStart + des_top) + des_ScanOffet;
- FX_LPCBYTE scan_src2 = pDeviceBitmap->GetScanline(pWeight->m_SrcEnd + des_top) + des_ScanOffet;
+ const uint8_t* scan_src1 = pDeviceBitmap->GetScanline(pWeight->m_SrcStart + des_top) + des_ScanOffet;
+ const uint8_t* scan_src2 = pDeviceBitmap->GetScanline(pWeight->m_SrcEnd + des_top) + des_ScanOffet;
for (int des_col = 0; des_col < m_sizeX; des_col++) {
switch(pDeviceBitmap->GetFormat()) {
case FXDIB_Invalid:
@@ -1652,9 +1652,9 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double }
int des_bottom = des_top + m_sizeY;
if(des_row + (int)scale_y >= des_bottom - 1) {
- FX_LPBYTE scan_src = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
+ uint8_t* scan_src = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
while (++des_row < des_bottom) {
- FX_LPBYTE scan_des = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
+ uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
FX_DWORD size = m_sizeX * des_Bpp;
FXSYS_memcpy32(scan_des, scan_src, size);
}
@@ -1663,18 +1663,18 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double }
int multiple = (int)FXSYS_ceil((FX_FLOAT)scale_y - 1);
if(multiple > 0) {
- FX_LPBYTE scan_src = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
+ uint8_t* scan_src = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
for (int i = 1; i <= multiple; i++) {
if(des_row + i >= m_startY + m_sizeY) {
return;
}
- FX_LPBYTE scan_des = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row + i) + des_ScanOffet;
+ uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row + i) + des_ScanOffet;
FX_DWORD size = m_sizeX * des_Bpp;
FXSYS_memcpy32(scan_des, scan_src, size);
}
}
}
-void CCodec_ProgressiveDecoder::Resample(CFX_DIBitmap* pDeviceBitmap, int32_t src_line, FX_LPBYTE src_scan, FXCodec_Format src_format)
+void CCodec_ProgressiveDecoder::Resample(CFX_DIBitmap* pDeviceBitmap, int32_t src_line, uint8_t* src_scan, FXCodec_Format src_format)
{
int src_top = m_clipBox.top;
int des_top = m_startY;
@@ -2166,8 +2166,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) case FXDIB_8bppRgb:
case FXDIB_8bppMask: {
for (int32_t row = 0; row < pClipBitmap->GetHeight(); row++) {
- FX_LPBYTE src_line = (FX_LPBYTE)pClipBitmap->GetScanline(row);
- FX_LPBYTE des_line = (FX_LPBYTE)pFormatBitmap->GetScanline(row);
+ uint8_t* src_line = (uint8_t*)pClipBitmap->GetScanline(row);
+ uint8_t* des_line = (uint8_t*)pFormatBitmap->GetScanline(row);
for (int32_t col = 0; col < pClipBitmap->GetWidth(); col++) {
uint8_t _a = 255 - src_line[3];
uint8_t b = (src_line[0] * src_line[3] + 0xFF * _a) / 255;
@@ -2183,8 +2183,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) case FXDIB_Rgb32: {
int32_t desBpp = (m_pDeviceBitmap->GetFormat() == FXDIB_Rgb) ? 3 : 4;
for (int32_t row = 0; row < pClipBitmap->GetHeight(); row++) {
- FX_LPBYTE src_line = (FX_LPBYTE)pClipBitmap->GetScanline(row);
- FX_LPBYTE des_line = (FX_LPBYTE)pFormatBitmap->GetScanline(row);
+ uint8_t* src_line = (uint8_t*)pClipBitmap->GetScanline(row);
+ uint8_t* des_line = (uint8_t*)pFormatBitmap->GetScanline(row);
for (int32_t col = 0; col < pClipBitmap->GetWidth(); col++) {
uint8_t _a = 255 - src_line[3];
uint8_t b = (src_line[0] * src_line[3] + 0xFF * _a) / 255;
diff --git a/core/src/fxcodec/codec/fx_codec_progress.h b/core/src/fxcodec/codec/fx_codec_progress.h index e5a4e53376..8a32f97be4 100644 --- a/core/src/fxcodec/codec/fx_codec_progress.h +++ b/core/src/fxcodec/codec/fx_codec_progress.h @@ -38,7 +38,7 @@ public: }
int m_DestMin, m_ItemSize;
- FX_LPBYTE m_pWeightTables;
+ uint8_t* m_pWeightTables;
};
class CFXCODEC_HorzTable
{
@@ -61,7 +61,7 @@ public: }
int m_ItemSize;
- FX_LPBYTE m_pWeightTables;
+ uint8_t* m_pWeightTables;
};
class CFXCODEC_VertTable
{
@@ -82,7 +82,7 @@ public: return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize);
}
int m_ItemSize;
- FX_LPBYTE m_pWeightTables;
+ uint8_t* m_pWeightTables;
};
enum FXCodec_Format {
FXCodec_Invalid = 0,
@@ -137,41 +137,41 @@ protected: FX_BOOL DetectImageType(FXCODEC_IMAGE_TYPE imageType, CFX_DIBAttribute* pAttribute = NULL);
void GetDownScale(int& down_scale);
void GetTransMethod(FXDIB_Format des_format, FXCodec_Format src_format);
- void ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
- void Resample(CFX_DIBitmap* pDeviceBitmap, int32_t src_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
+ void ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, uint8_t* src_scan, FXCodec_Format src_format);
+ void Resample(CFX_DIBitmap* pDeviceBitmap, int32_t src_line, uint8_t* src_scan, FXCodec_Format src_format);
void ResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
FX_BOOL JpegReadMoreData(ICodec_JpegModule* pJpegModule, FXCODEC_STATUS& err_status);
static FX_BOOL PngReadHeaderFunc(void* pModule, int width, int height, int bpc, int pass, int* color_type, double* gamma);
- static FX_BOOL PngAskScanlineBufFunc(void* pModule, int line, FX_LPBYTE& src_buf);
+ static FX_BOOL PngAskScanlineBufFunc(void* pModule, int line, uint8_t*& src_buf);
static void PngFillScanlineBufCompletedFunc(void* pModule, int pass, int line);
- void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
+ void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, uint8_t* src_scan, FXCodec_Format src_format);
FX_BOOL GifReadMoreData(ICodec_GifModule* pGifModule, FXCODEC_STATUS& err_status);
static void GifRecordCurrentPositionCallback(void* pModule, FX_DWORD& cur_pos);
- static FX_LPBYTE GifAskLocalPaletteBufCallback(void* pModule, int32_t frame_num, int32_t pal_size);
+ static uint8_t* GifAskLocalPaletteBufCallback(void* pModule, int32_t frame_num, int32_t pal_size);
static FX_BOOL GifInputRecordPositionBufCallback(void* pModule, FX_DWORD rcd_pos, const FX_RECT& img_rc,
int32_t pal_num, void* pal_ptr,
int32_t delay_time, FX_BOOL user_input,
int32_t trans_index, int32_t disposal_method, FX_BOOL interlace);
- static void GifReadScanlineCallback(void* pModule, int32_t row_num, FX_LPBYTE row_buf);
+ static void GifReadScanlineCallback(void* pModule, int32_t row_num, uint8_t* row_buf);
void GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
FX_BOOL BmpReadMoreData(ICodec_BmpModule* pBmpModule, FXCODEC_STATUS& err_status);
static FX_BOOL BmpInputImagePositionBufCallback(void* pModule, FX_DWORD rcd_pos);
- static void BmpReadScanlineCallback(void* pModule, int32_t row_num, FX_LPBYTE row_buf);
+ static void BmpReadScanlineCallback(void* pModule, int32_t row_num, uint8_t* row_buf);
void ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
public:
IFX_FileRead* m_pFile;
CCodec_ModuleMgr* m_pCodecMgr;
- FX_LPVOID m_pJpegContext;
- FX_LPVOID m_pPngContext;
- FX_LPVOID m_pGifContext;
- FX_LPVOID m_pBmpContext;
- FX_LPVOID m_pTiffContext;
+ void* m_pJpegContext;
+ void* m_pPngContext;
+ void* m_pGifContext;
+ void* m_pBmpContext;
+ void* m_pTiffContext;
FXCODEC_IMAGE_TYPE m_imagType;
FX_DWORD m_offSet;
- FX_LPBYTE m_pSrcBuf;
+ uint8_t* m_pSrcBuf;
FX_DWORD m_SrcSize;
- FX_LPBYTE m_pDecodeBuf;
+ uint8_t* m_pDecodeBuf;
int m_ScanlineSize;
CFX_DIBitmap* m_pDeviceBitmap;
FX_BOOL m_bInterpol;
@@ -196,7 +196,7 @@ public: int m_FrameNumber;
int m_FrameCur;
int m_GifBgIndex;
- FX_LPBYTE m_pGifPalette;
+ uint8_t* m_pGifPalette;
int32_t m_GifPltNumber;
int m_GifTransIndex;
FX_RECT m_GifFrameRect;
diff --git a/core/src/fxcodec/codec/fx_codec_tiff.cpp b/core/src/fxcodec/codec/fx_codec_tiff.cpp index 8e9dd10f29..d057ff8020 100644 --- a/core/src/fxcodec/codec/fx_codec_tiff.cpp +++ b/core/src/fxcodec/codec/fx_codec_tiff.cpp @@ -223,7 +223,7 @@ void CCodec_TiffContext::GetFrames(int32_t& frames) (key) = NULL;
#define TIFF_EXIF_GETSTRINGINFO(key, tag) {\
FX_DWORD size = 0;\
- FX_LPBYTE buf = NULL;\
+ uint8_t* buf = NULL;\
TIFFGetField(tif_ctx,tag,&size, &buf);\
if (size && buf) {\
(key) = FX_Alloc(uint8_t,size);\
@@ -234,7 +234,7 @@ void CCodec_TiffContext::GetFrames(int32_t& frames) template <class T>
static FX_BOOL Tiff_Exif_GetInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttributeExif* pExif)
{
- FX_LPBYTE key = NULL;
+ uint8_t* key = NULL;
T val = (T)0;
TIFFGetField(tif_ctx, tag, &val);
if (val) {
@@ -251,8 +251,8 @@ static FX_BOOL Tiff_Exif_GetInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttributeExif }
static void Tiff_Exif_GetStringInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttributeExif* pExif)
{
- FX_LPSTR buf = NULL;
- FX_LPBYTE key = NULL;
+ FX_CHAR* buf = NULL;
+ uint8_t* key = NULL;
TIFFGetField(tif_ctx, tag, &buf);
if (buf) {
int32_t size = (int32_t)FXSYS_strlen(buf);
@@ -272,7 +272,7 @@ FX_BOOL CCodec_TiffContext::LoadFrameInfo(int32_t frame, FX_DWORD& width, FX_DWO }
FX_WORD tif_cs;
FX_DWORD tif_icc_size = 0;
- FX_LPBYTE tif_icc_buf = NULL;
+ uint8_t* tif_icc_buf = NULL;
FX_WORD tif_bpc = 0;
FX_WORD tif_cps;
FX_DWORD tif_rps;
@@ -313,7 +313,7 @@ FX_BOOL CCodec_TiffContext::LoadFrameInfo(int32_t frame, FX_DWORD& width, FX_DWO }
return TRUE;
}
-void _TiffBGRA2RGBA(FX_LPBYTE pBuf, int32_t pixel, int32_t spp)
+void _TiffBGRA2RGBA(uint8_t* pBuf, int32_t pixel, int32_t spp)
{
register uint8_t tmp;
for (int32_t n = 0; n < pixel; n++) {
@@ -383,12 +383,12 @@ FX_BOOL CCodec_TiffContext::Decode1bppRGB(CFX_DIBitmap* pDIBitmap, int32_t heigh }
SetPalette(pDIBitmap, bps);
int32_t size = (int32_t)TIFFScanlineSize(tif_ctx);
- FX_LPBYTE buf = (FX_LPBYTE)_TIFFmalloc(size);
+ uint8_t* buf = (uint8_t*)_TIFFmalloc(size);
if (buf == NULL) {
TIFFError(TIFFFileName(tif_ctx), "No space for scanline buffer");
return FALSE;
}
- FX_LPBYTE bitMapbuffer = (FX_LPBYTE)pDIBitmap->GetBuffer();
+ uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer();
FX_DWORD pitch = pDIBitmap->GetPitch();
for(int32_t row = 0; row < height; row++) {
TIFFReadScanline(tif_ctx, buf, row, 0);
@@ -406,12 +406,12 @@ FX_BOOL CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap, int32_t heigh }
SetPalette(pDIBitmap, bps);
int32_t size = (int32_t)TIFFScanlineSize(tif_ctx);
- FX_LPBYTE buf = (FX_LPBYTE)_TIFFmalloc(size);
+ uint8_t* buf = (uint8_t*)_TIFFmalloc(size);
if (buf == NULL) {
TIFFError(TIFFFileName(tif_ctx), "No space for scanline buffer");
return FALSE;
}
- FX_LPBYTE bitMapbuffer = (FX_LPBYTE)pDIBitmap->GetBuffer();
+ uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer();
FX_DWORD pitch = pDIBitmap->GetPitch();
for(int32_t row = 0; row < height; row++) {
TIFFReadScanline(tif_ctx, buf, row, 0);
@@ -436,12 +436,12 @@ FX_BOOL CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap, int32_t heig return FALSE;
}
int32_t size = (int32_t)TIFFScanlineSize(tif_ctx);
- FX_LPBYTE buf = (FX_LPBYTE)_TIFFmalloc(size);
+ uint8_t* buf = (uint8_t*)_TIFFmalloc(size);
if (buf == NULL) {
TIFFError(TIFFFileName(tif_ctx), "No space for scanline buffer");
return FALSE;
}
- FX_LPBYTE bitMapbuffer = (FX_LPBYTE)pDIBitmap->GetBuffer();
+ uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer();
FX_DWORD pitch = pDIBitmap->GetPitch();
for(int32_t row = 0; row < height; row++) {
TIFFReadScanline(tif_ctx, buf, row, 0);
@@ -471,7 +471,7 @@ FX_BOOL CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) if(TIFFReadRGBAImageOriented(tif_ctx, img_wid, img_hei,
(uint32*)pDIBitmap->GetBuffer(), rotation, 1)) {
for (FX_DWORD row = 0; row < img_hei; row++) {
- FX_LPBYTE row_buf = (FX_LPBYTE)pDIBitmap->GetScanline(row);
+ uint8_t* row_buf = (uint8_t*)pDIBitmap->GetScanline(row);
_TiffBGRA2RGBA(row_buf, img_wid, 4);
}
return TRUE;
@@ -490,7 +490,7 @@ FX_BOOL CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) }
return FALSE;
}
-FX_LPVOID CCodec_TiffModule::CreateDecoder(IFX_FileRead* file_ptr)
+void* CCodec_TiffModule::CreateDecoder(IFX_FileRead* file_ptr)
{
CCodec_TiffContext* pDecoder = new CCodec_TiffContext;
if (!pDecoder->InitDecoder(file_ptr)) {
@@ -499,12 +499,12 @@ FX_LPVOID CCodec_TiffModule::CreateDecoder(IFX_FileRead* file_ptr) }
return pDecoder;
}
-void CCodec_TiffModule::GetFrames(FX_LPVOID ctx, int32_t& frames)
+void CCodec_TiffModule::GetFrames(void* ctx, int32_t& frames)
{
CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx;
pDecoder->GetFrames(frames);
}
-FX_BOOL CCodec_TiffModule::LoadFrameInfo(FX_LPVOID ctx, int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute)
+FX_BOOL CCodec_TiffModule::LoadFrameInfo(void* ctx, int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute)
{
CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx;
return pDecoder->LoadFrameInfo(frame, width, height, comps, bpc, pAttribute);
diff --git a/core/src/fxcodec/jbig2/JBig2_Define.h b/core/src/fxcodec/jbig2/JBig2_Define.h index 46c6e2b532..cc1e3904bd 100644 --- a/core/src/fxcodec/jbig2/JBig2_Define.h +++ b/core/src/fxcodec/jbig2/JBig2_Define.h @@ -24,7 +24,7 @@ typedef struct { int32_t code; } JBig2HuffmanCode; extern "C" { - void _FaxG4Decode(void *pModule, FX_LPCBYTE src_buf, FX_DWORD src_size, int* pbitpos, FX_LPBYTE dest_buf, int width, int height, int pitch = 0); + void _FaxG4Decode(void *pModule, const uint8_t* src_buf, FX_DWORD src_size, int* pbitpos, uint8_t* dest_buf, int width, int height, int pitch = 0); }; #define JBIG2_MAX_REFERRED_SEGMENT_COUNT 64 #define JBIG2_MAX_EXPORT_SYSMBOLS 65535 diff --git a/core/src/fxcodec/jbig2/JBig2_Module.h b/core/src/fxcodec/jbig2/JBig2_Module.h index aef31bb49f..5a96f4395e 100644 --- a/core/src/fxcodec/jbig2/JBig2_Module.h +++ b/core/src/fxcodec/jbig2/JBig2_Module.h @@ -18,16 +18,16 @@ public: virtual void *JBig2_Malloc3(FX_DWORD num, FX_DWORD dwSize, FX_DWORD dwSize2) = 0; - virtual void *JBig2_Realloc(FX_LPVOID pMem, FX_DWORD dwSize) = 0; + virtual void *JBig2_Realloc(void* pMem, FX_DWORD dwSize) = 0; - virtual void JBig2_Free(FX_LPVOID pMem) = 0; + virtual void JBig2_Free(void* pMem) = 0; virtual void JBig2_Assert(int32_t nExpression) {}; - virtual void JBig2_Error(FX_LPCSTR format, ...) {}; + virtual void JBig2_Error(const FX_CHAR* format, ...) {}; - virtual void JBig2_Warn(FX_LPCSTR format, ...) {}; + virtual void JBig2_Warn(const FX_CHAR* format, ...) {}; - virtual void JBig2_Log(FX_LPCSTR format, ...) {}; + virtual void JBig2_Log(const FX_CHAR* format, ...) {}; }; #endif diff --git a/core/src/fxcodec/jbig2/JBig2_Object.cpp b/core/src/fxcodec/jbig2/JBig2_Object.cpp index 4bb00b897b..1429a91644 100644 --- a/core/src/fxcodec/jbig2/JBig2_Object.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Object.cpp @@ -6,14 +6,14 @@ #include "JBig2_Object.h" #include "JBig2_Module.h" -void *CJBig2_Object::operator new(size_t size, CJBig2_Module *pModule, FX_LPCSTR filename, int line) +void *CJBig2_Object::operator new(size_t size, CJBig2_Module *pModule, const FX_CHAR* filename, int line) { CJBig2_Object *p; p = (CJBig2_Object *)pModule->JBig2_Malloc((FX_DWORD)size); p->m_pModule = pModule; return p; } -void CJBig2_Object::operator delete(void *p, CJBig2_Module *pModule, FX_LPCSTR filename, int line) +void CJBig2_Object::operator delete(void *p, CJBig2_Module *pModule, const FX_CHAR* filename, int line) { pModule->JBig2_Free(p); } @@ -33,7 +33,7 @@ void CJBig2_Object::operator delete(void *p, CJBig2_Module *pModule) pModule->JBig2_Free(p); } void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size, - FX_LPCSTR filename, int line) + const FX_CHAR* filename, int line) { void *p; uint8_t *pCur, *pEnd; @@ -46,7 +46,7 @@ void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t return p; } void CJBig2_Object::operator delete[](void *p, CJBig2_Module *pModule, size_t unit_size, - FX_LPCSTR filename, int line) + const FX_CHAR* filename, int line) { pModule->JBig2_Free(p); } diff --git a/core/src/fxcodec/jbig2/JBig2_Object.h b/core/src/fxcodec/jbig2/JBig2_Object.h index 23eecbf171..150a8e7e99 100644 --- a/core/src/fxcodec/jbig2/JBig2_Object.h +++ b/core/src/fxcodec/jbig2/JBig2_Object.h @@ -13,9 +13,9 @@ class CJBig2_Object { public: - void *operator new(size_t size, CJBig2_Module *pModule, FX_LPCSTR filename, int line); + void *operator new(size_t size, CJBig2_Module *pModule, const FX_CHAR* filename, int line); - void operator delete(void *p, CJBig2_Module *pModule, FX_LPCSTR filename, int line); + void operator delete(void *p, CJBig2_Module *pModule, const FX_CHAR* filename, int line); void *operator new(size_t size, CJBig2_Module *pModule); @@ -24,10 +24,10 @@ public: void operator delete(void *p, CJBig2_Module *pModule); void *operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size, - FX_LPCSTR filename, int line); + const FX_CHAR* filename, int line); void operator delete[](void *p, CJBig2_Module *pModule, size_t unit_size, - FX_LPCSTR filename, int line); + const FX_CHAR* filename, int line); void *operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size); diff --git a/core/src/fxcodec/jbig2/JBig2_Segment.h b/core/src/fxcodec/jbig2/JBig2_Segment.h index fe44bc962d..b61e8e5075 100644 --- a/core/src/fxcodec/jbig2/JBig2_Segment.h +++ b/core/src/fxcodec/jbig2/JBig2_Segment.h @@ -62,7 +62,7 @@ public: CJBig2_PatternDict *pd; CJBig2_Image *im; CJBig2_HuffmanTable *ht; - FX_LPVOID vd; + void* vd; } m_Result; }; #endif diff --git a/core/src/fxcodec/lbmp/fx_bmp.cpp b/core/src/fxcodec/lbmp/fx_bmp.cpp index 3a6e3816ff..986a3272c4 100644 --- a/core/src/fxcodec/lbmp/fx_bmp.cpp +++ b/core/src/fxcodec/lbmp/fx_bmp.cpp @@ -5,27 +5,27 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "fx_bmp.h"
-FX_DWORD _GetDWord_LSBFirst(FX_LPBYTE p)
+FX_DWORD _GetDWord_LSBFirst(uint8_t* p)
{
return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
}
-FX_WORD _GetWord_LSBFirst(FX_LPBYTE p)
+FX_WORD _GetWord_LSBFirst(uint8_t* p)
{
return p[0] | (p[1] << 8);
}
-void _SetDWord_LSBFirst(FX_LPBYTE p, FX_DWORD v)
+void _SetDWord_LSBFirst(uint8_t* p, FX_DWORD v)
{
p[0] = (uint8_t)v;
p[1] = (uint8_t)(v >> 8);
p[2] = (uint8_t)(v >> 16);
p[3] = (uint8_t)(v >> 24);
}
-void _SetWord_LSBFirst(FX_LPBYTE p, FX_WORD v)
+void _SetWord_LSBFirst(uint8_t* p, FX_WORD v)
{
p[0] = (uint8_t)v;
p[1] = (uint8_t)(v >> 8);
}
-void _bmp_error(bmp_decompress_struct_p bmp_ptr, FX_LPCSTR err_msg)
+void _bmp_error(bmp_decompress_struct_p bmp_ptr, const FX_CHAR* err_msg)
{
if(bmp_ptr != NULL && bmp_ptr->_bmp_error_fn != NULL) {
bmp_ptr->_bmp_error_fn(bmp_ptr, err_msg);
@@ -69,12 +69,12 @@ int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr) if(bmp_ptr->decode_status == BMP_D_STATUS_HEADER) {
ASSERT(sizeof(BmpFileHeader) == 14);
BmpFileHeader* bmp_header_ptr = NULL;
- if(_bmp_read_data(bmp_ptr, (FX_LPBYTE*)&bmp_header_ptr, 14) == NULL) {
+ if(_bmp_read_data(bmp_ptr, (uint8_t**)&bmp_header_ptr, 14) == NULL) {
return 2;
}
- bmp_ptr->bmp_header_ptr->bfType = _GetWord_LSBFirst((FX_LPBYTE)&bmp_header_ptr->bfType);
- bmp_ptr->bmp_header_ptr->bfOffBits = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_header_ptr->bfOffBits);
- bmp_ptr->data_size = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_header_ptr->bfSize);
+ bmp_ptr->bmp_header_ptr->bfType = _GetWord_LSBFirst((uint8_t*)&bmp_header_ptr->bfType);
+ bmp_ptr->bmp_header_ptr->bfOffBits = _GetDWord_LSBFirst((uint8_t*)&bmp_header_ptr->bfOffBits);
+ bmp_ptr->data_size = _GetDWord_LSBFirst((uint8_t*)&bmp_header_ptr->bfSize);
if(bmp_ptr->bmp_header_ptr->bfType != BMP_SIGNATURE) {
_bmp_error(bmp_ptr, "Not A Bmp Image");
return 0;
@@ -91,30 +91,30 @@ int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr) case FX_MIN(12, sizeof(BmpCoreHeader)): {
bmp_ptr->pal_type = 1;
BmpCoreHeaderPtr bmp_core_header_ptr = NULL;
- if(_bmp_read_data(bmp_ptr, (FX_LPBYTE*)&bmp_core_header_ptr, bmp_ptr->img_ifh_size) == NULL) {
+ if(_bmp_read_data(bmp_ptr, (uint8_t**)&bmp_core_header_ptr, bmp_ptr->img_ifh_size) == NULL) {
bmp_ptr->skip_size = skip_size_org;
return 2;
}
- bmp_ptr->width = (FX_DWORD)_GetWord_LSBFirst((FX_LPBYTE)&bmp_core_header_ptr->bcWidth);
- bmp_ptr->height = (FX_DWORD)_GetWord_LSBFirst((FX_LPBYTE)&bmp_core_header_ptr->bcHeight);
- bmp_ptr->bitCounts = _GetWord_LSBFirst((FX_LPBYTE)&bmp_core_header_ptr->bcBitCount);
+ bmp_ptr->width = (FX_DWORD)_GetWord_LSBFirst((uint8_t*)&bmp_core_header_ptr->bcWidth);
+ bmp_ptr->height = (FX_DWORD)_GetWord_LSBFirst((uint8_t*)&bmp_core_header_ptr->bcHeight);
+ bmp_ptr->bitCounts = _GetWord_LSBFirst((uint8_t*)&bmp_core_header_ptr->bcBitCount);
bmp_ptr->compress_flag = BMP_RGB;
bmp_ptr->imgTB_flag = FALSE;
}
break;
case FX_MIN(40, sizeof(BmpInfoHeader)): {
BmpInfoHeaderPtr bmp_info_header_ptr = NULL;
- if(_bmp_read_data(bmp_ptr, (FX_LPBYTE*)&bmp_info_header_ptr, bmp_ptr->img_ifh_size) == NULL) {
+ if(_bmp_read_data(bmp_ptr, (uint8_t**)&bmp_info_header_ptr, bmp_ptr->img_ifh_size) == NULL) {
bmp_ptr->skip_size = skip_size_org;
return 2;
}
- bmp_ptr->width = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biWidth);
- bmp_ptr->height = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biHeight);
- bmp_ptr->bitCounts = _GetWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biBitCount);
- bmp_ptr->compress_flag = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biCompression);
- bmp_ptr->color_used = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biClrUsed);
- bmp_ptr->dpi_x = (int32_t)_GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biXPelsPerMeter);
- bmp_ptr->dpi_y = (int32_t)_GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biYPelsPerMeter);
+ bmp_ptr->width = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biWidth);
+ bmp_ptr->height = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biHeight);
+ bmp_ptr->bitCounts = _GetWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biBitCount);
+ bmp_ptr->compress_flag = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biCompression);
+ bmp_ptr->color_used = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biClrUsed);
+ bmp_ptr->dpi_x = (int32_t)_GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biXPelsPerMeter);
+ bmp_ptr->dpi_y = (int32_t)_GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biYPelsPerMeter);
if(bmp_ptr->height < 0) {
bmp_ptr->height = -bmp_ptr->height;
bmp_ptr->imgTB_flag = TRUE;
@@ -124,19 +124,19 @@ int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr) default: {
if(bmp_ptr->img_ifh_size > FX_MIN(40, sizeof(BmpInfoHeader))) {
BmpInfoHeaderPtr bmp_info_header_ptr = NULL;
- if(_bmp_read_data(bmp_ptr, (FX_LPBYTE*)&bmp_info_header_ptr, bmp_ptr->img_ifh_size) == NULL) {
+ if(_bmp_read_data(bmp_ptr, (uint8_t**)&bmp_info_header_ptr, bmp_ptr->img_ifh_size) == NULL) {
bmp_ptr->skip_size = skip_size_org;
return 2;
}
FX_WORD biPlanes;
- bmp_ptr->width = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biWidth);
- bmp_ptr->height = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biHeight);
- bmp_ptr->bitCounts = _GetWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biBitCount);
- bmp_ptr->compress_flag = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biCompression);
- bmp_ptr->color_used = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biClrUsed);
- biPlanes = _GetWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biPlanes);
- bmp_ptr->dpi_x = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biXPelsPerMeter);
- bmp_ptr->dpi_y = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biYPelsPerMeter);
+ bmp_ptr->width = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biWidth);
+ bmp_ptr->height = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biHeight);
+ bmp_ptr->bitCounts = _GetWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biBitCount);
+ bmp_ptr->compress_flag = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biCompression);
+ bmp_ptr->color_used = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biClrUsed);
+ biPlanes = _GetWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biPlanes);
+ bmp_ptr->dpi_x = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biXPelsPerMeter);
+ bmp_ptr->dpi_y = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biYPelsPerMeter);
if(bmp_ptr->height < 0) {
bmp_ptr->height = -bmp_ptr->height;
bmp_ptr->imgTB_flag = TRUE;
@@ -211,13 +211,13 @@ int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr) return 0;
}
FX_DWORD* mask;
- if(_bmp_read_data(bmp_ptr, (FX_LPBYTE*)&mask, 3 * sizeof(FX_DWORD)) == NULL) {
+ if(_bmp_read_data(bmp_ptr, (uint8_t**)&mask, 3 * sizeof(FX_DWORD)) == NULL) {
bmp_ptr->skip_size = skip_size_org;
return 2;
}
- bmp_ptr->mask_red = _GetDWord_LSBFirst((FX_LPBYTE)&mask[0]);
- bmp_ptr->mask_green = _GetDWord_LSBFirst((FX_LPBYTE)&mask[1]);
- bmp_ptr->mask_blue = _GetDWord_LSBFirst((FX_LPBYTE)&mask[2]);
+ bmp_ptr->mask_red = _GetDWord_LSBFirst((uint8_t*)&mask[0]);
+ bmp_ptr->mask_green = _GetDWord_LSBFirst((uint8_t*)&mask[1]);
+ bmp_ptr->mask_blue = _GetDWord_LSBFirst((uint8_t*)&mask[2]);
if(bmp_ptr->mask_red & bmp_ptr->mask_green ||
bmp_ptr->mask_red & bmp_ptr->mask_blue ||
bmp_ptr->mask_green & bmp_ptr->mask_blue) {
@@ -246,9 +246,9 @@ int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr) if(bmp_ptr->color_used != 0) {
bmp_ptr->pal_num = bmp_ptr->color_used;
}
- FX_LPBYTE src_pal_ptr = NULL;
+ uint8_t* src_pal_ptr = NULL;
FX_DWORD src_pal_size = bmp_ptr->pal_num * (bmp_ptr->pal_type ? 3 : 4);
- if(_bmp_read_data(bmp_ptr, (FX_LPBYTE*)&src_pal_ptr, src_pal_size) == NULL) {
+ if(_bmp_read_data(bmp_ptr, (uint8_t**)&src_pal_ptr, src_pal_size) == NULL) {
bmp_ptr->skip_size = skip_size_org;
return 2;
}
@@ -306,8 +306,8 @@ int32_t _bmp_decode_image(bmp_decompress_struct_p bmp_ptr) }
int32_t _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr)
{
- FX_LPBYTE row_buf = bmp_ptr->out_row_buffer;
- FX_LPBYTE des_buf = NULL;
+ uint8_t* row_buf = bmp_ptr->out_row_buffer;
+ uint8_t* des_buf = NULL;
while (bmp_ptr->row_num < bmp_ptr->height) {
if(_bmp_read_data(bmp_ptr, &des_buf, bmp_ptr->src_row_bytes) == NULL) {
return 2;
@@ -351,7 +351,7 @@ int32_t _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr) green_bits -= 8;
red_bits -= 8;
for (int32_t col = 0; col < bmp_ptr->width; col++) {
- *buf = _GetWord_LSBFirst((FX_LPBYTE)buf);
+ *buf = _GetWord_LSBFirst((uint8_t*)buf);
*row_buf++ = (uint8_t)((*buf & bmp_ptr->mask_blue) << blue_bits);
*row_buf++ = (uint8_t)((*buf & bmp_ptr->mask_green) >> green_bits);
*row_buf++ = (uint8_t)((*buf++ & bmp_ptr->mask_red) >> red_bits);
@@ -375,8 +375,8 @@ int32_t _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr) }
int32_t _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr)
{
- FX_LPBYTE first_byte_ptr = NULL;
- FX_LPBYTE second_byte_ptr = NULL;
+ uint8_t* first_byte_ptr = NULL;
+ uint8_t* second_byte_ptr = NULL;
bmp_ptr->col_num = 0;
while(TRUE) {
FX_DWORD skip_size_org = bmp_ptr->skip_size;
@@ -414,7 +414,7 @@ int32_t _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) return 1;
}
case RLE_DELTA: {
- FX_LPBYTE delta_ptr;
+ uint8_t* delta_ptr;
if(_bmp_read_data(bmp_ptr, &delta_ptr, 2) == NULL) {
bmp_ptr->skip_size = skip_size_org;
return 2;
@@ -468,8 +468,8 @@ int32_t _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) }
int32_t _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr)
{
- FX_LPBYTE first_byte_ptr = NULL;
- FX_LPBYTE second_byte_ptr = NULL;
+ uint8_t* first_byte_ptr = NULL;
+ uint8_t* second_byte_ptr = NULL;
bmp_ptr->col_num = 0;
while (TRUE) {
FX_DWORD skip_size_org = bmp_ptr->skip_size;
@@ -507,7 +507,7 @@ int32_t _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) return 1;
}
case RLE_DELTA: {
- FX_LPBYTE delta_ptr;
+ uint8_t* delta_ptr;
if(_bmp_read_data(bmp_ptr, &delta_ptr, 2) == NULL) {
bmp_ptr->skip_size = skip_size_org;
return 2;
@@ -576,7 +576,7 @@ int32_t _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) _bmp_error(bmp_ptr, "Any Uncontrol Error");
return 0;
}
-FX_LPBYTE _bmp_read_data(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE* des_buf_pp, FX_DWORD data_size)
+uint8_t* _bmp_read_data(bmp_decompress_struct_p bmp_ptr, uint8_t** des_buf_pp, FX_DWORD data_size)
{
if(bmp_ptr == NULL ||
bmp_ptr->avail_in < bmp_ptr->skip_size + data_size) {
@@ -593,13 +593,13 @@ void _bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, int32_t status) bmp_ptr->avail_in -= bmp_ptr->skip_size;
bmp_ptr->skip_size = 0;
}
-void _bmp_input_buffer(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE src_buf, FX_DWORD src_size)
+void _bmp_input_buffer(bmp_decompress_struct_p bmp_ptr, uint8_t* src_buf, FX_DWORD src_size)
{
bmp_ptr->next_in = src_buf;
bmp_ptr->avail_in = src_size;
bmp_ptr->skip_size = 0;
}
-FX_DWORD _bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE* avial_buf_ptr)
+FX_DWORD _bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, uint8_t** avial_buf_ptr)
{
if(avial_buf_ptr != NULL) {
*avial_buf_ptr = NULL;
@@ -627,7 +627,7 @@ void _bmp_destroy_compress(bmp_compress_struct_p bmp_ptr) FX_Free(bmp_ptr);
}
}
-static void WriteFileHeader(BmpFileHeaderPtr head_ptr, FX_LPBYTE dst_buf)
+static void WriteFileHeader(BmpFileHeaderPtr head_ptr, uint8_t* dst_buf)
{
FX_DWORD offset;
offset = 0;
@@ -642,7 +642,7 @@ static void WriteFileHeader(BmpFileHeaderPtr head_ptr, FX_LPBYTE dst_buf) _SetDWord_LSBFirst(&dst_buf[offset], head_ptr->bfOffBits);
offset += 4;
}
-static void WriteInfoHeader(BmpInfoHeaderPtr info_head_ptr, FX_LPBYTE dst_buf)
+static void WriteInfoHeader(BmpInfoHeaderPtr info_head_ptr, uint8_t* dst_buf)
{
FX_DWORD offset;
offset = sizeof(BmpFileHeader);
@@ -670,7 +670,7 @@ static void WriteInfoHeader(BmpInfoHeaderPtr info_head_ptr, FX_LPBYTE dst_buf) offset += 4;
}
#ifdef BMP_SUPPORT_BITFIELD
-static void _bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_size)
+static void _bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, FX_DWORD& dst_size)
{
if (bmp_ptr->info_header.biBitCount != 16 && bmp_ptr->info_header.biBitCount != 32) {
return;
@@ -753,7 +753,7 @@ static void _bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_ dst_size = dst_pos;
}
#endif
-static void _bmp_encode_rgb(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_size)
+static void _bmp_encode_rgb(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, FX_DWORD& dst_size)
{
if (bmp_ptr->info_header.biBitCount == 16) {
#ifdef BMP_SUPPORT_BITFIELD
@@ -777,7 +777,7 @@ static void _bmp_encode_rgb(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, F }
dst_size = dst_pos;
}
-static uint8_t _bmp_rle8_search(FX_LPCBYTE buf, int32_t len)
+static uint8_t _bmp_rle8_search(const uint8_t* buf, int32_t len)
{
uint8_t num;
num = 1;
@@ -789,7 +789,7 @@ static uint8_t _bmp_rle8_search(FX_LPCBYTE buf, int32_t len) }
return num;
}
-static void _bmp_encode_rle8(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_size)
+static void _bmp_encode_rle8(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, FX_DWORD& dst_size)
{
FX_DWORD size, dst_pos, index;
uint8_t rle[2] = {0};
@@ -825,7 +825,7 @@ static void _bmp_encode_rle8(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, dst_buf[dst_pos++] = RLE_EOI;
dst_size = dst_pos;
}
-static uint8_t _bmp_rle4_search(FX_LPCBYTE buf, int32_t len)
+static uint8_t _bmp_rle4_search(const uint8_t* buf, int32_t len)
{
uint8_t num;
num = 2;
@@ -837,7 +837,7 @@ static uint8_t _bmp_rle4_search(FX_LPCBYTE buf, int32_t len) }
return num;
}
-static void _bmp_encode_rle4(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_size)
+static void _bmp_encode_rle4(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, FX_DWORD& dst_size)
{
FX_DWORD size, dst_pos, index;
uint8_t rle[2] = {0};
@@ -874,7 +874,7 @@ static void _bmp_encode_rle4(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, dst_buf[dst_pos++] = RLE_EOI;
dst_size = dst_pos;
}
-FX_BOOL _bmp_encode_image( bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_size )
+FX_BOOL _bmp_encode_image( bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, FX_DWORD& dst_size )
{
FX_DWORD head_size = sizeof(BmpFileHeader) + sizeof(BmpInfoHeader);
FX_DWORD pal_size = sizeof(FX_DWORD) * bmp_ptr->pal_num;
diff --git a/core/src/fxcodec/lbmp/fx_bmp.h b/core/src/fxcodec/lbmp/fx_bmp.h index 553a1501db..f3c6e5b133 100644 --- a/core/src/fxcodec/lbmp/fx_bmp.h +++ b/core/src/fxcodec/lbmp/fx_bmp.h @@ -64,8 +64,8 @@ typedef bmp_decompress_struct *bmp_decompress_struct_p; typedef bmp_decompress_struct_p *bmp_decompress_struct_pp;
struct tag_bmp_decompress_struct {
jmp_buf jmpbuf;
- FX_LPSTR err_ptr;
- void (*_bmp_error_fn)(bmp_decompress_struct_p gif_ptr, FX_LPCSTR err_msg);
+ FX_CHAR* err_ptr;
+ void (*_bmp_error_fn)(bmp_decompress_struct_p gif_ptr, const FX_CHAR* err_msg);
void* context_ptr;
@@ -77,7 +77,7 @@ struct tag_bmp_decompress_struct { int32_t components;
int32_t src_row_bytes;
int32_t out_row_bytes;
- FX_LPBYTE out_row_buffer;
+ uint8_t* out_row_buffer;
FX_WORD bitCounts;
FX_DWORD color_used;
FX_BOOL imgTB_flag;
@@ -98,13 +98,13 @@ struct tag_bmp_decompress_struct { #endif
FX_BOOL (*_bmp_get_data_position_fn)(bmp_decompress_struct_p bmp_ptr, FX_DWORD cur_pos);
- void (*_bmp_get_row_fn)(bmp_decompress_struct_p bmp_ptr, int32_t row_num, FX_LPBYTE row_buf);
- FX_LPBYTE next_in;
+ void (*_bmp_get_row_fn)(bmp_decompress_struct_p bmp_ptr, int32_t row_num, uint8_t* row_buf);
+ uint8_t* next_in;
FX_DWORD avail_in;
FX_DWORD skip_size;
int32_t decode_status;
};
-void _bmp_error(bmp_decompress_struct_p bmp_ptr, FX_LPCSTR err_msg);
+void _bmp_error(bmp_decompress_struct_p bmp_ptr, const FX_CHAR* err_msg);
bmp_decompress_struct_p _bmp_create_decompress();
void _bmp_destroy_decompress(bmp_decompress_struct_pp bmp_ptr_ptr);
int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr);
@@ -112,10 +112,10 @@ int32_t _bmp_decode_image(bmp_decompress_struct_p bmp_ptr); int32_t _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr);
int32_t _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr);
int32_t _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr);
-FX_LPBYTE _bmp_read_data(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE* des_buf_pp, FX_DWORD data_size);
+uint8_t* _bmp_read_data(bmp_decompress_struct_p bmp_ptr, uint8_t** des_buf_pp, FX_DWORD data_size);
void _bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, int32_t status);
-void _bmp_input_buffer(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE src_buf, FX_DWORD src_size);
-FX_DWORD _bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE* avial_buf_ptr);
+void _bmp_input_buffer(bmp_decompress_struct_p bmp_ptr, uint8_t* src_buf, FX_DWORD src_size);
+FX_DWORD _bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, uint8_t** avial_buf_ptr);
#define BMP_PTR_NOT_NULL(ptr,bmp_ptr) if(ptr == NULL){ \
_bmp_error(bmp_ptr,"Out Of Memory");\
return 0; \
@@ -126,7 +126,7 @@ typedef bmp_compress_struct_p *bmp_compress_struct_pp; struct tag_bmp_compress_struct {
BmpFileHeader file_header;
BmpInfoHeader info_header;
- FX_LPBYTE src_buf;
+ uint8_t* src_buf;
FX_DWORD src_pitch;
FX_DWORD src_row;
uint8_t src_bpp;
@@ -140,4 +140,4 @@ struct tag_bmp_compress_struct { };
bmp_compress_struct_p _bmp_create_compress();
void _bmp_destroy_compress(bmp_compress_struct_p bmp_ptr);
-FX_BOOL _bmp_encode_image(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_size);
+FX_BOOL _bmp_encode_image(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, FX_DWORD& dst_size);
diff --git a/core/src/fxcodec/lgif/fx_gif.cpp b/core/src/fxcodec/lgif/fx_gif.cpp index 1eb4a75f1a..29e99f2abf 100644 --- a/core/src/fxcodec/lgif/fx_gif.cpp +++ b/core/src/fxcodec/lgif/fx_gif.cpp @@ -5,7 +5,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "fx_gif.h"
-void CGifLZWDecoder::Input(FX_LPBYTE src_buf, FX_DWORD src_size)
+void CGifLZWDecoder::Input(uint8_t* src_buf, FX_DWORD src_size)
{
next_in = src_buf;
avail_in = src_size;
@@ -65,7 +65,7 @@ void CGifLZWDecoder::AddCode(FX_WORD prefix_code, uint8_t append_char) }
}
}
-int32_t CGifLZWDecoder::Decode(FX_LPBYTE des_buf, FX_DWORD& des_size)
+int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, FX_DWORD& des_size)
{
if(des_size == 0) {
return 3;
@@ -144,7 +144,7 @@ int32_t CGifLZWDecoder::Decode(FX_LPBYTE des_buf, FX_DWORD& des_size) }
return 0;
}
-static FX_BOOL _gif_grow_buf(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD size)
+static FX_BOOL _gif_grow_buf(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD size)
{
if (dst_len < size) {
FX_DWORD len_org = dst_len;
@@ -169,7 +169,7 @@ static inline void _gif_cut_index(uint8_t& val, FX_DWORD index, uint8_t index_bi FX_DWORD cut = ((1 << (index_bit - index_bit_use)) - 1) << index_bit_use;
val |= ((index & cut) >> index_bit_use) << bit_use;
}
-static inline uint8_t _gif_cut_buf(FX_LPCBYTE buf, FX_DWORD& offset, uint8_t bit_cut, uint8_t& bit_offset, FX_DWORD& bit_num)
+static inline uint8_t _gif_cut_buf(const uint8_t* buf, FX_DWORD& offset, uint8_t bit_cut, uint8_t& bit_offset, FX_DWORD& bit_num)
{
if (bit_cut != 8) {
FX_WORD index = 0;
@@ -206,7 +206,7 @@ void CGifLZWEncoder::ClearTable() code_table[i].suffix = 0;
}
}
-void CGifLZWEncoder::Start( uint8_t code_len, FX_LPCBYTE src_buf, FX_LPBYTE& dst_buf, FX_DWORD& offset)
+void CGifLZWEncoder::Start( uint8_t code_len, const uint8_t* src_buf, uint8_t*& dst_buf, FX_DWORD& offset)
{
code_size = code_len + 1;
src_bit_cut = code_size;
@@ -225,7 +225,7 @@ void CGifLZWEncoder::Start( uint8_t code_len, FX_LPCBYTE src_buf, FX_LPBYTE& dst code_table[index_num].prefix = _gif_cut_buf(src_buf, src_offset, src_bit_cut, src_bit_offset, src_bit_num);
code_table[index_num].suffix = _gif_cut_buf(src_buf, src_offset, src_bit_cut, src_bit_offset, src_bit_num);
}
-void CGifLZWEncoder::WriteBlock(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset)
+void CGifLZWEncoder::WriteBlock(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset)
{
if (!_gif_grow_buf(dst_buf, dst_len, offset + GIF_DATA_BLOCK + 1)) {
longjmp(jmp, 1);
@@ -236,7 +236,7 @@ void CGifLZWEncoder::WriteBlock(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& FXSYS_memset32(index_buf, 0, GIF_DATA_BLOCK);
index_buf_len = 0;
}
-void CGifLZWEncoder::EncodeString( FX_DWORD index, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset )
+void CGifLZWEncoder::EncodeString( FX_DWORD index, uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset )
{
uint8_t index_bit_use;
index_bit_use = 0;
@@ -287,7 +287,7 @@ void CGifLZWEncoder::EncodeString( FX_DWORD index, FX_LPBYTE& dst_buf, FX_DWORD& index_bit_cur++;
}
}
-FX_BOOL CGifLZWEncoder::Encode( FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset )
+FX_BOOL CGifLZWEncoder::Encode( const uint8_t* src_buf, FX_DWORD src_len, uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset )
{
uint8_t suffix;
if (setjmp(jmp)) {
@@ -313,7 +313,7 @@ FX_BOOL CGifLZWEncoder::Encode( FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE& src_bit_num = 0;
return TRUE;
}
-FX_BOOL CGifLZWEncoder::LookUpInTable( FX_LPCBYTE buf, FX_DWORD& offset, uint8_t& bit_offset )
+FX_BOOL CGifLZWEncoder::LookUpInTable( const uint8_t* buf, FX_DWORD& offset, uint8_t& bit_offset )
{
for (FX_WORD i = table_cur; i < index_num; i++) {
if (code_table[i].prefix == code_table[index_num].prefix &&
@@ -327,7 +327,7 @@ FX_BOOL CGifLZWEncoder::LookUpInTable( FX_LPCBYTE buf, FX_DWORD& offset, uint8_t table_cur = code_end + 1;
return FALSE;
}
-void CGifLZWEncoder::Finish(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset)
+void CGifLZWEncoder::Finish(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset)
{
EncodeString(code_table[index_num].prefix, dst_buf, dst_len, offset);
EncodeString(code_end, dst_buf, dst_len, offset);
@@ -532,13 +532,13 @@ void _gif_destroy_compress(gif_compress_struct_pp gif_ptr_ptr) #endif
FX_Free(gif_ptr);
}
-void _gif_error(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg)
+void _gif_error(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg)
{
if(gif_ptr != NULL && gif_ptr->_gif_error_fn != NULL) {
gif_ptr->_gif_error_fn(gif_ptr, err_msg);
}
}
-void _gif_warn(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg) {}
+void _gif_warn(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg) {}
int32_t _gif_read_header(gif_decompress_struct_p gif_ptr)
{
if(gif_ptr == NULL) {
@@ -547,7 +547,7 @@ int32_t _gif_read_header(gif_decompress_struct_p gif_ptr) FX_DWORD skip_size_org = gif_ptr->skip_size;
ASSERT(sizeof(GifHeader) == 6);
GifHeader* gif_header_ptr = NULL;
- if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_header_ptr, 6) == NULL) {
+ if(_gif_read_data(gif_ptr, (uint8_t**)&gif_header_ptr, 6) == NULL) {
return 2;
}
if(FXSYS_strncmp(gif_header_ptr->signature, GIF_SIGNATURE, 3) != 0 ||
@@ -558,7 +558,7 @@ int32_t _gif_read_header(gif_decompress_struct_p gif_ptr) }
ASSERT(sizeof(GifLSD) == 7);
GifLSD* gif_lsd_ptr = NULL;
- if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_lsd_ptr, 7) == NULL) {
+ if(_gif_read_data(gif_ptr, (uint8_t**)&gif_lsd_ptr, 7) == NULL) {
gif_ptr->skip_size = skip_size_org;
return 2;
}
@@ -566,7 +566,7 @@ int32_t _gif_read_header(gif_decompress_struct_p gif_ptr) gif_ptr->global_pal_num = 2 << ((GifGF*)&gif_lsd_ptr->global_flag)->pal_bits;
ASSERT(sizeof(GifPalette) == 3);
int32_t global_pal_size = gif_ptr->global_pal_num * 3;
- FX_LPBYTE global_pal_ptr = NULL;
+ uint8_t* global_pal_ptr = NULL;
if (_gif_read_data(gif_ptr, &global_pal_ptr, global_pal_size) == NULL) {
gif_ptr->skip_size = skip_size_org;
return 2;
@@ -581,8 +581,8 @@ int32_t _gif_read_header(gif_decompress_struct_p gif_ptr) GIF_PTR_NOT_NULL(gif_ptr->global_pal_ptr, gif_ptr);
FXSYS_memcpy32(gif_ptr->global_pal_ptr, global_pal_ptr, global_pal_size);
}
- gif_ptr->width = (int)_GetWord_LSBFirst((FX_LPBYTE)&gif_lsd_ptr->width);
- gif_ptr->height = (int)_GetWord_LSBFirst((FX_LPBYTE)&gif_lsd_ptr->height);
+ gif_ptr->width = (int)_GetWord_LSBFirst((uint8_t*)&gif_lsd_ptr->width);
+ gif_ptr->height = (int)_GetWord_LSBFirst((uint8_t*)&gif_lsd_ptr->height);
gif_ptr->bc_index = gif_lsd_ptr->bc_index;
gif_ptr->pixel_aspect = gif_lsd_ptr->pixel_aspect;
return 1;
@@ -598,7 +598,7 @@ int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr) case GIF_D_STATUS_TAIL:
return 1;
case GIF_D_STATUS_SIG: {
- FX_LPBYTE sig_ptr = NULL;
+ uint8_t* sig_ptr = NULL;
if(_gif_read_data(gif_ptr, &sig_ptr, 1) == NULL) {
return 2;
}
@@ -623,7 +623,7 @@ int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr) }
}
case GIF_D_STATUS_EXT: {
- FX_LPBYTE ext_ptr = NULL;
+ uint8_t* ext_ptr = NULL;
if(_gif_read_data(gif_ptr, &ext_ptr, 1) == NULL) {
return 2;
}
@@ -668,8 +668,8 @@ int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr) continue;
}
case GIF_D_STATUS_IMG_DATA: {
- FX_LPBYTE data_size_ptr = NULL;
- FX_LPBYTE data_ptr = NULL;
+ uint8_t* data_size_ptr = NULL;
+ uint8_t* data_ptr = NULL;
FX_DWORD skip_size_org = gif_ptr->skip_size;
if(_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
return 2;
@@ -711,15 +711,15 @@ void _gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr, GifGCE** gce_ptr_ptr }
int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr)
{
- FX_LPBYTE data_size_ptr = NULL;
- FX_LPBYTE data_ptr = NULL;
+ uint8_t* data_size_ptr = NULL;
+ uint8_t* data_ptr = NULL;
FX_DWORD skip_size_org = gif_ptr->skip_size;
switch(gif_ptr->decode_status) {
#ifdef GIF_SUPPORT_APPLICATION_EXTENSION
case GIF_D_STATUS_EXT_AE: {
ASSERT(sizeof(GifAE) == 12);
GifAE* gif_ae_ptr = NULL;
- if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_ae_ptr, 12) == NULL) {
+ if(_gif_read_data(gif_ptr, (uint8_t**)&gif_ae_ptr, 12) == NULL) {
return 2;
}
CFX_ByteString gif_ae_data_str;
@@ -734,7 +734,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) gif_ptr->skip_size = skip_size_org;
return 2;
}
- gif_ae_data_str += CFX_ByteString((FX_LPCBYTE)data_ptr, data_size);
+ gif_ae_data_str += CFX_ByteString((const uint8_t*)data_ptr, data_size);
}
FXSYS_memcpy32(gif_ptr->app_identify, gif_ae_ptr->app_identify, 8);
FXSYS_memcpy32(gif_ptr->app_authentication, gif_ae_ptr->app_authentication, 3);
@@ -745,7 +745,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) }
gif_ptr->app_data = FX_Alloc(uint8_t, gif_ptr->app_data_size);
GIF_PTR_NOT_NULL(gif_ptr->app_data, gif_ptr);
- FXSYS_memcpy32(gif_ptr->app_data, FX_LPCBYTE(gif_ae_data_str), gif_ptr->app_data_size);
+ FXSYS_memcpy32(gif_ptr->app_data, const uint8_t*(gif_ae_data_str), gif_ptr->app_data_size);
}
break;
#endif
@@ -763,7 +763,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) gif_ptr->skip_size = skip_size_org;
return 2;
}
- *(gif_ptr->cmt_data_ptr) += CFX_ByteString((FX_LPCSTR)data_ptr, data_size);
+ *(gif_ptr->cmt_data_ptr) += CFX_ByteString((const FX_CHAR*)data_ptr, data_size);
}
}
break;
@@ -772,7 +772,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) case GIF_D_STATUS_EXT_PTE: {
ASSERT(sizeof(GifPTE) == 13);
GifPTE* gif_pte_ptr = NULL;
- if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_pte_ptr, 13) == NULL) {
+ if(_gif_read_data(gif_ptr, (uint8_t**)&gif_pte_ptr, 13) == NULL) {
return 2;
}
GifPlainText* gif_pt_ptr = FX_Alloc(GifPlainText, 1);
@@ -784,10 +784,10 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) gif_pt_ptr->string_ptr = new CFX_ByteString;
GIF_PTR_NOT_NULL(gif_pt_ptr->string_ptr, gif_ptr);
gif_pt_ptr->pte_ptr->block_size = gif_pte_ptr->block_size;
- gif_pt_ptr->pte_ptr->grid_left = _GetWord_LSBFirst((FX_LPBYTE)&gif_pte_ptr->grid_left);
- gif_pt_ptr->pte_ptr->grid_top = _GetWord_LSBFirst((FX_LPBYTE)&gif_pte_ptr->grid_top);
- gif_pt_ptr->pte_ptr->grid_width = _GetWord_LSBFirst((FX_LPBYTE)&gif_pte_ptr->grid_width);
- gif_pt_ptr->pte_ptr->grid_height = _GetWord_LSBFirst((FX_LPBYTE)&gif_pte_ptr->grid_height);
+ gif_pt_ptr->pte_ptr->grid_left = _GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_left);
+ gif_pt_ptr->pte_ptr->grid_top = _GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_top);
+ gif_pt_ptr->pte_ptr->grid_width = _GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_width);
+ gif_pt_ptr->pte_ptr->grid_height = _GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_height);
gif_pt_ptr->pte_ptr->char_width = gif_pte_ptr->char_width;
gif_pt_ptr->pte_ptr->char_height = gif_pte_ptr->char_height;
gif_pt_ptr->pte_ptr->fc_index = gif_pte_ptr->fc_index;
@@ -827,7 +827,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) }
return 2;
}
- *(gif_pt_ptr->string_ptr) += CFX_ByteString((FX_LPCSTR)data_ptr, data_size);
+ *(gif_pt_ptr->string_ptr) += CFX_ByteString((const FX_CHAR*)data_ptr, data_size);
}
gif_ptr->pt_ptr_arr_ptr->Add(gif_pt_ptr);
}
@@ -837,7 +837,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) case GIF_D_STATUS_EXT_GCE: {
ASSERT(sizeof(GifGCE) == 5);
GifGCE* gif_gce_ptr = NULL;
- if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_gce_ptr, 6) == NULL) {
+ if(_gif_read_data(gif_ptr, (uint8_t**)&gif_gce_ptr, 6) == NULL) {
return 2;
}
if(gif_ptr->gce_ptr == NULL) {
@@ -846,7 +846,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) }
gif_ptr->gce_ptr->block_size = gif_gce_ptr->block_size;
gif_ptr->gce_ptr->gce_flag = gif_gce_ptr->gce_flag;
- gif_ptr->gce_ptr->delay_time = _GetWord_LSBFirst((FX_LPBYTE)&gif_gce_ptr->delay_time);
+ gif_ptr->gce_ptr->delay_time = _GetWord_LSBFirst((uint8_t*)&gif_gce_ptr->delay_time);
gif_ptr->gce_ptr->trans_index = gif_gce_ptr->trans_index;
}
break;
@@ -886,7 +886,7 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) FX_DWORD skip_size_org = gif_ptr->skip_size;
ASSERT(sizeof(GifImageInfo) == 9);
GifImageInfo* gif_img_info_ptr = NULL;
- if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_img_info_ptr, 9) == NULL) {
+ if(_gif_read_data(gif_ptr, (uint8_t**)&gif_img_info_ptr, 9) == NULL) {
return 2;
}
GifImage* gif_image_ptr = (GifImage*)FX_Alloc(uint8_t, sizeof(GifImage));
@@ -894,10 +894,10 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) FXSYS_memset32(gif_image_ptr, 0, sizeof(GifImage));
gif_image_ptr->image_info_ptr = (GifImageInfo*)FX_Alloc(uint8_t, sizeof(GifImageInfo));
GIF_PTR_NOT_NULL(gif_image_ptr->image_info_ptr, gif_ptr);
- gif_image_ptr->image_info_ptr->left = _GetWord_LSBFirst((FX_LPBYTE)&gif_img_info_ptr->left);
- gif_image_ptr->image_info_ptr->top = _GetWord_LSBFirst((FX_LPBYTE)&gif_img_info_ptr->top);
- gif_image_ptr->image_info_ptr->width = _GetWord_LSBFirst((FX_LPBYTE)&gif_img_info_ptr->width);
- gif_image_ptr->image_info_ptr->height = _GetWord_LSBFirst((FX_LPBYTE)&gif_img_info_ptr->height);
+ gif_image_ptr->image_info_ptr->left = _GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->left);
+ gif_image_ptr->image_info_ptr->top = _GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->top);
+ gif_image_ptr->image_info_ptr->width = _GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->width);
+ gif_image_ptr->image_info_ptr->height = _GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->height);
gif_image_ptr->image_info_ptr->local_flag = gif_img_info_ptr->local_flag;
if(gif_image_ptr->image_info_ptr->left + gif_image_ptr->image_info_ptr->width > gif_ptr->width ||
gif_image_ptr->image_info_ptr->top + gif_image_ptr->image_info_ptr->height > gif_ptr->height) {
@@ -915,7 +915,7 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) if(gif_img_info_lf_ptr->local_pal) {
ASSERT(sizeof(GifPalette) == 3);
int32_t loc_pal_size = (2 << gif_img_info_lf_ptr->pal_bits) * 3;
- FX_LPBYTE loc_pal_ptr = NULL;
+ uint8_t* loc_pal_ptr = NULL;
if(_gif_read_data(gif_ptr, &loc_pal_ptr, loc_pal_size) == NULL) {
gif_ptr->skip_size = skip_size_org;
if(gif_image_ptr->image_info_ptr != NULL) {
@@ -929,10 +929,10 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) }
gif_image_ptr->local_pal_ptr = (GifPalette*)gif_ptr->_gif_ask_buf_for_pal_fn(gif_ptr, loc_pal_size);
if(gif_image_ptr->local_pal_ptr != NULL) {
- FXSYS_memcpy32((FX_LPBYTE)gif_image_ptr->local_pal_ptr, loc_pal_ptr, loc_pal_size);
+ FXSYS_memcpy32((uint8_t*)gif_image_ptr->local_pal_ptr, loc_pal_ptr, loc_pal_size);
}
}
- FX_LPBYTE code_size_ptr = NULL;
+ uint8_t* code_size_ptr = NULL;
if(_gif_read_data(gif_ptr, &code_size_ptr, 1) == NULL) {
gif_ptr->skip_size = skip_size_org;
if(gif_image_ptr->image_info_ptr != NULL) {
@@ -963,8 +963,8 @@ int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) ) {
return 0;
}
- FX_LPBYTE data_size_ptr = NULL;
- FX_LPBYTE data_ptr = NULL;
+ uint8_t* data_size_ptr = NULL;
+ uint8_t* data_ptr = NULL;
FX_DWORD skip_size_org = gif_ptr->skip_size;
GifImage* gif_image_ptr = gif_ptr->img_ptr_arr_ptr->GetAt(frame_num);
FX_DWORD gif_img_row_bytes = gif_image_ptr->image_info_ptr->width;
@@ -1111,7 +1111,7 @@ void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status) gif_ptr->avail_in -= gif_ptr->skip_size;
gif_ptr->skip_size = 0;
}
-FX_LPBYTE _gif_read_data(gif_decompress_struct_p gif_ptr, FX_LPBYTE* des_buf_pp, FX_DWORD data_size)
+uint8_t* _gif_read_data(gif_decompress_struct_p gif_ptr, uint8_t** des_buf_pp, FX_DWORD data_size)
{
if(gif_ptr == NULL ||
gif_ptr->avail_in < gif_ptr->skip_size + data_size) {
@@ -1121,13 +1121,13 @@ FX_LPBYTE _gif_read_data(gif_decompress_struct_p gif_ptr, FX_LPBYTE* des_buf_pp, gif_ptr->skip_size += data_size;
return *des_buf_pp;
}
-void _gif_input_buffer(gif_decompress_struct_p gif_ptr, FX_LPBYTE src_buf, FX_DWORD src_size)
+void _gif_input_buffer(gif_decompress_struct_p gif_ptr, uint8_t* src_buf, FX_DWORD src_size)
{
gif_ptr->next_in = src_buf;
gif_ptr->avail_in = src_size;
gif_ptr->skip_size = 0;
}
-FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, FX_LPBYTE* avial_buf_ptr)
+FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, uint8_t** avial_buf_ptr)
{
if(avial_buf_ptr != NULL) {
*avial_buf_ptr = NULL;
@@ -1141,7 +1141,7 @@ int32_t _gif_get_frame_num(gif_decompress_struct_p gif_ptr) {
return gif_ptr->img_ptr_arr_ptr->GetSize();
}
-static FX_BOOL _gif_write_header( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_len )
+static FX_BOOL _gif_write_header( gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, FX_DWORD& dst_len )
{
if (gif_ptr->cur_offset) {
return TRUE;
@@ -1171,13 +1171,13 @@ static FX_BOOL _gif_write_header( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_ }
return TRUE;
}
-void interlace_buf(FX_LPCBYTE buf, FX_DWORD pitch, FX_DWORD height)
+void interlace_buf(const uint8_t* buf, FX_DWORD pitch, FX_DWORD height)
{
- CFX_ArrayTemplate<FX_LPBYTE> pass[4];
+ CFX_ArrayTemplate<uint8_t*> pass[4];
int i, j;
FX_DWORD row;
row = 0;
- FX_LPBYTE temp;
+ uint8_t* temp;
while (row < height) {
if (row % 8 == 0) {
j = 0;
@@ -1198,12 +1198,12 @@ void interlace_buf(FX_LPCBYTE buf, FX_DWORD pitch, FX_DWORD height) }
for (i = 0, row = 0; i < 4; i++) {
for (j = 0; j < pass[i].GetSize(); j++, row++) {
- FXSYS_memcpy32((FX_LPBYTE)&buf[pitch * row], pass[i].GetAt(j), pitch);
+ FXSYS_memcpy32((uint8_t*)&buf[pitch * row], pass[i].GetAt(j), pitch);
FX_Free(pass[i].GetAt(j));
}
}
}
-static void _gif_write_block_data(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& dst_offset)
+static void _gif_write_block_data(const uint8_t* src_buf, FX_DWORD src_len, uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& dst_offset)
{
FX_DWORD src_offset = 0;
while (src_len > GIF_DATA_BLOCK) {
@@ -1217,7 +1217,7 @@ static void _gif_write_block_data(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYT FXSYS_memcpy32(&dst_buf[dst_offset], &src_buf[src_offset], src_len);
dst_offset += src_len;
}
-static FX_BOOL _gif_write_data( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_len )
+static FX_BOOL _gif_write_data( gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, FX_DWORD& dst_len )
{
if (!_gif_grow_buf(dst_buf, dst_len, gif_ptr->cur_offset + GIF_DATA_BLOCK)) {
return FALSE;
@@ -1326,7 +1326,7 @@ static FX_BOOL _gif_write_data( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_bu dst_buf[gif_ptr->cur_offset++] = GIF_SIG_TRAILER;
return TRUE;
}
-FX_BOOL _gif_encode( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_len )
+FX_BOOL _gif_encode( gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, FX_DWORD& dst_len )
{
if (!_gif_write_header(gif_ptr, dst_buf, dst_len)) {
return FALSE;
diff --git a/core/src/fxcodec/lgif/fx_gif.h b/core/src/fxcodec/lgif/fx_gif.h index 10aaf5f98f..031e4a4f8f 100644 --- a/core/src/fxcodec/lgif/fx_gif.h +++ b/core/src/fxcodec/lgif/fx_gif.h @@ -8,10 +8,10 @@ #include "../../../include/fxcrt/fx_basic.h"
-extern FX_WORD _GetWord_LSBFirst(FX_LPBYTE p);
-extern void _SetWord_LSBFirst(FX_LPBYTE p, FX_WORD v);
-extern void _BpcConvert(FX_LPCBYTE src_buf, FX_DWORD src_len, int32_t src_bpc, int32_t dst_bpc,
- FX_LPBYTE& dst_buf, FX_DWORD& dst_len);
+extern FX_WORD _GetWord_LSBFirst(uint8_t* p);
+extern void _SetWord_LSBFirst(uint8_t* p, FX_WORD v);
+extern void _BpcConvert(const uint8_t* src_buf, FX_DWORD src_len, int32_t src_bpc, int32_t dst_bpc,
+ uint8_t*& dst_buf, FX_DWORD& dst_len);
#define GIF_SUPPORT_COMMENT_EXTENSION
#define GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION
#define GIF_SUPPORT_PLAIN_TEXT_EXTENSION
@@ -110,7 +110,7 @@ typedef struct tagGifImage { GifImageInfo* image_info_ptr;
uint8_t image_code_size;
FX_DWORD image_data_pos;
- FX_LPBYTE image_row_buf;
+ uint8_t* image_row_buf;
int32_t image_row_num;
} GifImage;
typedef struct tagGifPlainText {
@@ -125,15 +125,15 @@ public: FX_WORD prefix;
uint8_t suffix;
};
- CGifLZWDecoder(FX_LPSTR error_ptr = NULL)
+ CGifLZWDecoder(FX_CHAR* error_ptr = NULL)
{
err_msg_ptr = error_ptr;
}
void InitTable(uint8_t code_len);
- int32_t Decode(FX_LPBYTE des_buf, FX_DWORD& des_size);
+ int32_t Decode(uint8_t* des_buf, FX_DWORD& des_size);
- void Input(FX_LPBYTE src_buf, FX_DWORD src_size);
+ void Input(uint8_t* src_buf, FX_DWORD src_size);
FX_DWORD GetAvailInput();
private:
@@ -151,13 +151,13 @@ private: tag_Table code_table[GIF_MAX_LZW_CODE];
FX_WORD code_old;
- FX_LPBYTE next_in;
+ uint8_t* next_in;
FX_DWORD avail_in;
uint8_t bits_left;
FX_DWORD code_store;
- FX_LPSTR err_msg_ptr;
+ FX_CHAR* err_msg_ptr;
};
class CGifLZWEncoder
{
@@ -168,14 +168,14 @@ public: };
CGifLZWEncoder();
~CGifLZWEncoder();
- void Start(uint8_t code_len, FX_LPCBYTE src_buf, FX_LPBYTE& dst_buf, FX_DWORD& offset);
- FX_BOOL Encode(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
- void Finish(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
+ void Start(uint8_t code_len, const uint8_t* src_buf, uint8_t*& dst_buf, FX_DWORD& offset);
+ FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_len, uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
+ void Finish(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
private:
void ClearTable();
- FX_BOOL LookUpInTable(FX_LPCBYTE buf, FX_DWORD& offset, uint8_t& bit_offset);
- void EncodeString(FX_DWORD index, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
- void WriteBlock(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
+ FX_BOOL LookUpInTable(const uint8_t* buf, FX_DWORD& offset, uint8_t& bit_offset);
+ void EncodeString(FX_DWORD index, uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
+ void WriteBlock(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
jmp_buf jmp;
FX_DWORD src_offset;
uint8_t src_bit_offset;
@@ -198,8 +198,8 @@ typedef gif_decompress_struct_p *gif_decompress_struct_pp; static int32_t s_gif_interlace_step[4] = {8, 8, 4, 2};
struct tag_gif_decompress_struct {
jmp_buf jmpbuf;
- FX_LPSTR err_ptr;
- void (*_gif_error_fn)(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg);
+ FX_CHAR* err_ptr;
+ void (*_gif_error_fn)(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg);
void* context_ptr;
int width;
int height;
@@ -215,13 +215,13 @@ struct tag_gif_decompress_struct { FX_DWORD img_row_avail_size;
uint8_t img_pass_num;
CFX_ArrayTemplate<GifImage*>* img_ptr_arr_ptr;
- FX_LPBYTE (*_gif_ask_buf_for_pal_fn)(gif_decompress_struct_p gif_ptr, int32_t pal_size);
- FX_LPBYTE next_in;
+ uint8_t* (*_gif_ask_buf_for_pal_fn)(gif_decompress_struct_p gif_ptr, int32_t pal_size);
+ uint8_t* next_in;
FX_DWORD avail_in;
int32_t decode_status;
FX_DWORD skip_size;
void (*_gif_record_current_position_fn)(gif_decompress_struct_p gif_ptr, FX_DWORD* cur_pos_ptr);
- void (*_gif_get_row_fn)(gif_decompress_struct_p gif_ptr, int32_t row_num, FX_LPBYTE row_buf);
+ void (*_gif_get_row_fn)(gif_decompress_struct_p gif_ptr, int32_t row_num, uint8_t* row_buf);
FX_BOOL (*_gif_get_record_position_fn)(gif_decompress_struct_p gif_ptr, FX_DWORD cur_pos,
int32_t left, int32_t top, int32_t width, int32_t height,
int32_t pal_num, void* pal_ptr,
@@ -231,7 +231,7 @@ struct tag_gif_decompress_struct { uint8_t app_identify[8];
uint8_t app_authentication[3];
FX_DWORD app_data_size;
- FX_LPBYTE app_data;
+ uint8_t* app_data;
#endif
#ifdef GIF_SUPPORT_COMMENT_EXTENSION
CFX_ByteString* cmt_data_ptr;
@@ -247,7 +247,7 @@ typedef struct tag_gif_compress_struct gif_compress_struct; typedef gif_compress_struct *gif_compress_struct_p;
typedef gif_compress_struct_p *gif_compress_struct_pp;
struct tag_gif_compress_struct {
- FX_LPCBYTE src_buf;
+ const uint8_t* src_buf;
FX_DWORD src_pitch;
FX_DWORD src_width;
FX_DWORD src_row;
@@ -265,11 +265,11 @@ struct tag_gif_compress_struct { uint8_t app_identify[8];
uint8_t app_authentication[3];
FX_DWORD app_data_size;
- FX_LPBYTE app_data;
+ uint8_t* app_data;
#endif
#ifdef GIF_SUPPORT_COMMENT_EXTENSION
- FX_LPBYTE cmt_data_ptr;
+ uint8_t* cmt_data_ptr;
FX_DWORD cmt_data_len;
#endif
@@ -279,12 +279,12 @@ struct tag_gif_compress_struct { #ifdef GIF_SUPPORT_PLAIN_TEXT_EXTENSION
GifPTE* pte_ptr;
- FX_LPCBYTE pte_data_ptr;
+ const uint8_t* pte_data_ptr;
FX_DWORD pte_data_len;
#endif
};
-void _gif_error(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg);
-void _gif_warn(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg);
+void _gif_error(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg);
+void _gif_warn(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg);
gif_decompress_struct_p _gif_create_decompress();
void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr);
gif_compress_struct_p _gif_create_compress();
@@ -296,12 +296,12 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr); int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr);
void _gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr, GifGCE** gce_ptr_ptr);
int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num);
-FX_LPBYTE _gif_read_data(gif_decompress_struct_p gif_ptr, FX_LPBYTE* des_buf_pp, FX_DWORD data_size);
+uint8_t* _gif_read_data(gif_decompress_struct_p gif_ptr, uint8_t** des_buf_pp, FX_DWORD data_size);
void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status);
-void _gif_input_buffer(gif_decompress_struct_p gif_ptr, FX_LPBYTE src_buf, FX_DWORD src_size);
-FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, FX_LPBYTE* avial_buf_ptr);
-void interlace_buf(FX_LPCBYTE buf, FX_DWORD width, FX_DWORD height);
-FX_BOOL _gif_encode( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_len );
+void _gif_input_buffer(gif_decompress_struct_p gif_ptr, uint8_t* src_buf, FX_DWORD src_size);
+FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, uint8_t** avial_buf_ptr);
+void interlace_buf(const uint8_t* buf, FX_DWORD width, FX_DWORD height);
+FX_BOOL _gif_encode( gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, FX_DWORD& dst_len );
#define GIF_PTR_NOT_NULL(ptr,gif_ptr) if(ptr == NULL){ \
_gif_error(gif_ptr,"Out Of Memory");\
return 0; \
|