summaryrefslogtreecommitdiff
path: root/core/src/fxcodec/codec
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-06-10 14:33:37 -0700
committerTom Sepez <tsepez@chromium.org>2015-06-10 14:33:37 -0700
commitd7e5cc754a937605d1f73db5e7967c58ddd80742 (patch)
treeed28e012c4d6a46b7f29f15a0c060474c27d4286 /core/src/fxcodec/codec
parentbfa9a824a20f37c2dd7111012b46c929cf2ed8a0 (diff)
downloadpdfium-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/codec')
-rw-r--r--core/src/fxcodec/codec/codec_int.h124
-rw-r--r--core/src/fxcodec/codec/fx_codec.cpp64
-rw-r--r--core/src/fxcodec/codec/fx_codec_bmp.cpp10
-rw-r--r--core/src/fxcodec/codec/fx_codec_fax.cpp60
-rw-r--r--core/src/fxcodec/codec/fx_codec_flate.cpp78
-rw-r--r--core/src/fxcodec/codec/fx_codec_gif.cpp14
-rw-r--r--core/src/fxcodec/codec/fx_codec_icc.cpp44
-rw-r--r--core/src/fxcodec/codec/fx_codec_jbig.cpp18
-rw-r--r--core/src/fxcodec/codec/fx_codec_jpeg.cpp50
-rw-r--r--core/src/fxcodec/codec/fx_codec_jpx_opj.cpp16
-rw-r--r--core/src/fxcodec/codec/fx_codec_png.cpp12
-rw-r--r--core/src/fxcodec/codec/fx_codec_progress.cpp100
-rw-r--r--core/src/fxcodec/codec/fx_codec_progress.h36
-rw-r--r--core/src/fxcodec/codec/fx_codec_tiff.cpp32
14 files changed, 332 insertions, 326 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);