summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-03-25 15:18:35 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-25 15:18:36 -0700
commitb5e8f14e3eefc5da995b332788d3203cee204883 (patch)
tree34fc80504d2034013b18f30df1b0f6f1a94e2d70 /core/fxcodec/codec
parent6d18bd3b8ec82ae3c24a439f5c7925786a0e2d8b (diff)
downloadpdfium-chromium/2695.tar.xz
Remove FX_DWORD from core/ and delete definitionchromium/2695chromium/2694chromium/2693chromium/2692
Review URL: https://codereview.chromium.org/1832173003
Diffstat (limited to 'core/fxcodec/codec')
-rw-r--r--core/fxcodec/codec/codec_int.h118
-rw-r--r--core/fxcodec/codec/fx_codec.cpp44
-rw-r--r--core/fxcodec/codec/fx_codec_bmp.cpp8
-rw-r--r--core/fxcodec/codec/fx_codec_fax.cpp28
-rw-r--r--core/fxcodec/codec/fx_codec_flate.cpp124
-rw-r--r--core/fxcodec/codec/fx_codec_gif.cpp10
-rw-r--r--core/fxcodec/codec/fx_codec_icc.cpp82
-rw-r--r--core/fxcodec/codec/fx_codec_jbig.cpp10
-rw-r--r--core/fxcodec/codec/fx_codec_jpeg.cpp66
-rw-r--r--core/fxcodec/codec/fx_codec_jpx_opj.cpp28
-rw-r--r--core/fxcodec/codec/fx_codec_png.cpp2
-rw-r--r--core/fxcodec/codec/fx_codec_progress.cpp104
-rw-r--r--core/fxcodec/codec/fx_codec_progress.h10
-rw-r--r--core/fxcodec/codec/fx_codec_tiff.cpp74
14 files changed, 354 insertions, 354 deletions
diff --git a/core/fxcodec/codec/codec_int.h b/core/fxcodec/codec/codec_int.h
index d19a694222..c7bd9fc6fe 100644
--- a/core/fxcodec/codec/codec_int.h
+++ b/core/fxcodec/codec/codec_int.h
@@ -26,15 +26,15 @@ class CCodec_BasicModule : public ICodec_BasicModule {
public:
// ICodec_BasicModule:
FX_BOOL RunLengthEncode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) override;
+ uint32_t& dest_size) override;
FX_BOOL A85Encode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) override;
+ uint32_t& dest_size) override;
ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int nComps,
@@ -60,7 +60,7 @@ class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder {
protected:
class ImageDataCache {
public:
- ImageDataCache(int width, int height, FX_DWORD pitch);
+ ImageDataCache(int width, int height, uint32_t pitch);
~ImageDataCache();
bool AllocateCache();
@@ -77,7 +77,7 @@ class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder {
const int m_Width;
const int m_Height;
- const FX_DWORD m_Pitch;
+ const uint32_t m_Pitch;
int m_nCachedLines;
std::unique_ptr<uint8_t, FxFreeDeleter> m_Data;
};
@@ -95,7 +95,7 @@ class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder {
int m_OutputHeight;
int m_nComps;
int m_bpc;
- FX_DWORD m_Pitch;
+ uint32_t m_Pitch;
FX_BOOL m_bColorTransformed;
int m_NextLine;
uint8_t* m_pLastScanline;
@@ -106,7 +106,7 @@ class CCodec_FaxModule : public ICodec_FaxModule {
public:
// ICodec_FaxModule:
ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int K,
@@ -120,13 +120,13 @@ class CCodec_FaxModule : public ICodec_FaxModule {
int height,
int pitch,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) override;
+ uint32_t& dest_size) override;
};
class CCodec_FlateModule : public ICodec_FlateModule {
public:
virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int nComps,
@@ -135,60 +135,60 @@ class CCodec_FlateModule : public ICodec_FlateModule {
int Colors,
int BitsPerComponent,
int Columns);
- virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW,
+ virtual uint32_t FlateOrLZWDecode(FX_BOOL bLZW,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
FX_BOOL bEarlyChange,
int predictor,
int Colors,
int BitsPerComponent,
int Columns,
- FX_DWORD estimated_size,
+ uint32_t estimated_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
+ uint32_t& dest_size);
virtual FX_BOOL Encode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int predictor,
int Colors,
int BitsPerComponent,
int Columns,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
+ uint32_t& dest_size);
virtual FX_BOOL Encode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
+ uint32_t& dest_size);
};
class CCodec_JpegModule : public ICodec_JpegModule {
public:
CCodec_JpegModule() {}
ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int nComps,
FX_BOOL ColorTransform) override;
FX_BOOL LoadInfo(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int& width,
int& height,
int& num_components,
int& bits_per_components,
FX_BOOL& color_transform,
uint8_t** icc_buf_ptr,
- FX_DWORD* icc_length) override;
+ uint32_t* icc_length) override;
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) override;
+ uint32_t icc_length) override;
void* Start() override;
void Finish(void* pContext) override;
void Input(void* pContext,
const uint8_t* src_buf,
- FX_DWORD src_size) override;
+ uint32_t src_size) override;
#ifndef PDF_ENABLE_XFA
int ReadHeader(void* pContext, int* width, int* height, int* nComps) override;
#else // PDF_ENABLE_XFA
@@ -200,7 +200,7 @@ class CCodec_JpegModule : public ICodec_JpegModule {
#endif // PDF_ENABLE_XFA
int StartScanline(void* pContext, int down_scale) override;
FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) override;
- FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override;
+ uint32_t GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override;
};
#ifdef PDF_ENABLE_XFA
@@ -213,7 +213,7 @@ class CCodec_PngModule : public ICodec_PngModule {
virtual void Finish(void* pContext);
virtual FX_BOOL Input(void* pContext,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CFX_DIBAttribute* pAttribute);
protected:
@@ -224,8 +224,8 @@ class CCodec_GifModule : public ICodec_GifModule {
CCodec_GifModule() { FXSYS_memset(m_szLastError, '\0', 256); }
virtual void* Start(void* pModule);
virtual void Finish(void* pContext);
- 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 uint32_t GetAvailInput(void* pContext, uint8_t** avail_buf_ptr);
+ virtual void Input(void* pContext, const uint8_t* src_buf, uint32_t src_size);
virtual int32_t ReadHeader(void* pContext,
int* width,
@@ -249,17 +249,17 @@ class CCodec_BmpModule : public ICodec_BmpModule {
CCodec_BmpModule() { FXSYS_memset(m_szLastError, 0, sizeof(m_szLastError)); }
void* Start(void* pModule) override;
void Finish(void* pContext) override;
- FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override;
+ uint32_t GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override;
void Input(void* pContext,
const uint8_t* src_buf,
- FX_DWORD src_size) override;
+ uint32_t src_size) override;
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,
+ uint32_t** pal_pp,
CFX_DIBAttribute* pAttribute) override;
int32_t LoadImage(void* pContext) override;
@@ -279,25 +279,25 @@ class CCodec_IccModule : public ICodec_IccModule {
void* CreateTransform(ICodec_IccModule::IccParam* pInputParam,
ICodec_IccModule::IccParam* pOutputParam,
ICodec_IccModule::IccParam* pProofParam = NULL,
- FX_DWORD dwIntent = Icc_INTENT_PERCEPTUAL,
- FX_DWORD dwFlag = Icc_FLAGS_DEFAULT,
- FX_DWORD dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC,
- FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTPROOFING) override;
+ uint32_t dwIntent = Icc_INTENT_PERCEPTUAL,
+ uint32_t dwFlag = Icc_FLAGS_DEFAULT,
+ uint32_t dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC,
+ uint32_t dwPrfFlag = Icc_FLAGS_SOFTPROOFING) override;
void* CreateTransform_sRGB(
const uint8_t* pProfileData,
- FX_DWORD dwProfileSize,
- FX_DWORD& nComponents,
+ uint32_t dwProfileSize,
+ uint32_t& nComponents,
int32_t intent = 0,
- FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT) override;
+ uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT) override;
void* CreateTransform_CMYK(
const uint8_t* pSrcProfileData,
- FX_DWORD dwSrcProfileSize,
- FX_DWORD& nSrcComponents,
+ uint32_t dwSrcProfileSize,
+ uint32_t& nSrcComponents,
const uint8_t* pDstProfileData,
- FX_DWORD dwDstProfileSize,
+ uint32_t dwDstProfileSize,
int32_t intent = 0,
- FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT,
- FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT) override;
+ uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT,
+ uint32_t dwDstFormat = Icc_FORMAT_DEFAULT) override;
void DestroyTransform(void* pTransform) override;
void Translate(void* pTransform,
FX_FLOAT* pSrcValues,
@@ -306,7 +306,7 @@ class CCodec_IccModule : public ICodec_IccModule {
uint8_t* pDest,
const uint8_t* pSrc,
int pixels) override;
- void SetComponents(FX_DWORD nComponents) override {
+ void SetComponents(uint32_t nComponents) override {
m_nComponents = nComponents;
}
@@ -321,7 +321,7 @@ class CCodec_IccModule : public ICodec_IccModule {
Icc_CLASS ic,
CFX_BinaryBuf* pTransformKey);
- FX_DWORD m_nComponents;
+ uint32_t m_nComponents;
std::map<CFX_ByteString, CFX_IccTransformCache*> m_MapTranform;
std::map<CFX_ByteString, CFX_IccProfileCache*> m_MapProfile;
};
@@ -333,12 +333,12 @@ class CCodec_JpxModule : public ICodec_JpxModule {
// ICodec_JpxModule:
CJPX_Decoder* CreateDecoder(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CPDF_ColorSpace* cs) override;
void GetImageInfo(CJPX_Decoder* pDecoder,
- FX_DWORD* width,
- FX_DWORD* height,
- FX_DWORD* components) override;
+ uint32_t* width,
+ uint32_t* height,
+ uint32_t* components) override;
bool Decode(CJPX_Decoder* pDecoder,
uint8_t* dest_data,
int pitch,
@@ -354,10 +354,10 @@ class CCodec_TiffModule : public ICodec_TiffModule {
void GetFrames(void* ctx, int32_t& frames) override;
FX_BOOL LoadFrameInfo(void* ctx,
int32_t frame,
- FX_DWORD& width,
- FX_DWORD& height,
- FX_DWORD& comps,
- FX_DWORD& bpc,
+ uint32_t& width,
+ uint32_t& height,
+ uint32_t& comps,
+ uint32_t& bpc,
CFX_DIBAttribute* pAttribute) override;
FX_BOOL Decode(void* ctx, class CFX_DIBitmap* pDIBitmap) override;
void DestroyDecoder(void* ctx) override;
@@ -372,12 +372,12 @@ class CCodec_Jbig2Context {
CCodec_Jbig2Context();
~CCodec_Jbig2Context() {}
- FX_DWORD m_width;
- FX_DWORD m_height;
+ uint32_t m_width;
+ uint32_t m_height;
CPDF_StreamAcc* m_pGlobalStream;
CPDF_StreamAcc* m_pSrcStream;
uint8_t* m_dest_buf;
- FX_DWORD m_dest_pitch;
+ uint32_t m_dest_pitch;
IFX_Pause* m_pPause;
CJBig2_Context* m_pContext;
CJBig2_Image* m_dest_image;
@@ -391,12 +391,12 @@ class CCodec_Jbig2Module : public ICodec_Jbig2Module {
void* CreateJbig2Context() override;
FXCODEC_STATUS StartDecode(void* pJbig2Context,
CFX_PrivateData* pPrivateData,
- FX_DWORD width,
- FX_DWORD height,
+ uint32_t width,
+ uint32_t height,
CPDF_StreamAcc* src_stream,
CPDF_StreamAcc* global_stream,
uint8_t* dest_buf,
- FX_DWORD dest_pitch,
+ uint32_t dest_pitch,
IFX_Pause* pPause) override;
FXCODEC_STATUS ContinueDecode(void* pJbig2Context,
IFX_Pause* pPause) override;
diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp
index 92dba69acf..0952c809ac 100644
--- a/core/fxcodec/codec/fx_codec.cpp
+++ b/core/fxcodec/codec/fx_codec.cpp
@@ -32,7 +32,7 @@ CCodec_ModuleMgr::CCodec_ModuleMgr()
CCodec_ScanlineDecoder::ImageDataCache::ImageDataCache(int width,
int height,
- FX_DWORD pitch)
+ uint32_t pitch)
: m_Width(width), m_Height(height), m_Pitch(pitch), m_nCachedLines(0) {}
CCodec_ScanlineDecoder::ImageDataCache::~ImageDataCache() {}
@@ -147,9 +147,9 @@ void CCodec_ScanlineDecoder::DownScale(int dest_width, int dest_height) {
}
FX_BOOL CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
return FALSE;
}
@@ -256,9 +256,9 @@ extern "C" double FXstrtod(const char* nptr, char** endptr) {
#undef EXPONENT_DETECT
FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
return FALSE;
}
@@ -287,7 +287,7 @@ class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder {
~CCodec_RLScanlineDecoder() override;
FX_BOOL Create(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int nComps,
@@ -297,7 +297,7 @@ class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder {
void v_DownScale(int dest_width, int dest_height) override {}
FX_BOOL v_Rewind() override;
uint8_t* v_GetNextLine() override;
- FX_DWORD GetSrcOffset() override { return m_SrcOffset; }
+ uint32_t GetSrcOffset() override { return m_SrcOffset; }
protected:
FX_BOOL CheckDestSize();
@@ -306,9 +306,9 @@ class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder {
uint8_t* m_pScanline;
const uint8_t* m_pSrcBuf;
- FX_DWORD m_SrcSize;
- FX_DWORD m_dwLineBytes;
- FX_DWORD m_SrcOffset;
+ uint32_t m_SrcSize;
+ uint32_t m_dwLineBytes;
+ uint32_t m_SrcOffset;
FX_BOOL m_bEOD;
uint8_t m_Operator;
};
@@ -324,9 +324,9 @@ CCodec_RLScanlineDecoder::~CCodec_RLScanlineDecoder() {
FX_Free(m_pScanline);
}
FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() {
- FX_DWORD i = 0;
- FX_DWORD old_size = 0;
- FX_DWORD dest_size = 0;
+ uint32_t i = 0;
+ uint32_t old_size = 0;
+ uint32_t dest_size = 0;
while (i < m_SrcSize) {
if (m_pSrcBuf[i] < 128) {
old_size = dest_size;
@@ -346,14 +346,14 @@ FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() {
break;
}
}
- if (((FX_DWORD)m_OrigWidth * m_nComps * m_bpc * m_OrigHeight + 7) / 8 >
+ if (((uint32_t)m_OrigWidth * m_nComps * m_bpc * m_OrigHeight + 7) / 8 >
dest_size) {
return FALSE;
}
return TRUE;
}
FX_BOOL CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int nComps,
@@ -378,7 +378,7 @@ FX_BOOL CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf,
}
m_Pitch = pitch.ValueOrDie();
// Overflow should already have been checked before this is called.
- m_dwLineBytes = (static_cast<FX_DWORD>(width) * nComps * bpc + 7) / 8;
+ m_dwLineBytes = (static_cast<uint32_t>(width) * nComps * bpc + 7) / 8;
m_pScanline = FX_Alloc(uint8_t, m_Pitch);
return CheckDestSize();
}
@@ -398,11 +398,11 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() {
}
}
FXSYS_memset(m_pScanline, 0, m_Pitch);
- FX_DWORD col_pos = 0;
+ uint32_t col_pos = 0;
FX_BOOL eol = FALSE;
while (m_SrcOffset < m_SrcSize && !eol) {
if (m_Operator < 128) {
- FX_DWORD copy_len = m_Operator + 1;
+ uint32_t copy_len = m_Operator + 1;
if (col_pos + copy_len >= m_dwLineBytes) {
copy_len = m_dwLineBytes - col_pos;
eol = TRUE;
@@ -419,7 +419,7 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() {
if (m_SrcOffset - 1 < m_SrcSize - 1) {
fill = m_pSrcBuf[m_SrcOffset];
}
- FX_DWORD duplicate_len = 257 - m_Operator;
+ uint32_t duplicate_len = 257 - m_Operator;
if (col_pos + duplicate_len >= m_dwLineBytes) {
duplicate_len = m_dwLineBytes - col_pos;
eol = TRUE;
@@ -447,7 +447,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) {
return;
}
if (m_Operator < 128) {
- FXSYS_assert((FX_DWORD)m_Operator + 1 >= used_bytes);
+ FXSYS_assert((uint32_t)m_Operator + 1 >= used_bytes);
if (used_bytes == m_Operator + 1) {
m_SrcOffset += used_bytes;
GetNextOperator();
@@ -461,7 +461,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) {
return;
}
uint8_t count = 257 - m_Operator;
- FXSYS_assert((FX_DWORD)count >= used_bytes);
+ FXSYS_assert((uint32_t)count >= used_bytes);
if (used_bytes == count) {
m_SrcOffset++;
GetNextOperator();
@@ -472,7 +472,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) {
}
ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int nComps,
diff --git a/core/fxcodec/codec/fx_codec_bmp.cpp b/core/fxcodec/codec/fx_codec_bmp.cpp
index d2299d6e56..31383774aa 100644
--- a/core/fxcodec/codec/fx_codec_bmp.cpp
+++ b/core/fxcodec/codec/fx_codec_bmp.cpp
@@ -37,7 +37,7 @@ static void bmp_read_scanline(bmp_decompress_struct_p bmp_ptr,
pModule->ReadScanlineCallback(p->child_ptr, row_num, row_buf);
}
static FX_BOOL bmp_get_data_position(bmp_decompress_struct_p bmp_ptr,
- FX_DWORD rcd_pos) {
+ uint32_t rcd_pos) {
FXBMP_Context* p = (FXBMP_Context*)bmp_ptr->context_ptr;
CCodec_BmpModule* pModule = (CCodec_BmpModule*)p->parent_ptr;
return pModule->InputImagePositionBufCallback(p->child_ptr, rcd_pos);
@@ -81,7 +81,7 @@ int32_t CCodec_BmpModule::ReadHeader(void* pContext,
FX_BOOL* tb_flag,
int32_t* components,
int32_t* pal_num,
- FX_DWORD** pal_pp,
+ uint32_t** pal_pp,
CFX_DIBAttribute* pAttribute) {
FXBMP_Context* p = (FXBMP_Context*)pContext;
if (setjmp(p->bmp_ptr->jmpbuf)) {
@@ -112,14 +112,14 @@ int32_t CCodec_BmpModule::LoadImage(void* pContext) {
}
return bmp_decode_image(p->bmp_ptr);
}
-FX_DWORD CCodec_BmpModule::GetAvailInput(void* pContext,
+uint32_t 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,
const uint8_t* src_buf,
- FX_DWORD src_size) {
+ uint32_t src_size) {
FXBMP_Context* p = (FXBMP_Context*)pContext;
bmp_input_buffer(p->bmp_ptr, (uint8_t*)src_buf, src_size);
}
diff --git a/core/fxcodec/codec/fx_codec_fax.cpp b/core/fxcodec/codec/fx_codec_fax.cpp
index 13ffcda174..0ccebba14e 100644
--- a/core/fxcodec/codec/fx_codec_fax.cpp
+++ b/core/fxcodec/codec/fx_codec_fax.cpp
@@ -257,7 +257,7 @@ int FaxGetRun(const uint8_t* ins_array,
const uint8_t* src_buf,
int& bitpos,
int bitsize) {
- FX_DWORD code = 0;
+ uint32_t code = 0;
int ins_off = 0;
while (1) {
uint8_t ins = ins_array[ins_off++];
@@ -602,7 +602,7 @@ class CCodec_FaxDecoder : public CCodec_ScanlineDecoder {
~CCodec_FaxDecoder() override;
FX_BOOL Create(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int K,
@@ -616,12 +616,12 @@ class CCodec_FaxDecoder : public CCodec_ScanlineDecoder {
void v_DownScale(int dest_width, int dest_height) override {}
FX_BOOL v_Rewind() override;
uint8_t* v_GetNextLine() override;
- FX_DWORD GetSrcOffset() override;
+ uint32_t GetSrcOffset() override;
int m_Encoding, m_bEndOfLine, m_bByteAlign, m_bBlack;
int bitpos;
const uint8_t* m_pSrcBuf;
- FX_DWORD m_SrcSize;
+ uint32_t m_SrcSize;
uint8_t* m_pScanlineBuf;
uint8_t* m_pRefBuf;
};
@@ -635,7 +635,7 @@ CCodec_FaxDecoder::~CCodec_FaxDecoder() {
FX_Free(m_pRefBuf);
}
FX_BOOL CCodec_FaxDecoder::Create(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int K,
@@ -657,7 +657,7 @@ FX_BOOL CCodec_FaxDecoder::Create(const uint8_t* src_buf,
m_OrigHeight = height;
}
// Should not overflow. Checked by FPDFAPI_CreateFaxDecoder.
- m_Pitch = (static_cast<FX_DWORD>(m_OrigWidth) + 31) / 32 * 4;
+ m_Pitch = (static_cast<uint32_t>(m_OrigWidth) + 31) / 32 * 4;
m_OutputWidth = m_OrigWidth;
m_OutputHeight = m_OrigHeight;
m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch);
@@ -717,14 +717,14 @@ uint8_t* CCodec_FaxDecoder::v_GetNextLine() {
}
}
if (m_bBlack) {
- for (FX_DWORD i = 0; i < m_Pitch; i++) {
+ for (uint32_t i = 0; i < m_Pitch; i++) {
m_pScanlineBuf[i] = ~m_pScanlineBuf[i];
}
}
return m_pScanlineBuf;
}
-FX_DWORD CCodec_FaxDecoder::GetSrcOffset() {
- FX_DWORD ret = (bitpos + 7) / 8;
+uint32_t CCodec_FaxDecoder::GetSrcOffset() {
+ uint32_t ret = (bitpos + 7) / 8;
if (ret > m_SrcSize) {
ret = m_SrcSize;
}
@@ -732,7 +732,7 @@ FX_DWORD CCodec_FaxDecoder::GetSrcOffset() {
}
void FaxG4Decode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int* pbitpos,
uint8_t* dest_buf,
int width,
@@ -758,7 +758,7 @@ class CCodec_FaxEncoder {
public:
CCodec_FaxEncoder(const uint8_t* src_buf, int width, int height, int pitch);
~CCodec_FaxEncoder();
- void Encode(uint8_t*& dest_buf, FX_DWORD& dest_size);
+ void Encode(uint8_t*& dest_buf, uint32_t& dest_size);
void Encode2DLine(const uint8_t* scan_line);
CFX_BinaryBuf m_DestBuf;
uint8_t* m_pRefLine;
@@ -783,7 +783,7 @@ CCodec_FaxEncoder::~CCodec_FaxEncoder() {
FX_Free(m_pRefLine);
FX_Free(m_pLineBuf);
}
-void CCodec_FaxEncoder::Encode(uint8_t*& dest_buf, FX_DWORD& dest_size) {
+void CCodec_FaxEncoder::Encode(uint8_t*& dest_buf, uint32_t& dest_size) {
int dest_bitpos = 0;
uint8_t last_byte = 0;
for (int i = 0; i < m_Rows; i++) {
@@ -807,14 +807,14 @@ FX_BOOL CCodec_FaxModule::Encode(const uint8_t* src_buf,
int height,
int pitch,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
CCodec_FaxEncoder encoder(src_buf, width, height, pitch);
encoder.Encode(dest_buf, dest_size);
return TRUE;
}
ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int K,
diff --git a/core/fxcodec/codec/fx_codec_flate.cpp b/core/fxcodec/codec/fx_codec_flate.cpp
index d4ad241a4d..e69c017ee7 100644
--- a/core/fxcodec/codec/fx_codec_flate.cpp
+++ b/core/fxcodec/codec/fx_codec_flate.cpp
@@ -83,27 +83,27 @@ namespace {
class CLZWDecoder {
public:
int Decode(uint8_t* output,
- FX_DWORD& outlen,
+ uint32_t& outlen,
const uint8_t* input,
- FX_DWORD& size,
+ uint32_t& size,
FX_BOOL bEarlyChange);
private:
- void AddCode(FX_DWORD prefix_code, uint8_t append_char);
- void DecodeString(FX_DWORD code);
+ void AddCode(uint32_t prefix_code, uint8_t append_char);
+ void DecodeString(uint32_t code);
- FX_DWORD m_InPos;
- FX_DWORD m_OutPos;
+ uint32_t m_InPos;
+ uint32_t m_OutPos;
uint8_t* m_pOutput;
const uint8_t* m_pInput;
FX_BOOL m_Early;
- FX_DWORD m_CodeArray[5021];
- FX_DWORD m_nCodes;
+ uint32_t m_CodeArray[5021];
+ uint32_t m_nCodes;
uint8_t m_DecodeStack[4000];
- FX_DWORD m_StackLen;
+ uint32_t m_StackLen;
int m_CodeLen;
};
-void CLZWDecoder::AddCode(FX_DWORD prefix_code, uint8_t append_char) {
+void CLZWDecoder::AddCode(uint32_t prefix_code, uint8_t append_char) {
if (m_nCodes + m_Early == 4094) {
return;
}
@@ -116,13 +116,13 @@ void CLZWDecoder::AddCode(FX_DWORD prefix_code, uint8_t append_char) {
m_CodeLen = 12;
}
}
-void CLZWDecoder::DecodeString(FX_DWORD code) {
+void CLZWDecoder::DecodeString(uint32_t code) {
while (1) {
int index = code - 258;
if (index < 0 || index >= (int)m_nCodes) {
break;
}
- FX_DWORD data = m_CodeArray[index];
+ uint32_t data = m_CodeArray[index];
if (m_StackLen >= sizeof(m_DecodeStack)) {
return;
}
@@ -135,9 +135,9 @@ void CLZWDecoder::DecodeString(FX_DWORD code) {
m_DecodeStack[m_StackLen++] = (uint8_t)code;
}
int CLZWDecoder::Decode(uint8_t* dest_buf,
- FX_DWORD& dest_size,
+ uint32_t& dest_size,
const uint8_t* src_buf,
- FX_DWORD& src_size,
+ uint32_t& src_size,
FX_BOOL bEarlyChange) {
m_CodeLen = 9;
m_InPos = 0;
@@ -146,7 +146,7 @@ int CLZWDecoder::Decode(uint8_t* dest_buf,
m_pOutput = dest_buf;
m_Early = bEarlyChange ? 1 : 0;
m_nCodes = 0;
- FX_DWORD old_code = (FX_DWORD)-1;
+ uint32_t old_code = (uint32_t)-1;
uint8_t last_char = 0;
while (1) {
if (m_InPos + m_CodeLen > src_size * 8) {
@@ -154,7 +154,7 @@ int CLZWDecoder::Decode(uint8_t* dest_buf,
}
int byte_pos = m_InPos / 8;
int bit_pos = m_InPos % 8, bit_left = m_CodeLen;
- FX_DWORD code = 0;
+ uint32_t code = 0;
if (bit_pos) {
bit_left -= 8 - bit_pos;
code = (m_pInput[byte_pos++] & ((1 << (8 - bit_pos)) - 1)) << bit_left;
@@ -178,18 +178,18 @@ int CLZWDecoder::Decode(uint8_t* dest_buf,
}
m_OutPos++;
last_char = (uint8_t)code;
- if (old_code != (FX_DWORD)-1) {
+ if (old_code != (uint32_t)-1) {
AddCode(old_code, last_char);
}
old_code = code;
} else if (code == 256) {
m_CodeLen = 9;
m_nCodes = 0;
- old_code = (FX_DWORD)-1;
+ old_code = (uint32_t)-1;
} else if (code == 257) {
break;
} else {
- if (old_code == (FX_DWORD)-1) {
+ if (old_code == (uint32_t)-1) {
return 2;
}
m_StackLen = 0;
@@ -205,7 +205,7 @@ int CLZWDecoder::Decode(uint8_t* dest_buf,
return -5;
}
if (m_pOutput) {
- for (FX_DWORD i = 0; i < m_StackLen; i++) {
+ for (uint32_t i = 0; i < m_StackLen; i++) {
m_pOutput[m_OutPos + i] = m_DecodeStack[m_StackLen - i - 1];
}
}
@@ -243,7 +243,7 @@ uint8_t PaethPredictor(int a, int b, int c) {
}
FX_BOOL PNG_PredictorEncode(uint8_t*& data_buf,
- FX_DWORD& data_size,
+ uint32_t& data_size,
int predictor,
int Colors,
int BitsPerComponent,
@@ -400,7 +400,7 @@ void PNG_PredictLine(uint8_t* pDestData,
}
FX_BOOL PNG_Predictor(uint8_t*& data_buf,
- FX_DWORD& data_size,
+ uint32_t& data_size,
int Colors,
int BitsPerComponent,
int Columns) {
@@ -540,7 +540,7 @@ void TIFF_PredictorEncodeLine(uint8_t* dest_buf,
}
FX_BOOL TIFF_PredictorEncode(uint8_t*& data_buf,
- FX_DWORD& data_size,
+ uint32_t& data_size,
int Colors,
int BitsPerComponent,
int Columns) {
@@ -561,7 +561,7 @@ FX_BOOL TIFF_PredictorEncode(uint8_t*& data_buf,
}
void TIFF_PredictLine(uint8_t* dest_buf,
- FX_DWORD row_size,
+ uint32_t row_size,
int BitsPerComponent,
int Colors,
int Columns) {
@@ -586,7 +586,7 @@ void TIFF_PredictLine(uint8_t* dest_buf,
}
int BytesPerPixel = BitsPerComponent * Colors / 8;
if (BitsPerComponent == 16) {
- for (FX_DWORD i = BytesPerPixel; i < row_size; i += 2) {
+ for (uint32_t i = BytesPerPixel; i < row_size; i += 2) {
uint16_t pixel =
(dest_buf[i - BytesPerPixel] << 8) | dest_buf[i - BytesPerPixel + 1];
pixel += (dest_buf[i] << 8) | dest_buf[i + 1];
@@ -594,14 +594,14 @@ void TIFF_PredictLine(uint8_t* dest_buf,
dest_buf[i + 1] = (uint8_t)pixel;
}
} else {
- for (FX_DWORD i = BytesPerPixel; i < row_size; i++) {
+ for (uint32_t i = BytesPerPixel; i < row_size; i++) {
dest_buf[i] += dest_buf[i - BytesPerPixel];
}
}
}
FX_BOOL TIFF_Predictor(uint8_t*& data_buf,
- FX_DWORD& data_size,
+ uint32_t& data_size,
int Colors,
int BitsPerComponent,
int Columns) {
@@ -621,21 +621,21 @@ FX_BOOL TIFF_Predictor(uint8_t*& data_buf,
}
void FlateUncompress(const uint8_t* src_buf,
- FX_DWORD src_size,
- FX_DWORD orig_size,
+ uint32_t src_size,
+ uint32_t orig_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size,
- FX_DWORD& offset) {
- FX_DWORD guess_size = orig_size ? orig_size : src_size * 2;
- const FX_DWORD kStepSize = 10240;
- FX_DWORD alloc_step = orig_size ? kStepSize : std::min(src_size, kStepSize);
- static const FX_DWORD kMaxInitialAllocSize = 10000000;
+ uint32_t& dest_size,
+ uint32_t& offset) {
+ uint32_t guess_size = orig_size ? orig_size : src_size * 2;
+ const uint32_t kStepSize = 10240;
+ uint32_t alloc_step = orig_size ? kStepSize : std::min(src_size, kStepSize);
+ static const uint32_t kMaxInitialAllocSize = 10000000;
if (guess_size > kMaxInitialAllocSize) {
guess_size = kMaxInitialAllocSize;
alloc_step = kMaxInitialAllocSize;
}
- FX_DWORD buf_size = guess_size;
- FX_DWORD last_buf_size = buf_size;
+ uint32_t buf_size = guess_size;
+ uint32_t last_buf_size = buf_size;
dest_buf = nullptr;
dest_size = 0;
@@ -660,7 +660,7 @@ void FlateUncompress(const uint8_t* src_buf,
if (avail_buf_size != 0)
break;
- FX_DWORD old_size = guess_size;
+ uint32_t old_size = guess_size;
guess_size += alloc_step;
if (guess_size < old_size || guess_size + 1 < guess_size) {
FPDFAPI_FlateEnd(context);
@@ -715,10 +715,10 @@ void FlateUncompress(const uint8_t* src_buf,
dest_buf = result_tmp_bufs[0];
} else {
uint8_t* result_buf = FX_Alloc(uint8_t, dest_size);
- FX_DWORD result_pos = 0;
+ uint32_t result_pos = 0;
for (int32_t i = 0; i < result_tmp_bufs.GetSize(); i++) {
uint8_t* tmp_buf = result_tmp_bufs[i];
- FX_DWORD tmp_buf_size = buf_size;
+ uint32_t tmp_buf_size = buf_size;
if (i == result_tmp_bufs.GetSize() - 1) {
tmp_buf_size = last_buf_size;
}
@@ -740,7 +740,7 @@ class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder {
~CCodec_FlateScanlineDecoder() override;
void Create(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int nComps,
@@ -755,11 +755,11 @@ class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder {
void v_DownScale(int dest_width, int dest_height) override {}
FX_BOOL v_Rewind() override;
uint8_t* v_GetNextLine() override;
- FX_DWORD GetSrcOffset() override;
+ uint32_t GetSrcOffset() override;
void* m_pFlate;
const uint8_t* m_SrcBuf;
- FX_DWORD m_SrcSize;
+ uint32_t m_SrcSize;
uint8_t* m_pScanline;
uint8_t* m_pLastLine;
uint8_t* m_pPredictBuffer;
@@ -768,7 +768,7 @@ class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder {
int m_Colors;
int m_BitsPerComponent;
int m_Columns;
- FX_DWORD m_PredictPitch;
+ uint32_t m_PredictPitch;
size_t m_LeftOver;
};
@@ -790,7 +790,7 @@ CCodec_FlateScanlineDecoder::~CCodec_FlateScanlineDecoder() {
}
}
void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int nComps,
@@ -806,7 +806,7 @@ void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf,
m_nComps = nComps;
m_bpc = bpc;
m_bColorTransformed = FALSE;
- m_Pitch = (static_cast<FX_DWORD>(width) * nComps * bpc + 7) / 8;
+ m_Pitch = (static_cast<uint32_t>(width) * nComps * bpc + 7) / 8;
m_pScanline = FX_Alloc(uint8_t, m_Pitch);
m_Predictor = 0;
if (predictor) {
@@ -825,7 +825,7 @@ void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf,
m_BitsPerComponent = BitsPerComponent;
m_Columns = Columns;
m_PredictPitch =
- (static_cast<FX_DWORD>(m_BitsPerComponent) * m_Colors * m_Columns +
+ (static_cast<uint32_t>(m_BitsPerComponent) * m_Colors * m_Columns +
7) /
8;
m_pLastLine = FX_Alloc(uint8_t, m_PredictPitch);
@@ -894,13 +894,13 @@ uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() {
}
return m_pScanline;
}
-FX_DWORD CCodec_FlateScanlineDecoder::GetSrcOffset() {
+uint32_t CCodec_FlateScanlineDecoder::GetSrcOffset() {
return FPDFAPI_FlateGetTotalIn(m_pFlate);
}
ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int nComps,
@@ -914,19 +914,19 @@ ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(
Colors, BitsPerComponent, Columns);
return pDecoder;
}
-FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW,
+uint32_t CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
FX_BOOL bEarlyChange,
int predictor,
int Colors,
int BitsPerComponent,
int Columns,
- FX_DWORD estimated_size,
+ uint32_t estimated_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
dest_buf = NULL;
- FX_DWORD offset = 0;
+ uint32_t offset = 0;
int predictor_type = 0;
if (predictor) {
if (predictor >= 10) {
@@ -938,11 +938,11 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW,
if (bLZW) {
{
std::unique_ptr<CLZWDecoder> decoder(new CLZWDecoder);
- dest_size = (FX_DWORD)-1;
+ dest_size = (uint32_t)-1;
offset = src_size;
int err = decoder->Decode(NULL, dest_size, src_buf, offset, bEarlyChange);
if (err || dest_size == 0 || dest_size + 1 < dest_size) {
- return static_cast<FX_DWORD>(-1);
+ return static_cast<uint32_t>(-1);
}
}
{
@@ -965,16 +965,16 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW,
ret =
TIFF_Predictor(dest_buf, dest_size, Colors, BitsPerComponent, Columns);
}
- return ret ? offset : static_cast<FX_DWORD>(-1);
+ return ret ? offset : static_cast<uint32_t>(-1);
}
FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int predictor,
int Colors,
int BitsPerComponent,
int Columns,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
if (predictor != 2 && predictor < 10) {
return Encode(src_buf, src_size, dest_buf, dest_size);
}
@@ -995,13 +995,13 @@ FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf,
return ret;
}
FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
dest_size = src_size + src_size / 1000 + 12;
dest_buf = FX_Alloc(uint8_t, dest_size);
unsigned long temp_size = dest_size;
FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size);
- dest_size = (FX_DWORD)temp_size;
+ dest_size = (uint32_t)temp_size;
return TRUE;
}
diff --git a/core/fxcodec/codec/fx_codec_gif.cpp b/core/fxcodec/codec/fx_codec_gif.cpp
index 60ca00f9fa..1657d7257e 100644
--- a/core/fxcodec/codec/fx_codec_gif.cpp
+++ b/core/fxcodec/codec/fx_codec_gif.cpp
@@ -37,7 +37,7 @@ static uint8_t* gif_ask_buf_for_pal(gif_decompress_struct_p gif_ptr,
p->child_ptr, gif_get_frame_num(gif_ptr), pal_size);
}
static void gif_record_current_position(gif_decompress_struct_p gif_ptr,
- FX_DWORD* cur_pos_ptr) {
+ uint32_t* cur_pos_ptr) {
FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr;
CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
pModule->RecordCurrentPositionCallback(p->child_ptr, *cur_pos_ptr);
@@ -50,7 +50,7 @@ static void gif_read_scanline(gif_decompress_struct_p gif_ptr,
pModule->ReadScanlineCallback(p->child_ptr, row_num, row_buf);
}
static FX_BOOL gif_get_record_position(gif_decompress_struct_p gif_ptr,
- FX_DWORD cur_pos,
+ uint32_t cur_pos,
int32_t left,
int32_t top,
int32_t width,
@@ -155,7 +155,7 @@ int32_t CCodec_GifModule::LoadFrame(void* pContext,
if (p->gif_ptr->cmt_data_ptr) {
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();
+ uint32_t len = p->gif_ptr->cmt_data_ptr->GetLength();
if (len > 21) {
uint8_t size = *buf++;
if (size) {
@@ -174,14 +174,14 @@ int32_t CCodec_GifModule::LoadFrame(void* pContext,
}
return ret;
}
-FX_DWORD CCodec_GifModule::GetAvailInput(void* pContext,
+uint32_t 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,
const uint8_t* src_buf,
- FX_DWORD src_size) {
+ uint32_t src_size) {
FXGIF_Context* p = (FXGIF_Context*)pContext;
gif_input_buffer(p->gif_ptr, (uint8_t*)src_buf, src_size);
}
diff --git a/core/fxcodec/codec/fx_codec_icc.cpp b/core/fxcodec/codec/fx_codec_icc.cpp
index fc8113e4e6..13280d7f49 100644
--- a/core/fxcodec/codec/fx_codec_icc.cpp
+++ b/core/fxcodec/codec/fx_codec_icc.cpp
@@ -8,13 +8,13 @@
#include "core/include/fxcodec/fx_codec.h"
#include "third_party/lcms2-2.6/include/lcms2.h"
-const FX_DWORD N_COMPONENT_LAB = 3;
-const FX_DWORD N_COMPONENT_GRAY = 1;
-const FX_DWORD N_COMPONENT_RGB = 3;
-const FX_DWORD N_COMPONENT_CMYK = 4;
-const FX_DWORD N_COMPONENT_DEFAULT = 3;
+const uint32_t N_COMPONENT_LAB = 3;
+const uint32_t N_COMPONENT_GRAY = 1;
+const uint32_t N_COMPONENT_RGB = 3;
+const uint32_t N_COMPONENT_CMYK = 4;
+const uint32_t N_COMPONENT_DEFAULT = 3;
-FX_BOOL MD5ComputeID(const void* buf, FX_DWORD dwSize, uint8_t ID[16]) {
+FX_BOOL MD5ComputeID(const void* buf, uint32_t dwSize, uint8_t ID[16]) {
return cmsMD5computeIDExt(buf, dwSize, ID);
}
struct CLcmsCmm {
@@ -67,8 +67,8 @@ FX_BOOL CheckComponents(cmsColorSpaceSignature cs,
return TRUE;
}
-FX_DWORD GetCSComponents(cmsColorSpaceSignature cs) {
- FX_DWORD components;
+uint32_t GetCSComponents(cmsColorSpaceSignature cs) {
+ uint32_t components;
switch (cs) {
case cmsSigLabData:
components = N_COMPONENT_LAB;
@@ -90,14 +90,14 @@ FX_DWORD GetCSComponents(cmsColorSpaceSignature cs) {
}
void* IccLib_CreateTransform(const unsigned char* pSrcProfileData,
- FX_DWORD dwSrcProfileSize,
- FX_DWORD& nSrcComponents,
+ uint32_t dwSrcProfileSize,
+ uint32_t& nSrcComponents,
const unsigned char* pDstProfileData,
- FX_DWORD dwDstProfileSize,
+ uint32_t dwDstProfileSize,
int32_t nDstComponents,
int intent,
- FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT,
- FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT) {
+ uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT,
+ uint32_t dwDstFormat = Icc_FORMAT_DEFAULT) {
cmsHPROFILE srcProfile = NULL;
cmsHPROFILE dstProfile = NULL;
cmsHTRANSFORM hTransform = NULL;
@@ -170,10 +170,10 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData,
return pCmm;
}
void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData,
- FX_DWORD dwProfileSize,
- FX_DWORD& nComponents,
+ uint32_t dwProfileSize,
+ uint32_t& nComponents,
int32_t intent,
- FX_DWORD dwSrcFormat) {
+ uint32_t dwSrcFormat) {
return IccLib_CreateTransform(pProfileData, dwProfileSize, nComponents, NULL,
0, 3, intent, dwSrcFormat);
}
@@ -185,7 +185,7 @@ void IccLib_DestroyTransform(void* pTransform) {
delete (CLcmsCmm*)pTransform;
}
void IccLib_Translate(void* pTransform,
- FX_DWORD nSrcComponents,
+ uint32_t nSrcComponents,
FX_FLOAT* pSrcValues,
FX_FLOAT* pDestValues) {
if (!pTransform) {
@@ -196,14 +196,14 @@ void IccLib_Translate(void* pTransform,
if (p->m_bLab) {
CFX_FixedBufGrow<double, 16> inputs(nSrcComponents);
double* input = inputs;
- for (FX_DWORD i = 0; i < nSrcComponents; i++) {
+ for (uint32_t i = 0; i < nSrcComponents; i++) {
input[i] = pSrcValues[i];
}
cmsDoTransform(p->m_hTransform, input, output, 1);
} else {
CFX_FixedBufGrow<uint8_t, 16> inputs(nSrcComponents);
uint8_t* input = inputs;
- for (FX_DWORD i = 0; i < nSrcComponents; i++) {
+ for (uint32_t i = 0; i < nSrcComponents; i++) {
if (pSrcValues[i] > 1.0f) {
input[i] = 255;
} else if (pSrcValues[i] < 0) {
@@ -284,7 +284,7 @@ ICodec_IccModule::IccCS GetProfileCSFromHandle(void* pProfile) {
}
ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(
const uint8_t* pProfileData,
- FX_DWORD dwProfileSize) {
+ uint32_t dwProfileSize) {
ICodec_IccModule::IccCS cs;
cmsHPROFILE hProfile =
cmsOpenProfileFromMem((void*)pProfileData, dwProfileSize);
@@ -302,14 +302,14 @@ ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(IFX_FileRead* pFile) {
return IccCS_Unknown;
}
ICodec_IccModule::IccCS cs;
- FX_DWORD dwSize = (FX_DWORD)pFile->GetSize();
+ uint32_t dwSize = (uint32_t)pFile->GetSize();
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(void* pProfile, FX_DWORD dwFormat) {
+uint32_t TransferProfileType(void* pProfile, uint32_t dwFormat) {
cmsColorSpaceSignature cs = cmsGetColorSpace(pProfile);
switch (cs) {
case cmsSigXYZData:
@@ -359,7 +359,7 @@ class CFX_IccProfileCache {
CFX_IccProfileCache();
~CFX_IccProfileCache();
void* m_pProfile;
- FX_DWORD m_dwRate;
+ uint32_t m_dwRate;
protected:
void Purge();
@@ -379,7 +379,7 @@ class CFX_IccTransformCache {
CFX_IccTransformCache(CLcmsCmm* pCmm = NULL);
~CFX_IccTransformCache();
void* m_pIccTransform;
- FX_DWORD m_dwRate;
+ uint32_t m_dwRate;
CLcmsCmm* m_pCmm;
protected:
@@ -400,10 +400,10 @@ void CFX_IccTransformCache::Purge() {}
class CFX_ByteStringKey : public CFX_BinaryBuf {
public:
CFX_ByteStringKey() : CFX_BinaryBuf() {}
- CFX_ByteStringKey& operator<<(FX_DWORD i);
+ CFX_ByteStringKey& operator<<(uint32_t i);
};
-CFX_ByteStringKey& CFX_ByteStringKey::operator<<(FX_DWORD i) {
- AppendBlock(&i, sizeof(FX_DWORD));
+CFX_ByteStringKey& CFX_ByteStringKey::operator<<(uint32_t i) {
+ AppendBlock(&i, sizeof(uint32_t));
return *this;
}
void* CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam,
@@ -472,10 +472,10 @@ 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) {
+ uint32_t dwIntent,
+ uint32_t dwFlag,
+ uint32_t dwPrfIntent,
+ uint32_t dwPrfFlag) {
CLcmsCmm* pCmm = NULL;
ASSERT(pInputParam && pOutputParam);
CFX_ByteStringKey key;
@@ -487,9 +487,9 @@ void* CCodec_IccModule::CreateTransform(
if (!pOutputProfile) {
return NULL;
}
- FX_DWORD dwInputProfileType =
+ uint32_t dwInputProfileType =
TransferProfileType(pInputProfile, pInputParam->dwFormat);
- FX_DWORD dwOutputProfileType =
+ uint32_t dwOutputProfileType =
TransferProfileType(pOutputProfile, pOutputParam->dwFormat);
if (dwInputProfileType == 0 || dwOutputProfileType == 0) {
return NULL;
@@ -537,22 +537,22 @@ CCodec_IccModule::~CCodec_IccModule() {
m_MapTranform.clear();
}
void* CCodec_IccModule::CreateTransform_sRGB(const uint8_t* pProfileData,
- FX_DWORD dwProfileSize,
- FX_DWORD& nComponents,
+ uint32_t dwProfileSize,
+ uint32_t& nComponents,
int32_t intent,
- FX_DWORD dwSrcFormat) {
+ uint32_t dwSrcFormat) {
return IccLib_CreateTransform_sRGB(pProfileData, dwProfileSize, nComponents,
intent, dwSrcFormat);
}
void* CCodec_IccModule::CreateTransform_CMYK(const uint8_t* pSrcProfileData,
- FX_DWORD dwSrcProfileSize,
- FX_DWORD& nSrcComponents,
+ uint32_t dwSrcProfileSize,
+ uint32_t& nSrcComponents,
const uint8_t* pDstProfileData,
- FX_DWORD dwDstProfileSize,
+ uint32_t dwDstProfileSize,
int32_t intent,
- FX_DWORD dwSrcFormat,
- FX_DWORD dwDstFormat) {
+ uint32_t dwSrcFormat,
+ uint32_t dwDstFormat) {
return IccLib_CreateTransform(
pSrcProfileData, dwSrcProfileSize, nSrcComponents, pDstProfileData,
dwDstProfileSize, 4, intent, dwSrcFormat, dwDstFormat);
diff --git a/core/fxcodec/codec/fx_codec_jbig.cpp b/core/fxcodec/codec/fx_codec_jbig.cpp
index 557d246ca4..ddcec6c6bb 100644
--- a/core/fxcodec/codec/fx_codec_jbig.cpp
+++ b/core/fxcodec/codec/fx_codec_jbig.cpp
@@ -58,12 +58,12 @@ void CCodec_Jbig2Module::DestroyJbig2Context(void* pJbig2Content) {
}
FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context,
CFX_PrivateData* pPrivateData,
- FX_DWORD width,
- FX_DWORD height,
+ uint32_t width,
+ uint32_t height,
CPDF_StreamAcc* src_stream,
CPDF_StreamAcc* global_stream,
uint8_t* dest_buf,
- FX_DWORD dest_pitch,
+ uint32_t dest_pitch,
IFX_Pause* pPause) {
if (!pJbig2Context) {
return FXCODEC_STATUS_ERR_PARAMS;
@@ -95,7 +95,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context,
return FXCODEC_STATUS_ERROR;
}
int dword_size = height * dest_pitch / 4;
- FX_DWORD* dword_buf = (FX_DWORD*)dest_buf;
+ uint32_t* dword_buf = (uint32_t*)dest_buf;
for (int i = 0; i < dword_size; i++) {
dword_buf[i] = ~dword_buf[i];
}
@@ -118,7 +118,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::ContinueDecode(void* pJbig2Context,
}
int dword_size =
m_pJbig2Context->m_height * m_pJbig2Context->m_dest_pitch / 4;
- FX_DWORD* dword_buf = (FX_DWORD*)m_pJbig2Context->m_dest_buf;
+ uint32_t* dword_buf = (uint32_t*)m_pJbig2Context->m_dest_buf;
for (int i = 0; i < dword_size; i++) {
dword_buf[i] = ~dword_buf[i];
}
diff --git a/core/fxcodec/codec/fx_codec_jpeg.cpp b/core/fxcodec/codec/fx_codec_jpeg.cpp
index 1b0dff7499..a81926e053 100644
--- a/core/fxcodec/codec/fx_codec_jpeg.cpp
+++ b/core/fxcodec/codec/fx_codec_jpeg.cpp
@@ -23,11 +23,11 @@ extern "C" {
}
extern "C" {
-static void _JpegScanSOI(const uint8_t*& src_buf, FX_DWORD& src_size) {
+static void _JpegScanSOI(const uint8_t*& src_buf, uint32_t& src_size) {
if (src_size == 0) {
return;
}
- FX_DWORD offset = 0;
+ uint32_t offset = 0;
while (offset < src_size - 1) {
if (src_buf[offset] == 0xff && src_buf[offset + 1] == 0xd8) {
src_buf += offset;
@@ -81,16 +81,16 @@ static void _error_do_nothing2(j_common_ptr cinfo, char*) {}
#define JPEG_OVERHEAD_LEN 14
static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo,
const uint8_t* icc_buf_ptr,
- FX_DWORD icc_length) {
+ uint32_t icc_length) {
if (!icc_buf_ptr || icc_length == 0) {
return FALSE;
}
- FX_DWORD icc_segment_size = (JPEG_MARKER_MAXSIZE - 2 - JPEG_OVERHEAD_LEN);
- FX_DWORD icc_segment_num = (icc_length / icc_segment_size) + 1;
+ uint32_t icc_segment_size = (JPEG_MARKER_MAXSIZE - 2 - JPEG_OVERHEAD_LEN);
+ uint32_t icc_segment_num = (icc_length / icc_segment_size) + 1;
if (icc_segment_num > 255) {
return FALSE;
}
- FX_DWORD icc_data_length =
+ uint32_t icc_data_length =
JPEG_OVERHEAD_LEN + (icc_segment_num > 1 ? icc_segment_size : icc_length);
uint8_t* icc_data = FX_Alloc(uint8_t, icc_data_length);
FXSYS_memcpy(icc_data, "\x49\x43\x43\x5f\x50\x52\x4f\x46\x49\x4c\x45\x00",
@@ -103,7 +103,7 @@ static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo,
jpeg_write_marker(cinfo, JPEG_MARKER_ICC, icc_data, icc_data_length);
}
icc_data[12] = (uint8_t)icc_segment_num;
- FX_DWORD icc_size = (icc_segment_num - 1) * icc_segment_size;
+ uint32_t icc_size = (icc_segment_num - 1) * icc_segment_size;
FXSYS_memcpy(icc_data + JPEG_OVERHEAD_LEN, icc_buf_ptr + icc_size,
icc_length - icc_size);
jpeg_write_marker(cinfo, JPEG_MARKER_ICC, icc_data,
@@ -125,7 +125,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource,
FX_STRSIZE& dest_size,
int quality,
const uint8_t* icc_buf,
- FX_DWORD icc_length) {
+ uint32_t icc_length) {
struct jpeg_error_mgr jerr;
jerr.error_exit = _error_do_nothing;
jerr.emit_message = _error_do_nothing1;
@@ -138,10 +138,10 @@ static void _JpegEncode(const CFX_DIBSource* pSource,
cinfo.err = &jerr;
jpeg_create_compress(&cinfo);
int Bpp = pSource->GetBPP() / 8;
- FX_DWORD nComponents = Bpp >= 3 ? (pSource->IsCmykImage() ? 4 : 3) : 1;
- FX_DWORD pitch = pSource->GetPitch();
- FX_DWORD width = pdfium::base::checked_cast<FX_DWORD>(pSource->GetWidth());
- FX_DWORD height = pdfium::base::checked_cast<FX_DWORD>(pSource->GetHeight());
+ uint32_t nComponents = Bpp >= 3 ? (pSource->IsCmykImage() ? 4 : 3) : 1;
+ uint32_t pitch = pSource->GetPitch();
+ uint32_t width = pdfium::base::checked_cast<uint32_t>(pSource->GetWidth());
+ uint32_t height = pdfium::base::checked_cast<uint32_t>(pSource->GetHeight());
FX_SAFE_DWORD safe_buf_len = width;
safe_buf_len *= height;
safe_buf_len *= nComponents;
@@ -150,7 +150,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource,
safe_buf_len += 255 * 18;
safe_buf_len += icc_length;
}
- FX_DWORD dest_buf_length = 0;
+ uint32_t dest_buf_length = 0;
if (!safe_buf_len.IsValid()) {
dest_buf = nullptr;
} else {
@@ -199,7 +199,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource,
if (nComponents > 1) {
uint8_t* dest_scan = line_buf;
if (nComponents == 3) {
- for (FX_DWORD i = 0; i < width; i++) {
+ for (uint32_t i = 0; i < width; i++) {
dest_scan[0] = src_scan[2];
dest_scan[1] = src_scan[1];
dest_scan[2] = src_scan[0];
@@ -207,7 +207,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource,
src_scan += Bpp;
}
} else {
- for (FX_DWORD i = 0; i < pitch; i++) {
+ for (uint32_t i = 0; i < pitch; i++) {
*dest_scan++ = ~*src_scan++;
}
}
@@ -246,14 +246,14 @@ static void _JpegLoadAttribute(struct jpeg_decompress_struct* pInfo,
#endif // PDF_ENABLE_XFA
static FX_BOOL _JpegLoadInfo(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int& width,
int& height,
int& num_components,
int& bits_per_components,
FX_BOOL& color_transform,
uint8_t** icc_buf_ptr,
- FX_DWORD* icc_length) {
+ uint32_t* icc_length) {
_JpegScanSOI(src_buf, src_size);
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
@@ -313,7 +313,7 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder {
~CCodec_JpegDecoder() override;
FX_BOOL Create(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int nComps,
@@ -324,7 +324,7 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder {
void v_DownScale(int dest_width, int dest_height) override;
FX_BOOL v_Rewind() override;
uint8_t* v_GetNextLine() override;
- FX_DWORD GetSrcOffset() override;
+ uint32_t GetSrcOffset() override;
FX_BOOL InitDecode();
@@ -333,7 +333,7 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder {
struct jpeg_error_mgr jerr;
struct jpeg_source_mgr src;
const uint8_t* m_SrcBuf;
- FX_DWORD m_SrcSize;
+ uint32_t m_SrcSize;
uint8_t* m_pScanlineBuf;
FX_BOOL m_bInited;
@@ -341,7 +341,7 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder {
FX_BOOL m_bJpegTransform;
protected:
- FX_DWORD m_nDefaultScaleDenom;
+ uint32_t m_nDefaultScaleDenom;
};
CCodec_JpegDecoder::CCodec_JpegDecoder() {
@@ -396,7 +396,7 @@ FX_BOOL CCodec_JpegDecoder::InitDecode() {
return TRUE;
}
FX_BOOL CCodec_JpegDecoder::Create(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int nComps,
@@ -432,7 +432,7 @@ FX_BOOL CCodec_JpegDecoder::Create(const uint8_t* src_buf,
return FALSE;
}
m_Pitch =
- (static_cast<FX_DWORD>(cinfo.image_width) * cinfo.num_components + 3) /
+ (static_cast<uint32_t>(cinfo.image_width) * cinfo.num_components + 3) /
4 * 4;
m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch);
m_nComps = cinfo.num_components;
@@ -467,7 +467,7 @@ void CCodec_JpegDecoder::v_DownScale(int dest_width, int dest_height) {
FX_GetDownsampleRatio(m_OrigWidth, m_OrigHeight, dest_width, dest_height);
m_OutputWidth = (m_OrigWidth + m_DownScale - 1) / m_DownScale;
m_OutputHeight = (m_OrigHeight + m_DownScale - 1) / m_DownScale;
- m_Pitch = (static_cast<FX_DWORD>(m_OutputWidth) * m_nComps + 3) / 4 * 4;
+ m_Pitch = (static_cast<uint32_t>(m_OutputWidth) * m_nComps + 3) / 4 * 4;
if (old_scale != m_DownScale) {
m_NextLine = -1;
}
@@ -506,12 +506,12 @@ uint8_t* CCodec_JpegDecoder::v_GetNextLine() {
}
return m_pScanlineBuf;
}
-FX_DWORD CCodec_JpegDecoder::GetSrcOffset() {
- return (FX_DWORD)(m_SrcSize - src.bytes_in_buffer);
+uint32_t CCodec_JpegDecoder::GetSrcOffset() {
+ return (uint32_t)(m_SrcSize - src.bytes_in_buffer);
}
ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int nComps,
@@ -528,14 +528,14 @@ ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(
return pDecoder;
}
FX_BOOL CCodec_JpegModule::LoadInfo(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int& width,
int& height,
int& num_components,
int& bits_per_components,
FX_BOOL& color_transform,
uint8_t** icc_buf_ptr,
- FX_DWORD* icc_length) {
+ uint32_t* icc_length) {
return _JpegLoadInfo(src_buf, src_size, width, height, num_components,
bits_per_components, color_transform, icc_buf_ptr,
icc_length);
@@ -545,7 +545,7 @@ FX_BOOL CCodec_JpegModule::Encode(const CFX_DIBSource* pSource,
FX_STRSIZE& dest_size,
int quality,
const uint8_t* icc_buf,
- FX_DWORD icc_length) {
+ uint32_t icc_length) {
if (pSource->GetBPP() < 8 || pSource->GetPalette())
return FALSE;
@@ -615,7 +615,7 @@ void CCodec_JpegModule::Finish(void* pContext) {
}
void CCodec_JpegModule::Input(void* pContext,
const unsigned char* src_buf,
- FX_DWORD src_size) {
+ uint32_t src_size) {
FXJPEG_Context* p = (FXJPEG_Context*)pContext;
if (p->m_SkipSize) {
if (p->m_SkipSize > src_size) {
@@ -679,7 +679,7 @@ FX_BOOL CCodec_JpegModule::ReadScanline(void* pContext,
int nlines = jpeg_read_scanlines(&p->m_Info, &dest_buf, 1);
return nlines == 1;
}
-FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext,
+uint32_t CCodec_JpegModule::GetAvailInput(void* pContext,
uint8_t** avail_buf_ptr) {
if (avail_buf_ptr) {
*avail_buf_ptr = NULL;
@@ -688,5 +688,5 @@ FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext,
(uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte;
}
}
- return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer;
+ return (uint32_t)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer;
}
diff --git a/core/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/fxcodec/codec/fx_codec_jpx_opj.cpp
index 99eb78f9f1..27b645c137 100644
--- a/core/fxcodec/codec/fx_codec_jpx_opj.cpp
+++ b/core/fxcodec/codec/fx_codec_jpx_opj.cpp
@@ -675,15 +675,15 @@ class CJPX_Decoder {
public:
explicit CJPX_Decoder(CPDF_ColorSpace* cs);
~CJPX_Decoder();
- FX_BOOL Init(const unsigned char* src_data, FX_DWORD src_size);
- void GetInfo(FX_DWORD* width, FX_DWORD* height, FX_DWORD* components);
+ FX_BOOL Init(const unsigned char* src_data, uint32_t src_size);
+ void GetInfo(uint32_t* width, uint32_t* height, uint32_t* components);
bool Decode(uint8_t* dest_buf,
int pitch,
const std::vector<uint8_t>& offsets);
private:
const uint8_t* m_SrcData;
- FX_DWORD m_SrcSize;
+ uint32_t m_SrcSize;
opj_image_t* image;
opj_codec_t* l_codec;
opj_stream_t* l_stream;
@@ -705,7 +705,7 @@ CJPX_Decoder::~CJPX_Decoder() {
}
}
-FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, FX_DWORD src_size) {
+FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, uint32_t src_size) {
static const unsigned char szJP2Header[] = {
0x00, 0x00, 0x00, 0x0c, 0x6a, 0x50, 0x20, 0x20, 0x0d, 0x0a, 0x87, 0x0a};
if (!src_data || src_size < sizeof(szJP2Header))
@@ -788,12 +788,12 @@ FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, FX_DWORD src_size) {
return TRUE;
}
-void CJPX_Decoder::GetInfo(FX_DWORD* width,
- FX_DWORD* height,
- FX_DWORD* components) {
- *width = (FX_DWORD)image->x1;
- *height = (FX_DWORD)image->y1;
- *components = (FX_DWORD)image->numcomps;
+void CJPX_Decoder::GetInfo(uint32_t* width,
+ uint32_t* height,
+ uint32_t* components) {
+ *width = (uint32_t)image->x1;
+ *height = (uint32_t)image->y1;
+ *components = (uint32_t)image->numcomps;
}
bool CJPX_Decoder::Decode(uint8_t* dest_buf,
@@ -874,16 +874,16 @@ CCodec_JpxModule::CCodec_JpxModule() {}
CCodec_JpxModule::~CCodec_JpxModule() {}
CJPX_Decoder* CCodec_JpxModule::CreateDecoder(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CPDF_ColorSpace* cs) {
std::unique_ptr<CJPX_Decoder> decoder(new CJPX_Decoder(cs));
return decoder->Init(src_buf, src_size) ? decoder.release() : nullptr;
}
void CCodec_JpxModule::GetImageInfo(CJPX_Decoder* pDecoder,
- FX_DWORD* width,
- FX_DWORD* height,
- FX_DWORD* components) {
+ uint32_t* width,
+ uint32_t* height,
+ uint32_t* components) {
pDecoder->GetInfo(width, height, components);
}
diff --git a/core/fxcodec/codec/fx_codec_png.cpp b/core/fxcodec/codec/fx_codec_png.cpp
index a3882ba8fb..f8621001b6 100644
--- a/core/fxcodec/codec/fx_codec_png.cpp
+++ b/core/fxcodec/codec/fx_codec_png.cpp
@@ -239,7 +239,7 @@ void CCodec_PngModule::Finish(void* pContext) {
}
FX_BOOL CCodec_PngModule::Input(void* pContext,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CFX_DIBAttribute* pAttribute) {
FXPNG_Context* p = (FXPNG_Context*)pContext;
if (setjmp(png_jmpbuf(p->png_ptr))) {
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp
index b22d20339b..9e113c695c 100644
--- a/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/fxcodec/codec/fx_codec_progress.cpp
@@ -296,12 +296,12 @@ CCodec_ProgressiveDecoder::~CCodec_ProgressiveDecoder() {
FX_BOOL CCodec_ProgressiveDecoder::JpegReadMoreData(
ICodec_JpegModule* pJpegModule,
FXCODEC_STATUS& err_status) {
- FX_DWORD dwSize = (FX_DWORD)m_pFile->GetSize();
+ uint32_t dwSize = (uint32_t)m_pFile->GetSize();
if (dwSize <= m_offSet) {
return FALSE;
}
dwSize = dwSize - m_offSet;
- FX_DWORD dwAvail = pJpegModule->GetAvailInput(m_pJpegContext, NULL);
+ uint32_t dwAvail = pJpegModule->GetAvailInput(m_pJpegContext, NULL);
if (dwAvail == m_SrcSize) {
if (dwSize > FXCODEC_BLOCK_SIZE) {
dwSize = FXCODEC_BLOCK_SIZE;
@@ -314,7 +314,7 @@ FX_BOOL CCodec_ProgressiveDecoder::JpegReadMoreData(
return FALSE;
}
} else {
- FX_DWORD dwConsume = m_SrcSize - dwAvail;
+ uint32_t dwConsume = m_SrcSize - dwAvail;
if (dwAvail) {
FXSYS_memcpy(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail);
}
@@ -417,13 +417,13 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule,
if (pDIBitmap->GetPalette()) {
return FALSE;
}
- FX_DWORD des_g = 0;
+ uint32_t des_g = 0;
des_g += pPixelWeights->m_Weights[0] * src_scan[src_col];
des_scan[pPixelWeights->m_SrcStart] = (uint8_t)(des_g >> 16);
} break;
case FXDIB_Rgb:
case FXDIB_Rgb32: {
- FX_DWORD des_b = 0, des_g = 0, des_r = 0;
+ uint32_t des_b = 0, des_g = 0, des_r = 0;
const uint8_t* p = src_scan + src_col * src_Bpp;
des_b += pPixelWeights->m_Weights[0] * (*p++);
des_g += pPixelWeights->m_Weights[0] * (*p++);
@@ -434,7 +434,7 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule,
*pDes = (uint8_t)((des_r) >> 16);
} break;
case FXDIB_Argb: {
- FX_DWORD des_r = 0, des_g = 0, des_b = 0;
+ uint32_t des_r = 0, des_g = 0, des_b = 0;
const uint8_t* p = src_scan + src_col * src_Bpp;
des_b += pPixelWeights->m_Weights[0] * (*p++);
des_g += pPixelWeights->m_Weights[0] * (*p++);
@@ -476,7 +476,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(
if (pDeviceBitmap->GetPalette()) {
return;
}
- FX_DWORD des_g = 0;
+ uint32_t des_g = 0;
des_g +=
pPixelWeights->m_Weights[0] * src_scan[pPixelWeights->m_SrcStart];
des_g +=
@@ -485,7 +485,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(
} break;
case FXDIB_Rgb:
case FXDIB_Rgb32: {
- FX_DWORD des_b = 0, des_g = 0, des_r = 0;
+ uint32_t des_b = 0, des_g = 0, des_r = 0;
const uint8_t* p = src_scan;
p = src_scan + pPixelWeights->m_SrcStart * src_Bpp;
des_b += pPixelWeights->m_Weights[0] * (*p++);
@@ -501,7 +501,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(
des_scan += des_Bpp - 3;
} break;
case FXDIB_Argb: {
- FX_DWORD des_a = 0, des_b = 0, des_g = 0, des_r = 0;
+ uint32_t des_a = 0, des_b = 0, des_g = 0, des_r = 0;
const uint8_t* p = src_scan;
p = src_scan + pPixelWeights->m_SrcStart * src_Bpp;
des_b += pPixelWeights->m_Weights[0] * (*p++);
@@ -554,12 +554,12 @@ void CCodec_ProgressiveDecoder::PngFillScanlineBufCompletedFunc(void* pModule,
}
FX_BOOL CCodec_ProgressiveDecoder::GifReadMoreData(ICodec_GifModule* pGifModule,
FXCODEC_STATUS& err_status) {
- FX_DWORD dwSize = (FX_DWORD)m_pFile->GetSize();
+ uint32_t dwSize = (uint32_t)m_pFile->GetSize();
if (dwSize <= m_offSet) {
return FALSE;
}
dwSize = dwSize - m_offSet;
- FX_DWORD dwAvail = pGifModule->GetAvailInput(m_pGifContext, NULL);
+ uint32_t dwAvail = pGifModule->GetAvailInput(m_pGifContext, NULL);
if (dwAvail == m_SrcSize) {
if (dwSize > FXCODEC_BLOCK_SIZE) {
dwSize = FXCODEC_BLOCK_SIZE;
@@ -572,7 +572,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifReadMoreData(ICodec_GifModule* pGifModule,
return FALSE;
}
} else {
- FX_DWORD dwConsume = m_SrcSize - dwAvail;
+ uint32_t dwConsume = m_SrcSize - dwAvail;
if (dwAvail) {
FXSYS_memcpy(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail);
}
@@ -590,9 +590,9 @@ FX_BOOL CCodec_ProgressiveDecoder::GifReadMoreData(ICodec_GifModule* pGifModule,
}
void CCodec_ProgressiveDecoder::GifRecordCurrentPositionCallback(
void* pModule,
- FX_DWORD& cur_pos) {
+ uint32_t& cur_pos) {
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
- FX_DWORD remain_size =
+ uint32_t remain_size =
pCodec->m_pCodecMgr->GetGifModule()->GetAvailInput(pCodec->m_pGifContext);
cur_pos = pCodec->m_offSet - remain_size;
}
@@ -604,7 +604,7 @@ uint8_t* CCodec_ProgressiveDecoder::GifAskLocalPaletteBufCallback(
}
FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(
void* pModule,
- FX_DWORD rcd_pos,
+ uint32_t rcd_pos,
const FX_RECT& img_rc,
int32_t pal_num,
void* pal_ptr,
@@ -637,7 +637,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(
}
pCodec->m_SrcPaletteNumber = pal_num;
for (int i = 0; i < pal_num; i++) {
- FX_DWORD j = i * 3;
+ uint32_t j = i * 3;
pCodec->m_pSrcPalette[i] =
ArgbEncode(0xff, pPalette[j], pPalette[j + 1], pPalette[j + 2]);
}
@@ -738,7 +738,7 @@ void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule,
if (scale_y > 1.0) {
int des_bottom = des_top + pCodec->m_sizeY;
int des_Bpp = pDIBitmap->GetBPP() >> 3;
- FX_DWORD des_ScanOffet = pCodec->m_startX * des_Bpp;
+ uint32_t des_ScanOffet = pCodec->m_startX * des_Bpp;
if (des_row + (int)scale_y >= des_bottom - 1) {
uint8_t* scan_src =
(uint8_t*)pDIBitmap->GetScanline(des_row) + des_ScanOffet;
@@ -746,7 +746,7 @@ void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule,
while (++cur_row < des_bottom) {
uint8_t* scan_des =
(uint8_t*)pDIBitmap->GetScanline(cur_row) + des_ScanOffet;
- FX_DWORD size = pCodec->m_sizeX * des_Bpp;
+ uint32_t size = pCodec->m_sizeX * des_Bpp;
FXSYS_memcpy(scan_des, scan_src, size);
}
}
@@ -761,7 +761,7 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(
double scale_y,
int des_row) {
int des_Bpp = pDeviceBitmap->GetBPP() >> 3;
- FX_DWORD des_ScanOffet = m_startX * des_Bpp;
+ uint32_t des_ScanOffet = m_startX * des_Bpp;
int des_top = m_startY;
int des_row_1 = des_row - int(2 * scale_y);
if (des_row_1 < des_top) {
@@ -794,7 +794,7 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(
} break;
case FXDIB_Rgb:
case FXDIB_Rgb32: {
- FX_DWORD des_b = 0, des_g = 0, des_r = 0;
+ uint32_t des_b = 0, des_g = 0, des_r = 0;
des_b += pWeight->m_Weights[0] * (*scan_src1++);
des_g += pWeight->m_Weights[0] * (*scan_src1++);
des_r += pWeight->m_Weights[0] * (*scan_src1++);
@@ -809,7 +809,7 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(
scan_des += des_Bpp - 3;
} break;
case FXDIB_Argb: {
- FX_DWORD des_a = 0, des_b = 0, des_g = 0, des_r = 0;
+ uint32_t des_a = 0, des_b = 0, des_g = 0, des_r = 0;
des_b += pWeight->m_Weights[0] * (*scan_src1++);
des_g += pWeight->m_Weights[0] * (*scan_src1++);
des_r += pWeight->m_Weights[0] * (*scan_src1++);
@@ -836,12 +836,12 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(
}
FX_BOOL CCodec_ProgressiveDecoder::BmpReadMoreData(ICodec_BmpModule* pBmpModule,
FXCODEC_STATUS& err_status) {
- FX_DWORD dwSize = (FX_DWORD)m_pFile->GetSize();
+ uint32_t dwSize = (uint32_t)m_pFile->GetSize();
if (dwSize <= m_offSet) {
return FALSE;
}
dwSize = dwSize - m_offSet;
- FX_DWORD dwAvail = pBmpModule->GetAvailInput(m_pBmpContext, NULL);
+ uint32_t dwAvail = pBmpModule->GetAvailInput(m_pBmpContext, NULL);
if (dwAvail == m_SrcSize) {
if (dwSize > FXCODEC_BLOCK_SIZE) {
dwSize = FXCODEC_BLOCK_SIZE;
@@ -854,7 +854,7 @@ FX_BOOL CCodec_ProgressiveDecoder::BmpReadMoreData(ICodec_BmpModule* pBmpModule,
return FALSE;
}
} else {
- FX_DWORD dwConsume = m_SrcSize - dwAvail;
+ uint32_t dwConsume = m_SrcSize - dwAvail;
if (dwAvail) {
FXSYS_memcpy(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail);
}
@@ -872,7 +872,7 @@ FX_BOOL CCodec_ProgressiveDecoder::BmpReadMoreData(ICodec_BmpModule* pBmpModule,
}
FX_BOOL CCodec_ProgressiveDecoder::BmpInputImagePositionBufCallback(
void* pModule,
- FX_DWORD rcd_pos) {
+ uint32_t rcd_pos) {
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
pCodec->m_offSet = rcd_pos;
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERROR;
@@ -917,7 +917,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap,
double scale_y,
int des_row) {
int des_Bpp = pDeviceBitmap->GetBPP() >> 3;
- FX_DWORD des_ScanOffet = m_startX * des_Bpp;
+ uint32_t des_ScanOffet = m_startX * des_Bpp;
int des_top = m_startY;
int des_bottom = m_startY + m_sizeY;
int des_row_1 = des_row + int(scale_y);
@@ -927,7 +927,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap,
while (++des_row < des_bottom) {
uint8_t* scan_des =
(uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
- FX_DWORD size = m_sizeX * des_Bpp;
+ uint32_t size = m_sizeX * des_Bpp;
FXSYS_memcpy(scan_des, scan_src, size);
}
return;
@@ -959,7 +959,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap,
} break;
case FXDIB_Rgb:
case FXDIB_Rgb32: {
- FX_DWORD des_b = 0, des_g = 0, des_r = 0;
+ uint32_t des_b = 0, des_g = 0, des_r = 0;
des_b += pWeight->m_Weights[0] * (*scan_src1++);
des_g += pWeight->m_Weights[0] * (*scan_src1++);
des_r += pWeight->m_Weights[0] * (*scan_src1++);
@@ -974,7 +974,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap,
scan_des += des_Bpp - 3;
} break;
case FXDIB_Argb: {
- FX_DWORD des_a = 0, des_b = 0, des_g = 0, des_r = 0;
+ uint32_t des_a = 0, des_b = 0, des_g = 0, des_r = 0;
des_b += pWeight->m_Weights[0] * (*scan_src1++);
des_g += pWeight->m_Weights[0] * (*scan_src1++);
des_r += pWeight->m_Weights[0] * (*scan_src1++);
@@ -998,7 +998,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
FXCODEC_IMAGE_TYPE imageType,
CFX_DIBAttribute* pAttribute) {
m_offSet = 0;
- FX_DWORD size = (FX_DWORD)m_pFile->GetSize();
+ uint32_t size = (uint32_t)m_pFile->GetSize();
if (size > FXCODEC_BLOCK_SIZE) {
size = FXCODEC_BLOCK_SIZE;
}
@@ -1028,7 +1028,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
}
m_offSet += size;
pBmpModule->Input(m_pBmpContext, m_pSrcBuf, size);
- FX_DWORD* pPalette = NULL;
+ uint32_t* pPalette = NULL;
int32_t readResult = pBmpModule->ReadHeader(
m_pBmpContext, &m_SrcWidth, &m_SrcHeight, &m_BmpIsTopBottom,
&m_SrcComponents, &m_SrcPaletteNumber, &pPalette, pAttribute);
@@ -1049,7 +1049,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
if (m_SrcPaletteNumber) {
m_pSrcPalette = FX_Alloc(FX_ARGB, m_SrcPaletteNumber);
FXSYS_memcpy(m_pSrcPalette, pPalette,
- m_SrcPaletteNumber * sizeof(FX_DWORD));
+ m_SrcPaletteNumber * sizeof(uint32_t));
} else {
m_pSrcPalette = nullptr;
}
@@ -1130,8 +1130,8 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
m_offSet += size;
bResult = pPngModule->Input(m_pPngContext, m_pSrcBuf, size, pAttribute);
while (bResult) {
- FX_DWORD remain_size = (FX_DWORD)m_pFile->GetSize() - m_offSet;
- FX_DWORD input_size =
+ uint32_t remain_size = (uint32_t)m_pFile->GetSize() - m_offSet;
+ uint32_t input_size =
remain_size > FXCODEC_BLOCK_SIZE ? FXCODEC_BLOCK_SIZE : remain_size;
if (input_size == 0) {
if (m_pPngContext) {
@@ -1231,10 +1231,10 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
}
int32_t frames = 0;
pTiffModule->GetFrames(m_pTiffContext, frames);
- FX_DWORD bpc;
+ uint32_t bpc;
FX_BOOL ret = pTiffModule->LoadFrameInfo(
- m_pTiffContext, 0, (FX_DWORD&)m_SrcWidth, (FX_DWORD&)m_SrcHeight,
- (FX_DWORD&)m_SrcComponents, bpc, pAttribute);
+ m_pTiffContext, 0, (uint32_t&)m_SrcWidth, (uint32_t&)m_SrcHeight,
+ (uint32_t&)m_SrcComponents, bpc, pAttribute);
m_SrcComponents = 4;
m_clipBox = FX_RECT(0, 0, m_SrcWidth, m_SrcHeight);
if (!ret) {
@@ -1475,7 +1475,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap,
case 1:
return;
case 2: {
- FX_DWORD des_g = 0;
+ uint32_t des_g = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
j++) {
int pixel_weight =
@@ -1499,7 +1499,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap,
(uint8_t)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16));
} break;
case 4: {
- FX_DWORD des_b = 0, des_g = 0, des_r = 0;
+ uint32_t des_b = 0, des_g = 0, des_r = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
j++) {
int pixel_weight =
@@ -1513,7 +1513,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap,
(uint8_t)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16));
} break;
case 5: {
- FX_DWORD des_b = 0, des_g = 0, des_r = 0;
+ uint32_t des_b = 0, des_g = 0, des_r = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
j++) {
int pixel_weight =
@@ -1533,7 +1533,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap,
case 6:
return;
case 7: {
- FX_DWORD des_g = 0;
+ uint32_t des_g = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
j++) {
int pixel_weight =
@@ -1594,7 +1594,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap,
}
} break;
case 9: {
- FX_DWORD des_b = 0, des_g = 0, des_r = 0;
+ uint32_t des_b = 0, des_g = 0, des_r = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
j++) {
int pixel_weight =
@@ -1610,7 +1610,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap,
des_scan += des_Bpp - 3;
} break;
case 10: {
- FX_DWORD des_b = 0, des_g = 0, des_r = 0;
+ uint32_t des_b = 0, des_g = 0, des_r = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
j++) {
int pixel_weight =
@@ -1630,7 +1630,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap,
des_scan += des_Bpp - 3;
} break;
case 11: {
- FX_DWORD des_alpha = 0, des_r = 0, des_g = 0, des_b = 0;
+ uint32_t 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 =
@@ -1656,7 +1656,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap,
double scale_y,
int des_row) {
int des_Bpp = pDeviceBitmap->GetBPP() >> 3;
- FX_DWORD des_ScanOffet = m_startX * des_Bpp;
+ uint32_t des_ScanOffet = m_startX * des_Bpp;
if (m_bInterpol) {
int des_top = m_startY;
int des_row_1 = des_row - int(scale_y);
@@ -1668,7 +1668,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap,
while (++des_row < des_bottom) {
uint8_t* scan_des =
(uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
- FX_DWORD size = m_sizeX * des_Bpp;
+ uint32_t size = m_sizeX * des_Bpp;
FXSYS_memcpy(scan_des, scan_src, size);
}
}
@@ -1702,7 +1702,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap,
} break;
case FXDIB_Rgb:
case FXDIB_Rgb32: {
- FX_DWORD des_b = 0, des_g = 0, des_r = 0;
+ uint32_t des_b = 0, des_g = 0, des_r = 0;
des_b += pWeight->m_Weights[0] * (*scan_src1++);
des_g += pWeight->m_Weights[0] * (*scan_src1++);
des_r += pWeight->m_Weights[0] * (*scan_src1++);
@@ -1717,7 +1717,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap,
scan_des += des_Bpp - 3;
} break;
case FXDIB_Argb: {
- FX_DWORD des_a = 0, des_b = 0, des_g = 0, des_r = 0;
+ uint32_t des_a = 0, des_b = 0, des_g = 0, des_r = 0;
des_b += pWeight->m_Weights[0] * (*scan_src1++);
des_g += pWeight->m_Weights[0] * (*scan_src1++);
des_r += pWeight->m_Weights[0] * (*scan_src1++);
@@ -1743,7 +1743,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap,
while (++des_row < des_bottom) {
uint8_t* scan_des =
(uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
- FX_DWORD size = m_sizeX * des_Bpp;
+ uint32_t size = m_sizeX * des_Bpp;
FXSYS_memcpy(scan_des, scan_src, size);
}
}
@@ -1759,7 +1759,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap,
}
uint8_t* scan_des =
(uint8_t*)pDeviceBitmap->GetScanline(des_row + i) + des_ScanOffet;
- FX_DWORD size = m_sizeX * des_Bpp;
+ uint32_t size = m_sizeX * des_Bpp;
FXSYS_memcpy(scan_des, scan_src, size);
}
}
@@ -2063,8 +2063,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) {
case FXCODEC_IMAGE_PNG: {
ICodec_PngModule* pPngModule = m_pCodecMgr->GetPngModule();
while (TRUE) {
- FX_DWORD remain_size = (FX_DWORD)m_pFile->GetSize() - m_offSet;
- FX_DWORD input_size =
+ uint32_t remain_size = (uint32_t)m_pFile->GetSize() - m_offSet;
+ uint32_t input_size =
remain_size > FXCODEC_BLOCK_SIZE ? FXCODEC_BLOCK_SIZE : remain_size;
if (input_size == 0) {
if (m_pPngContext) {
diff --git a/core/fxcodec/codec/fx_codec_progress.h b/core/fxcodec/codec/fx_codec_progress.h
index e4335ccf47..ccd52a95b1 100644
--- a/core/fxcodec/codec/fx_codec_progress.h
+++ b/core/fxcodec/codec/fx_codec_progress.h
@@ -122,12 +122,12 @@ class CCodec_ProgressiveDecoder : public ICodec_ProgressiveDecoder {
int pass,
int line);
static void GifRecordCurrentPositionCallback(void* pModule,
- FX_DWORD& cur_pos);
+ uint32_t& cur_pos);
static uint8_t* GifAskLocalPaletteBufCallback(void* pModule,
int32_t frame_num,
int32_t pal_size);
static FX_BOOL GifInputRecordPositionBufCallback(void* pModule,
- FX_DWORD rcd_pos,
+ uint32_t rcd_pos,
const FX_RECT& img_rc,
int32_t pal_num,
void* pal_ptr,
@@ -140,7 +140,7 @@ class CCodec_ProgressiveDecoder : public ICodec_ProgressiveDecoder {
int32_t row_num,
uint8_t* row_buf);
static FX_BOOL BmpInputImagePositionBufCallback(void* pModule,
- FX_DWORD rcd_pos);
+ uint32_t rcd_pos);
static void BmpReadScanlineCallback(void* pModule,
int32_t row_num,
uint8_t* row_buf);
@@ -182,9 +182,9 @@ class CCodec_ProgressiveDecoder : public ICodec_ProgressiveDecoder {
void* m_pBmpContext;
void* m_pTiffContext;
FXCODEC_IMAGE_TYPE m_imagType;
- FX_DWORD m_offSet;
+ uint32_t m_offSet;
uint8_t* m_pSrcBuf;
- FX_DWORD m_SrcSize;
+ uint32_t m_SrcSize;
uint8_t* m_pDecodeBuf;
int m_ScanlineSize;
CFX_DIBitmap* m_pDeviceBitmap;
diff --git a/core/fxcodec/codec/fx_codec_tiff.cpp b/core/fxcodec/codec/fx_codec_tiff.cpp
index 58f08707cb..96249f9d14 100644
--- a/core/fxcodec/codec/fx_codec_tiff.cpp
+++ b/core/fxcodec/codec/fx_codec_tiff.cpp
@@ -16,7 +16,7 @@ void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData,
unsigned int dwProfileSize,
int nComponents,
int intent,
- FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT);
+ uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT);
void IccLib_TranslateImage(void* pTransform,
unsigned char* pDest,
const unsigned char* pSrc,
@@ -30,10 +30,10 @@ class CCodec_TiffContext {
FX_BOOL InitDecoder(IFX_FileRead* file_ptr);
void GetFrames(int32_t& frames);
FX_BOOL LoadFrameInfo(int32_t frame,
- FX_DWORD& width,
- FX_DWORD& height,
- FX_DWORD& comps,
- FX_DWORD& bpc,
+ uint32_t& width,
+ uint32_t& height,
+ uint32_t& comps,
+ uint32_t& bpc,
CFX_DIBAttribute* pAttribute);
FX_BOOL Decode(CFX_DIBitmap* pDIBitmap);
@@ -42,7 +42,7 @@ class CCodec_TiffContext {
IFX_FileStream* out;
} io;
- FX_DWORD offset;
+ uint32_t offset;
TIFF* tif_ctx;
void* icc_ctx;
@@ -98,7 +98,7 @@ static tsize_t _tiff_read(thandle_t context, tdata_t buf, tsize_t length) {
if (!ret) {
return 0;
}
- pTiffContext->offset += (FX_DWORD)length;
+ pTiffContext->offset += (uint32_t)length;
return length;
}
static tsize_t _tiff_write(thandle_t context, tdata_t buf, tsize_t length) {
@@ -107,17 +107,17 @@ static tsize_t _tiff_write(thandle_t context, tdata_t buf, tsize_t length) {
if (!pTiffContext->io.out->WriteBlock(buf, pTiffContext->offset, length)) {
return 0;
}
- pTiffContext->offset += (FX_DWORD)length;
+ pTiffContext->offset += (uint32_t)length;
return length;
}
static toff_t _tiff_seek(thandle_t context, toff_t offset, int whence) {
CCodec_TiffContext* pTiffContext = (CCodec_TiffContext*)context;
switch (whence) {
case 0:
- pTiffContext->offset = (FX_DWORD)offset;
+ pTiffContext->offset = (uint32_t)offset;
break;
case 1:
- pTiffContext->offset += (FX_DWORD)offset;
+ pTiffContext->offset += (uint32_t)offset;
break;
case 2:
if (pTiffContext->isDecoder) {
@@ -125,20 +125,20 @@ static toff_t _tiff_seek(thandle_t context, toff_t offset, int whence) {
return static_cast<toff_t>(-1);
}
pTiffContext->offset =
- (FX_DWORD)(pTiffContext->io.in->GetSize() - offset);
+ (uint32_t)(pTiffContext->io.in->GetSize() - offset);
} else {
if (pTiffContext->io.out->GetSize() < (FX_FILESIZE)offset) {
return static_cast<toff_t>(-1);
}
pTiffContext->offset =
- (FX_DWORD)(pTiffContext->io.out->GetSize() - offset);
+ (uint32_t)(pTiffContext->io.out->GetSize() - offset);
}
break;
default:
return static_cast<toff_t>(-1);
}
ASSERT(pTiffContext->isDecoder ? (pTiffContext->offset <=
- (FX_DWORD)pTiffContext->io.in->GetSize())
+ (uint32_t)pTiffContext->io.in->GetSize())
: TRUE);
return pTiffContext->offset;
}
@@ -234,7 +234,7 @@ void CCodec_TiffContext::GetFrames(int32_t& frames) {
(key) = NULL;
#define TIFF_EXIF_GETSTRINGINFO(key, tag) \
{ \
- FX_DWORD size = 0; \
+ uint32_t size = 0; \
uint8_t* buf = NULL; \
TIFFGetField(tif_ctx, tag, &size, &buf); \
if (size && buf) { \
@@ -277,20 +277,20 @@ void Tiff_Exif_GetStringInfo(TIFF* tif_ctx,
} // namespace
FX_BOOL CCodec_TiffContext::LoadFrameInfo(int32_t frame,
- FX_DWORD& width,
- FX_DWORD& height,
- FX_DWORD& comps,
- FX_DWORD& bpc,
+ uint32_t& width,
+ uint32_t& height,
+ uint32_t& comps,
+ uint32_t& bpc,
CFX_DIBAttribute* pAttribute) {
if (!TIFFSetDirectory(tif_ctx, (uint16)frame)) {
return FALSE;
}
uint16_t tif_cs;
- FX_DWORD tif_icc_size = 0;
+ uint32_t tif_icc_size = 0;
uint8_t* tif_icc_buf = NULL;
uint16_t tif_bpc = 0;
uint16_t tif_cps;
- FX_DWORD tif_rps;
+ uint32_t tif_rps;
width = height = comps = 0;
TIFFGetField(tif_ctx, TIFFTAG_IMAGEWIDTH, &width);
TIFFGetField(tif_ctx, TIFFTAG_IMAGELENGTH, &height);
@@ -379,10 +379,10 @@ void CCodec_TiffContext::SetPalette(CFX_DIBitmap* pDIBitmap, uint16_t bps) {
}
int32_t len = 1 << bps;
for (int32_t index = 0; index < len; index++) {
- FX_DWORD r = red_orig[index] & 0xFF;
- FX_DWORD g = green_orig[index] & 0xFF;
- FX_DWORD b = blue_orig[index] & 0xFF;
- FX_DWORD color = (uint32_t)b | ((uint32_t)g << 8) | ((uint32_t)r << 16) |
+ uint32_t r = red_orig[index] & 0xFF;
+ uint32_t g = green_orig[index] & 0xFF;
+ uint32_t b = blue_orig[index] & 0xFF;
+ uint32_t color = (uint32_t)b | ((uint32_t)g << 8) | ((uint32_t)r << 16) |
(((uint32)0xffL) << 24);
pDIBitmap->SetPaletteEntry(index, color);
}
@@ -404,7 +404,7 @@ FX_BOOL CCodec_TiffContext::Decode1bppRGB(CFX_DIBitmap* pDIBitmap,
return FALSE;
}
uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer();
- FX_DWORD pitch = pDIBitmap->GetPitch();
+ uint32_t pitch = pDIBitmap->GetPitch();
for (int32_t row = 0; row < height; row++) {
TIFFReadScanline(tif_ctx, buf, row, 0);
for (int32_t j = 0; j < size; j++) {
@@ -431,7 +431,7 @@ FX_BOOL CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap,
return FALSE;
}
uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer();
- FX_DWORD pitch = pDIBitmap->GetPitch();
+ uint32_t pitch = pDIBitmap->GetPitch();
for (int32_t row = 0; row < height; row++) {
TIFFReadScanline(tif_ctx, buf, row, 0);
for (int32_t j = 0; j < size; j++) {
@@ -464,7 +464,7 @@ FX_BOOL CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap,
return FALSE;
}
uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer();
- FX_DWORD pitch = pDIBitmap->GetPitch();
+ uint32_t pitch = pDIBitmap->GetPitch();
for (int32_t row = 0; row < height; row++) {
TIFFReadScanline(tif_ctx, buf, row, 0);
for (int32_t j = 0; j < size - 2; j += 3) {
@@ -477,10 +477,10 @@ FX_BOOL CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap,
return TRUE;
}
FX_BOOL CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) {
- FX_DWORD img_wid = pDIBitmap->GetWidth();
- FX_DWORD img_hei = pDIBitmap->GetHeight();
- FX_DWORD width = 0;
- FX_DWORD height = 0;
+ uint32_t img_wid = pDIBitmap->GetWidth();
+ uint32_t img_hei = pDIBitmap->GetHeight();
+ uint32_t width = 0;
+ uint32_t height = 0;
TIFFGetField(tif_ctx, TIFFTAG_IMAGEWIDTH, &width);
TIFFGetField(tif_ctx, TIFFTAG_IMAGELENGTH, &height);
if (img_wid != width || img_hei != height) {
@@ -492,7 +492,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++) {
+ for (uint32_t row = 0; row < img_hei; row++) {
uint8_t* row_buf = (uint8_t*)pDIBitmap->GetScanline(row);
_TiffBGRA2RGBA(row_buf, img_wid, 4);
}
@@ -502,7 +502,7 @@ FX_BOOL CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) {
uint16_t spp, bps;
TIFFGetField(tif_ctx, TIFFTAG_SAMPLESPERPIXEL, &spp);
TIFFGetField(tif_ctx, TIFFTAG_BITSPERSAMPLE, &bps);
- FX_DWORD bpp = bps * spp;
+ uint32_t bpp = bps * spp;
if (bpp == 1) {
return Decode1bppRGB(pDIBitmap, height, width, bps, spp);
} else if (bpp <= 8) {
@@ -526,10 +526,10 @@ void CCodec_TiffModule::GetFrames(void* ctx, int32_t& frames) {
}
FX_BOOL CCodec_TiffModule::LoadFrameInfo(void* ctx,
int32_t frame,
- FX_DWORD& width,
- FX_DWORD& height,
- FX_DWORD& comps,
- FX_DWORD& bpc,
+ uint32_t& width,
+ uint32_t& height,
+ uint32_t& comps,
+ uint32_t& bpc,
CFX_DIBAttribute* pAttribute) {
CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx;
return pDecoder->LoadFrameInfo(frame, width, height, comps, bpc, pAttribute);