summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec/codec')
-rw-r--r--core/fxcodec/codec/ccodec_bmpmodule.h4
-rw-r--r--core/fxcodec/codec/ccodec_flatemodule.h4
-rw-r--r--core/fxcodec/codec/ccodec_gifmodule.h20
-rw-r--r--core/fxcodec/codec/ccodec_jpegmodule.h6
-rw-r--r--core/fxcodec/codec/ccodec_pngmodule.h26
-rw-r--r--core/fxcodec/codec/ccodec_progressivedecoder.h67
-rw-r--r--core/fxcodec/codec/ccodec_scanlinedecoder.h4
-rw-r--r--core/fxcodec/codec/fx_codec.cpp68
-rw-r--r--core/fxcodec/codec/fx_codec_bmp.cpp6
-rw-r--r--core/fxcodec/codec/fx_codec_fax.cpp76
-rw-r--r--core/fxcodec/codec/fx_codec_flate.cpp50
-rw-r--r--core/fxcodec/codec/fx_codec_gif.cpp26
-rw-r--r--core/fxcodec/codec/fx_codec_icc.cpp28
-rw-r--r--core/fxcodec/codec/fx_codec_jpeg.cpp107
-rw-r--r--core/fxcodec/codec/fx_codec_jpx_opj.cpp24
-rw-r--r--core/fxcodec/codec/fx_codec_png.cpp12
-rw-r--r--core/fxcodec/codec/fx_codec_progress.cpp195
17 files changed, 357 insertions, 366 deletions
diff --git a/core/fxcodec/codec/ccodec_bmpmodule.h b/core/fxcodec/codec/ccodec_bmpmodule.h
index f5e5417924..605bd620c2 100644
--- a/core/fxcodec/codec/ccodec_bmpmodule.h
+++ b/core/fxcodec/codec/ccodec_bmpmodule.h
@@ -27,14 +27,14 @@ class CCodec_BmpModule {
int32_t ReadHeader(FXBMP_Context* pContext,
int32_t* width,
int32_t* height,
- FX_BOOL* tb_flag,
+ bool* tb_flag,
int32_t* components,
int32_t* pal_num,
uint32_t** pal_pp,
CFX_DIBAttribute* pAttribute);
int32_t LoadImage(FXBMP_Context* pContext);
- FX_BOOL (*InputImagePositionBufCallback)(void* pModule, uint32_t rcd_pos);
+ bool (*InputImagePositionBufCallback)(void* pModule, uint32_t rcd_pos);
void (*ReadScanlineCallback)(void* pModule,
int32_t row_num,
uint8_t* row_buf);
diff --git a/core/fxcodec/codec/ccodec_flatemodule.h b/core/fxcodec/codec/ccodec_flatemodule.h
index 0b91f0a8c3..ee8fd8defd 100644
--- a/core/fxcodec/codec/ccodec_flatemodule.h
+++ b/core/fxcodec/codec/ccodec_flatemodule.h
@@ -23,10 +23,10 @@ class CCodec_FlateModule {
int Colors,
int BitsPerComponent,
int Columns);
- uint32_t FlateOrLZWDecode(FX_BOOL bLZW,
+ uint32_t FlateOrLZWDecode(bool bLZW,
const uint8_t* src_buf,
uint32_t src_size,
- FX_BOOL bEarlyChange,
+ bool bEarlyChange,
int predictor,
int Colors,
int BitsPerComponent,
diff --git a/core/fxcodec/codec/ccodec_gifmodule.h b/core/fxcodec/codec/ccodec_gifmodule.h
index 0281e69c33..fac621d256 100644
--- a/core/fxcodec/codec/ccodec_gifmodule.h
+++ b/core/fxcodec/codec/ccodec_gifmodule.h
@@ -42,16 +42,16 @@ class CCodec_GifModule {
uint8_t* (*AskLocalPaletteBufCallback)(void* pModule,
int32_t frame_num,
int32_t pal_size);
- FX_BOOL (*InputRecordPositionBufCallback)(void* pModule,
- uint32_t 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);
+ bool (*InputRecordPositionBufCallback)(void* pModule,
+ uint32_t rcd_pos,
+ const FX_RECT& img_rc,
+ int32_t pal_num,
+ void* pal_ptr,
+ int32_t delay_time,
+ bool user_input,
+ int32_t trans_index,
+ int32_t disposal_method,
+ bool interlace);
void (*ReadScanlineCallback)(void* pModule,
int32_t row_num,
uint8_t* row_buf);
diff --git a/core/fxcodec/codec/ccodec_jpegmodule.h b/core/fxcodec/codec/ccodec_jpegmodule.h
index 225fd98467..db7f3dfb77 100644
--- a/core/fxcodec/codec/ccodec_jpegmodule.h
+++ b/core/fxcodec/codec/ccodec_jpegmodule.h
@@ -26,7 +26,7 @@ class CCodec_JpegModule {
int width,
int height,
int nComps,
- FX_BOOL ColorTransform);
+ bool ColorTransform);
bool LoadInfo(const uint8_t* src_buf,
uint32_t src_size,
int* width,
@@ -53,8 +53,8 @@ class CCodec_JpegModule {
CFX_DIBAttribute* pAttribute);
#endif // PDF_ENABLE_XFA
- FX_BOOL StartScanline(FXJPEG_Context* pContext, int down_scale);
- FX_BOOL ReadScanline(FXJPEG_Context* pContext, uint8_t* dest_buf);
+ bool StartScanline(FXJPEG_Context* pContext, int down_scale);
+ bool ReadScanline(FXJPEG_Context* pContext, uint8_t* dest_buf);
uint32_t GetAvailInput(FXJPEG_Context* pContext, uint8_t** avail_buf_ptr);
};
diff --git a/core/fxcodec/codec/ccodec_pngmodule.h b/core/fxcodec/codec/ccodec_pngmodule.h
index 747d346afc..77c4af3946 100644
--- a/core/fxcodec/codec/ccodec_pngmodule.h
+++ b/core/fxcodec/codec/ccodec_pngmodule.h
@@ -20,19 +20,19 @@ class CCodec_PngModule {
FXPNG_Context* Start(void* pModule);
void Finish(FXPNG_Context* pContext);
- FX_BOOL Input(FXPNG_Context* pContext,
- const uint8_t* src_buf,
- uint32_t src_size,
- CFX_DIBAttribute* pAttribute);
-
- FX_BOOL (*ReadHeaderCallback)(void* pModule,
- int width,
- int height,
- int bpc,
- int pass,
- int* color_type,
- double* gamma);
- FX_BOOL (*AskScanlineBufCallback)(void* pModule, int line, uint8_t*& src_buf);
+ bool Input(FXPNG_Context* pContext,
+ const uint8_t* src_buf,
+ uint32_t src_size,
+ CFX_DIBAttribute* pAttribute);
+
+ bool (*ReadHeaderCallback)(void* pModule,
+ int width,
+ int height,
+ int bpc,
+ int pass,
+ int* color_type,
+ double* gamma);
+ bool (*AskScanlineBufCallback)(void* pModule, int line, uint8_t*& src_buf);
void (*FillScanlineBufCompletedCallback)(void* pModule, int pass, int line);
protected:
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/ccodec_progressivedecoder.h
index b760c2ec1c..de7542e485 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.h
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.h
@@ -64,7 +64,7 @@ class CCodec_ProgressiveDecoder {
int size_x,
int size_y,
int32_t frames = 0,
- FX_BOOL bInterpol = TRUE);
+ bool bInterpol = true);
FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause = nullptr);
@@ -85,7 +85,7 @@ class CCodec_ProgressiveDecoder {
int src_len,
int src_min,
int src_max,
- FX_BOOL bInterpol);
+ bool bInterpol);
PixelWeight* GetPixelWeight(int pixel) {
return reinterpret_cast<PixelWeight*>(m_pWeightTables.data() +
(pixel - m_DestMin) * m_ItemSize);
@@ -101,7 +101,7 @@ class CCodec_ProgressiveDecoder {
CFXCODEC_HorzTable();
~CFXCODEC_HorzTable();
- void Calc(int dest_len, int src_len, FX_BOOL bInterpol);
+ void Calc(int dest_len, int src_len, bool bInterpol);
PixelWeight* GetPixelWeight(int pixel) {
return reinterpret_cast<PixelWeight*>(m_pWeightTables.data() +
pixel * m_ItemSize);
@@ -139,7 +139,7 @@ class CCodec_ProgressiveDecoder {
uint8_t* m_pDecodeBuf;
int m_ScanlineSize;
CFX_DIBitmap* m_pDeviceBitmap;
- FX_BOOL m_bInterpol;
+ bool m_bInterpol;
CFXCODEC_WeightTable m_WeightHorz;
CFXCODEC_VertTable m_WeightVert;
CFXCODEC_HorzTable m_WeightHorzOO;
@@ -165,20 +165,18 @@ class CCodec_ProgressiveDecoder {
int32_t m_GifPltNumber;
int m_GifTransIndex;
FX_RECT m_GifFrameRect;
- FX_BOOL m_BmpIsTopBottom;
+ bool m_BmpIsTopBottom;
FXCODEC_STATUS m_status;
protected:
- 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,
- uint8_t*& src_buf);
+ static bool PngReadHeaderFunc(void* pModule,
+ int width,
+ int height,
+ int bpc,
+ int pass,
+ int* color_type,
+ double* gamma);
+ static bool PngAskScanlineBufFunc(void* pModule, int line, uint8_t*& src_buf);
static void PngFillScanlineBufCompletedFunc(void* pModule,
int pass,
int line);
@@ -187,27 +185,26 @@ class CCodec_ProgressiveDecoder {
static uint8_t* GifAskLocalPaletteBufCallback(void* pModule,
int32_t frame_num,
int32_t pal_size);
- static FX_BOOL GifInputRecordPositionBufCallback(void* pModule,
- uint32_t 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 bool GifInputRecordPositionBufCallback(void* pModule,
+ uint32_t rcd_pos,
+ const FX_RECT& img_rc,
+ int32_t pal_num,
+ void* pal_ptr,
+ int32_t delay_time,
+ bool user_input,
+ int32_t trans_index,
+ int32_t disposal_method,
+ bool interlace);
static void GifReadScanlineCallback(void* pModule,
int32_t row_num,
uint8_t* row_buf);
- static FX_BOOL BmpInputImagePositionBufCallback(void* pModule,
- uint32_t rcd_pos);
+ static bool BmpInputImagePositionBufCallback(void* pModule, uint32_t rcd_pos);
static void BmpReadScanlineCallback(void* pModule,
int32_t row_num,
uint8_t* row_buf);
- FX_BOOL DetectImageType(FXCODEC_IMAGE_TYPE imageType,
- CFX_DIBAttribute* pAttribute);
+ bool DetectImageType(FXCODEC_IMAGE_TYPE imageType,
+ CFX_DIBAttribute* pAttribute);
void GetDownScale(int& down_scale);
void GetTransMethod(FXDIB_Format des_format, FXCodec_Format src_format);
void ReSampleScanline(CFX_DIBitmap* pDeviceBitmap,
@@ -219,19 +216,19 @@ class CCodec_ProgressiveDecoder {
uint8_t* src_scan,
FXCodec_Format src_format);
void ResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
- FX_BOOL JpegReadMoreData(CCodec_JpegModule* pJpegModule,
- FXCODEC_STATUS& err_status);
+ bool JpegReadMoreData(CCodec_JpegModule* pJpegModule,
+ FXCODEC_STATUS& err_status);
void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap,
int32_t des_line,
uint8_t* src_scan,
FXCodec_Format src_format);
- FX_BOOL GifReadMoreData(CCodec_GifModule* pGifModule,
- FXCODEC_STATUS& err_status);
+ bool GifReadMoreData(CCodec_GifModule* pGifModule,
+ FXCODEC_STATUS& err_status);
void GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceBitmap,
double scale_y,
int des_row);
- FX_BOOL BmpReadMoreData(CCodec_BmpModule* pBmpModule,
- FXCODEC_STATUS& err_status);
+ bool BmpReadMoreData(CCodec_BmpModule* pBmpModule,
+ FXCODEC_STATUS& err_status);
void ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
};
diff --git a/core/fxcodec/codec/ccodec_scanlinedecoder.h b/core/fxcodec/codec/ccodec_scanlinedecoder.h
index 14eb6b628a..06bb6d5abe 100644
--- a/core/fxcodec/codec/ccodec_scanlinedecoder.h
+++ b/core/fxcodec/codec/ccodec_scanlinedecoder.h
@@ -24,7 +24,7 @@ class CCodec_ScanlineDecoder {
virtual ~CCodec_ScanlineDecoder();
const uint8_t* GetScanline(int line);
- FX_BOOL SkipToScanline(int line, IFX_Pause* pPause);
+ bool SkipToScanline(int line, IFX_Pause* pPause);
int GetWidth() { return m_OutputWidth; }
int GetHeight() { return m_OutputHeight; }
@@ -34,7 +34,7 @@ class CCodec_ScanlineDecoder {
virtual uint32_t GetSrcOffset() = 0;
protected:
- virtual FX_BOOL v_Rewind() = 0;
+ virtual bool v_Rewind() = 0;
virtual uint8_t* v_GetNextLine() = 0;
uint8_t* ReadNextLine();
diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp
index dfac86fbf9..2f4a81155c 100644
--- a/core/fxcodec/codec/fx_codec.cpp
+++ b/core/fxcodec/codec/fx_codec.cpp
@@ -73,9 +73,9 @@ const uint8_t* CCodec_ScanlineDecoder::GetScanline(int line) {
return m_pLastScanline;
}
-FX_BOOL CCodec_ScanlineDecoder::SkipToScanline(int line, IFX_Pause* pPause) {
+bool CCodec_ScanlineDecoder::SkipToScanline(int line, IFX_Pause* pPause) {
if (m_NextLine == line || m_NextLine == line + 1)
- return FALSE;
+ return false;
if (m_NextLine < 0 || m_NextLine > line) {
v_Rewind();
@@ -86,10 +86,10 @@ FX_BOOL CCodec_ScanlineDecoder::SkipToScanline(int line, IFX_Pause* pPause) {
m_pLastScanline = ReadNextLine();
m_NextLine++;
if (pPause && pPause->NeedToPauseNow()) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
uint8_t* CCodec_ScanlineDecoder::ReadNextLine() {
@@ -120,20 +120,20 @@ class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder {
CCodec_RLScanlineDecoder();
~CCodec_RLScanlineDecoder() override;
- FX_BOOL Create(const uint8_t* src_buf,
- uint32_t src_size,
- int width,
- int height,
- int nComps,
- int bpc);
+ bool Create(const uint8_t* src_buf,
+ uint32_t src_size,
+ int width,
+ int height,
+ int nComps,
+ int bpc);
// CCodec_ScanlineDecoder
- FX_BOOL v_Rewind() override;
+ bool v_Rewind() override;
uint8_t* v_GetNextLine() override;
uint32_t GetSrcOffset() override { return m_SrcOffset; }
protected:
- FX_BOOL CheckDestSize();
+ bool CheckDestSize();
void GetNextOperator();
void UpdateOperator(uint8_t used_bytes);
@@ -142,7 +142,7 @@ class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder {
uint32_t m_SrcSize;
uint32_t m_dwLineBytes;
uint32_t m_SrcOffset;
- FX_BOOL m_bEOD;
+ bool m_bEOD;
uint8_t m_Operator;
};
CCodec_RLScanlineDecoder::CCodec_RLScanlineDecoder()
@@ -151,12 +151,12 @@ CCodec_RLScanlineDecoder::CCodec_RLScanlineDecoder()
m_SrcSize(0),
m_dwLineBytes(0),
m_SrcOffset(0),
- m_bEOD(FALSE),
+ m_bEOD(false),
m_Operator(0) {}
CCodec_RLScanlineDecoder::~CCodec_RLScanlineDecoder() {
FX_Free(m_pScanline);
}
-FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() {
+bool CCodec_RLScanlineDecoder::CheckDestSize() {
uint32_t i = 0;
uint32_t old_size = 0;
uint32_t dest_size = 0;
@@ -165,14 +165,14 @@ FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() {
old_size = dest_size;
dest_size += m_pSrcBuf[i] + 1;
if (dest_size < old_size) {
- return FALSE;
+ return false;
}
i += m_pSrcBuf[i] + 2;
} else if (m_pSrcBuf[i] > 128) {
old_size = dest_size;
dest_size += 257 - m_pSrcBuf[i];
if (dest_size < old_size) {
- return FALSE;
+ return false;
}
i += 2;
} else {
@@ -181,16 +181,16 @@ FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() {
}
if (((uint32_t)m_OrigWidth * m_nComps * m_bpc * m_OrigHeight + 7) / 8 >
dest_size) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf,
- uint32_t src_size,
- int width,
- int height,
- int nComps,
- int bpc) {
+bool CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf,
+ uint32_t src_size,
+ int width,
+ int height,
+ int nComps,
+ int bpc) {
m_pSrcBuf = src_buf;
m_SrcSize = src_size;
m_OutputWidth = m_OrigWidth = width;
@@ -205,7 +205,7 @@ FX_BOOL CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf,
pitch /= 32;
pitch *= 4;
if (!pitch.IsValid()) {
- return FALSE;
+ return false;
}
m_Pitch = pitch.ValueOrDie();
// Overflow should already have been checked before this is called.
@@ -213,12 +213,12 @@ FX_BOOL CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf,
m_pScanline = FX_Alloc(uint8_t, m_Pitch);
return CheckDestSize();
}
-FX_BOOL CCodec_RLScanlineDecoder::v_Rewind() {
+bool CCodec_RLScanlineDecoder::v_Rewind() {
FXSYS_memset(m_pScanline, 0, m_Pitch);
m_SrcOffset = 0;
- m_bEOD = FALSE;
+ m_bEOD = false;
m_Operator = 0;
- return TRUE;
+ return true;
}
uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() {
if (m_SrcOffset == 0) {
@@ -230,17 +230,17 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() {
}
FXSYS_memset(m_pScanline, 0, m_Pitch);
uint32_t col_pos = 0;
- FX_BOOL eol = FALSE;
+ bool eol = false;
while (m_SrcOffset < m_SrcSize && !eol) {
if (m_Operator < 128) {
uint32_t copy_len = m_Operator + 1;
if (col_pos + copy_len >= m_dwLineBytes) {
copy_len = m_dwLineBytes - col_pos;
- eol = TRUE;
+ eol = true;
}
if (copy_len >= m_SrcSize - m_SrcOffset) {
copy_len = m_SrcSize - m_SrcOffset;
- m_bEOD = TRUE;
+ m_bEOD = true;
}
FXSYS_memcpy(m_pScanline + col_pos, m_pSrcBuf + m_SrcOffset, copy_len);
col_pos += copy_len;
@@ -253,13 +253,13 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() {
uint32_t duplicate_len = 257 - m_Operator;
if (col_pos + duplicate_len >= m_dwLineBytes) {
duplicate_len = m_dwLineBytes - col_pos;
- eol = TRUE;
+ eol = true;
}
FXSYS_memset(m_pScanline + col_pos, fill, duplicate_len);
col_pos += duplicate_len;
UpdateOperator((uint8_t)duplicate_len);
} else {
- m_bEOD = TRUE;
+ m_bEOD = true;
break;
}
}
diff --git a/core/fxcodec/codec/fx_codec_bmp.cpp b/core/fxcodec/codec/fx_codec_bmp.cpp
index 45025a188f..ae83d3f1ef 100644
--- a/core/fxcodec/codec/fx_codec_bmp.cpp
+++ b/core/fxcodec/codec/fx_codec_bmp.cpp
@@ -36,8 +36,8 @@ static void bmp_read_scanline(bmp_decompress_struct_p bmp_ptr,
CCodec_BmpModule* pModule = (CCodec_BmpModule*)p->parent_ptr;
pModule->ReadScanlineCallback(p->child_ptr, row_num, row_buf);
}
-static FX_BOOL bmp_get_data_position(bmp_decompress_struct_p bmp_ptr,
- uint32_t rcd_pos) {
+static bool bmp_get_data_position(bmp_decompress_struct_p bmp_ptr,
+ 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);
@@ -79,7 +79,7 @@ void CCodec_BmpModule::Finish(FXBMP_Context* ctx) {
int32_t CCodec_BmpModule::ReadHeader(FXBMP_Context* ctx,
int32_t* width,
int32_t* height,
- FX_BOOL* tb_flag,
+ bool* tb_flag,
int32_t* components,
int32_t* pal_num,
uint32_t** pal_pp,
diff --git a/core/fxcodec/codec/fx_codec_fax.cpp b/core/fxcodec/codec/fx_codec_fax.cpp
index 9af812381a..5102c778a4 100644
--- a/core/fxcodec/codec/fx_codec_fax.cpp
+++ b/core/fxcodec/codec/fx_codec_fax.cpp
@@ -273,17 +273,17 @@ int FaxGetRun(const uint8_t* ins_array,
}
}
-FX_BOOL FaxG4GetRow(const uint8_t* src_buf,
- int bitsize,
- int* bitpos,
- uint8_t* dest_buf,
- const std::vector<uint8_t>& ref_buf,
- int columns) {
+bool FaxG4GetRow(const uint8_t* src_buf,
+ int bitsize,
+ int* bitpos,
+ uint8_t* dest_buf,
+ const std::vector<uint8_t>& ref_buf,
+ int columns) {
int a0 = -1;
bool a0color = true;
while (1) {
if (*bitpos >= bitsize)
- return FALSE;
+ return false;
int a1;
int a2;
@@ -294,13 +294,13 @@ FX_BOOL FaxG4GetRow(const uint8_t* src_buf,
int v_delta = 0;
if (!NextBit(src_buf, bitpos)) {
if (*bitpos >= bitsize)
- return FALSE;
+ return false;
- FX_BOOL bit1 = NextBit(src_buf, bitpos);
+ bool bit1 = NextBit(src_buf, bitpos);
if (*bitpos >= bitsize)
- return FALSE;
+ return false;
- FX_BOOL bit2 = NextBit(src_buf, bitpos);
+ bool bit2 = NextBit(src_buf, bitpos);
if (bit1) {
v_delta = bit2 ? 1 : -1;
} else if (bit2) {
@@ -337,47 +337,47 @@ FX_BOOL FaxG4GetRow(const uint8_t* src_buf,
if (a0 < columns)
continue;
- return TRUE;
+ return true;
} else {
if (*bitpos >= bitsize)
- return FALSE;
+ return false;
if (NextBit(src_buf, bitpos)) {
if (!a0color)
FaxFillBits(dest_buf, columns, a0, b2);
if (b2 >= columns)
- return TRUE;
+ return true;
a0 = b2;
continue;
}
if (*bitpos >= bitsize)
- return FALSE;
+ return false;
- FX_BOOL next_bit1 = NextBit(src_buf, bitpos);
+ bool next_bit1 = NextBit(src_buf, bitpos);
if (*bitpos >= bitsize)
- return FALSE;
+ return false;
- FX_BOOL next_bit2 = NextBit(src_buf, bitpos);
+ bool next_bit2 = NextBit(src_buf, bitpos);
if (next_bit1) {
v_delta = next_bit2 ? 2 : -2;
} else if (next_bit2) {
if (*bitpos >= bitsize)
- return FALSE;
+ return false;
v_delta = NextBit(src_buf, bitpos) ? 3 : -3;
} else {
if (*bitpos >= bitsize)
- return FALSE;
+ return false;
if (NextBit(src_buf, bitpos)) {
*bitpos += 3;
continue;
}
*bitpos += 5;
- return TRUE;
+ return true;
}
}
}
@@ -386,39 +386,39 @@ FX_BOOL FaxG4GetRow(const uint8_t* src_buf,
FaxFillBits(dest_buf, columns, a0, a1);
if (a1 >= columns)
- return TRUE;
+ return true;
// The position of picture element must be monotonic increasing.
if (a0 >= a1)
- return FALSE;
+ return false;
a0 = a1;
a0color = !a0color;
}
}
-FX_BOOL FaxSkipEOL(const uint8_t* src_buf, int bitsize, int* bitpos) {
+bool FaxSkipEOL(const uint8_t* src_buf, int bitsize, int* bitpos) {
int startbit = *bitpos;
while (*bitpos < bitsize) {
if (!NextBit(src_buf, bitpos))
continue;
if (*bitpos - startbit <= 11)
*bitpos = startbit;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL FaxGet1DLine(const uint8_t* src_buf,
- int bitsize,
- int* bitpos,
- std::vector<uint8_t>* dest_buf,
- int columns) {
+bool FaxGet1DLine(const uint8_t* src_buf,
+ int bitsize,
+ int* bitpos,
+ std::vector<uint8_t>* dest_buf,
+ int columns) {
bool color = true;
int startpos = 0;
while (1) {
if (*bitpos >= bitsize)
- return FALSE;
+ return false;
int run_len = 0;
while (1) {
@@ -427,9 +427,9 @@ FX_BOOL FaxGet1DLine(const uint8_t* src_buf,
if (run < 0) {
while (*bitpos < bitsize) {
if (NextBit(src_buf, bitpos))
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
run_len += run;
if (run < 64) {
@@ -445,7 +445,7 @@ FX_BOOL FaxGet1DLine(const uint8_t* src_buf,
color = !color;
}
- return TRUE;
+ return true;
}
} // namespace
@@ -464,7 +464,7 @@ class CCodec_FaxDecoder : public CCodec_ScanlineDecoder {
~CCodec_FaxDecoder() override;
// CCodec_ScanlineDecoder
- FX_BOOL v_Rewind() override;
+ bool v_Rewind() override;
uint8_t* v_GetNextLine() override;
uint32_t GetSrcOffset() override;
@@ -502,10 +502,10 @@ CCodec_FaxDecoder::CCodec_FaxDecoder(const uint8_t* src_buf,
CCodec_FaxDecoder::~CCodec_FaxDecoder() {}
-FX_BOOL CCodec_FaxDecoder::v_Rewind() {
+bool CCodec_FaxDecoder::v_Rewind() {
FXSYS_memset(m_RefBuf.data(), 0xff, m_RefBuf.size());
m_bitpos = 0;
- return TRUE;
+ return true;
}
uint8_t* CCodec_FaxDecoder::v_GetNextLine() {
diff --git a/core/fxcodec/codec/fx_codec_flate.cpp b/core/fxcodec/codec/fx_codec_flate.cpp
index 9b9ad041df..c5611cc27a 100644
--- a/core/fxcodec/codec/fx_codec_flate.cpp
+++ b/core/fxcodec/codec/fx_codec_flate.cpp
@@ -94,7 +94,7 @@ class CLZWDecoder {
uint32_t& outlen,
const uint8_t* input,
uint32_t& size,
- FX_BOOL bEarlyChange);
+ bool bEarlyChange);
private:
void AddCode(uint32_t prefix_code, uint8_t append_char);
@@ -104,7 +104,7 @@ class CLZWDecoder {
uint32_t m_OutPos;
uint8_t* m_pOutput;
const uint8_t* m_pInput;
- FX_BOOL m_Early;
+ bool m_Early;
uint32_t m_CodeArray[5021];
uint32_t m_nCodes;
uint8_t m_DecodeStack[4000];
@@ -147,7 +147,7 @@ int CLZWDecoder::Decode(uint8_t* dest_buf,
uint32_t& dest_size,
const uint8_t* src_buf,
uint32_t& src_size,
- FX_BOOL bEarlyChange) {
+ bool bEarlyChange) {
m_CodeLen = 9;
m_InPos = 0;
m_OutPos = 0;
@@ -342,18 +342,18 @@ void PNG_PredictLine(uint8_t* pDestData,
}
}
-FX_BOOL PNG_Predictor(uint8_t*& data_buf,
- uint32_t& data_size,
- int Colors,
- int BitsPerComponent,
- int Columns) {
+bool PNG_Predictor(uint8_t*& data_buf,
+ uint32_t& data_size,
+ int Colors,
+ int BitsPerComponent,
+ int Columns) {
const int BytesPerPixel = (Colors * BitsPerComponent + 7) / 8;
const int row_size = (Colors * BitsPerComponent * Columns + 7) / 8;
if (row_size <= 0)
- return FALSE;
+ return false;
const int row_count = (data_size + row_size) / (row_size + 1);
if (row_count <= 0)
- return FALSE;
+ return false;
const int last_row_size = data_size % (row_size + 1);
uint8_t* dest_buf = FX_Alloc2D(uint8_t, row_size, row_count);
int byte_cnt = 0;
@@ -433,7 +433,7 @@ FX_BOOL PNG_Predictor(uint8_t*& data_buf,
data_buf = dest_buf;
data_size = row_size * row_count -
(last_row_size > 0 ? (row_size + 1 - last_row_size) : 0);
- return TRUE;
+ return true;
}
void TIFF_PredictLine(uint8_t* dest_buf,
@@ -476,14 +476,14 @@ void TIFF_PredictLine(uint8_t* dest_buf,
}
}
-FX_BOOL TIFF_Predictor(uint8_t*& data_buf,
- uint32_t& data_size,
- int Colors,
- int BitsPerComponent,
- int Columns) {
+bool TIFF_Predictor(uint8_t*& data_buf,
+ uint32_t& data_size,
+ int Colors,
+ int BitsPerComponent,
+ int Columns) {
int row_size = (Colors * BitsPerComponent * Columns + 7) / 8;
if (row_size == 0)
- return FALSE;
+ return false;
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++) {
@@ -493,7 +493,7 @@ FX_BOOL TIFF_Predictor(uint8_t*& data_buf,
}
TIFF_PredictLine(scan_line, row_size, BitsPerComponent, Colors, Columns);
}
- return TRUE;
+ return true;
}
void FlateUncompress(const uint8_t* src_buf,
@@ -627,7 +627,7 @@ class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder {
int Columns);
// CCodec_ScanlineDecoder
- FX_BOOL v_Rewind() override;
+ bool v_Rewind() override;
uint8_t* v_GetNextLine() override;
uint32_t GetSrcOffset() override;
@@ -707,17 +707,17 @@ void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf,
}
}
}
-FX_BOOL CCodec_FlateScanlineDecoder::v_Rewind() {
+bool CCodec_FlateScanlineDecoder::v_Rewind() {
if (m_pFlate) {
FPDFAPI_FlateEnd(m_pFlate);
}
m_pFlate = FPDFAPI_FlateInit(my_alloc_func, my_free_func);
if (!m_pFlate) {
- return FALSE;
+ return false;
}
FPDFAPI_FlateInput(m_pFlate, m_SrcBuf, m_SrcSize);
m_LeftOver = 0;
- return TRUE;
+ return true;
}
uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() {
if (m_Predictor) {
@@ -787,10 +787,10 @@ CCodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(
Colors, BitsPerComponent, Columns);
return pDecoder;
}
-uint32_t CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW,
+uint32_t CCodec_FlateModule::FlateOrLZWDecode(bool bLZW,
const uint8_t* src_buf,
uint32_t src_size,
- FX_BOOL bEarlyChange,
+ bool bEarlyChange,
int predictor,
int Colors,
int BitsPerComponent,
@@ -832,7 +832,7 @@ uint32_t CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW,
if (predictor_type == 0) {
return offset;
}
- FX_BOOL ret = TRUE;
+ bool ret = true;
if (predictor_type == 2) {
ret = PNG_Predictor(dest_buf, dest_size, Colors, BitsPerComponent, Columns);
} else if (predictor_type == 1) {
diff --git a/core/fxcodec/codec/fx_codec_gif.cpp b/core/fxcodec/codec/fx_codec_gif.cpp
index 8a8d2dcdf5..9d67652f86 100644
--- a/core/fxcodec/codec/fx_codec_gif.cpp
+++ b/core/fxcodec/codec/fx_codec_gif.cpp
@@ -49,19 +49,19 @@ static void gif_read_scanline(gif_decompress_struct_p gif_ptr,
CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
pModule->ReadScanlineCallback(p->child_ptr, row_num, row_buf);
}
-static FX_BOOL gif_get_record_position(gif_decompress_struct_p gif_ptr,
- uint32_t cur_pos,
- int32_t left,
- int32_t top,
- int32_t width,
- int32_t height,
- 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 bool gif_get_record_position(gif_decompress_struct_p gif_ptr,
+ uint32_t cur_pos,
+ int32_t left,
+ int32_t top,
+ int32_t width,
+ int32_t height,
+ int32_t pal_num,
+ void* pal_ptr,
+ int32_t delay_time,
+ bool user_input,
+ int32_t trans_index,
+ int32_t disposal_method,
+ bool interlace) {
FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr;
CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
return pModule->InputRecordPositionBufCallback(
diff --git a/core/fxcodec/codec/fx_codec_icc.cpp b/core/fxcodec/codec/fx_codec_icc.cpp
index f0ea6bb43c..085452223d 100644
--- a/core/fxcodec/codec/fx_codec_icc.cpp
+++ b/core/fxcodec/codec/fx_codec_icc.cpp
@@ -18,45 +18,43 @@ struct CLcmsCmm {
cmsHTRANSFORM m_hTransform;
int m_nSrcComponents;
int m_nDstComponents;
- FX_BOOL m_bLab;
+ bool m_bLab;
};
-FX_BOOL CheckComponents(cmsColorSpaceSignature cs,
- int nComponents,
- FX_BOOL bDst) {
+bool CheckComponents(cmsColorSpaceSignature cs, int nComponents, bool bDst) {
if (nComponents <= 0 || nComponents > 15) {
- return FALSE;
+ return false;
}
switch (cs) {
case cmsSigLabData:
if (nComponents < 3) {
- return FALSE;
+ return false;
}
break;
case cmsSigGrayData:
if (bDst && nComponents != 1) {
- return FALSE;
+ return false;
}
if (!bDst && nComponents > 2) {
- return FALSE;
+ return false;
}
break;
case cmsSigRgbData:
if (bDst && nComponents != 3) {
- return FALSE;
+ return false;
}
break;
case cmsSigCmykData:
if (bDst && nComponents != 4) {
- return FALSE;
+ return false;
}
break;
default:
if (nComponents != 3) {
- return FALSE;
+ return false;
}
break;
}
- return TRUE;
+ return true;
}
uint32_t GetCSComponents(cmsColorSpaceSignature cs) {
@@ -108,13 +106,13 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData,
return nullptr;
}
int srcFormat;
- FX_BOOL bLab = FALSE;
+ bool bLab = false;
cmsColorSpaceSignature srcCS = cmsGetColorSpace(srcProfile);
nSrcComponents = GetCSComponents(srcCS);
if (srcCS == cmsSigLabData) {
srcFormat =
COLORSPACE_SH(PT_Lab) | CHANNELS_SH(nSrcComponents) | BYTES_SH(0);
- bLab = TRUE;
+ bLab = true;
} else {
srcFormat =
COLORSPACE_SH(PT_ANY) | CHANNELS_SH(nSrcComponents) | BYTES_SH(1);
@@ -123,7 +121,7 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData,
}
}
cmsColorSpaceSignature dstCS = cmsGetColorSpace(dstProfile);
- if (!CheckComponents(dstCS, nDstComponents, TRUE)) {
+ if (!CheckComponents(dstCS, nDstComponents, true)) {
cmsCloseProfile(srcProfile);
cmsCloseProfile(dstProfile);
return nullptr;
diff --git a/core/fxcodec/codec/fx_codec_jpeg.cpp b/core/fxcodec/codec/fx_codec_jpeg.cpp
index 49b0aca3b8..775ebfb9c6 100644
--- a/core/fxcodec/codec/fx_codec_jpeg.cpp
+++ b/core/fxcodec/codec/fx_codec_jpeg.cpp
@@ -126,7 +126,7 @@ static bool JpegLoadInfo(const uint8_t* src_buf,
jpeg_destroy_decompress(&cinfo);
return false;
}
- int ret = jpeg_read_header(&cinfo, TRUE);
+ int ret = jpeg_read_header(&cinfo, true);
if (ret != JPEG_HEADER_OK) {
jpeg_destroy_decompress(&cinfo);
return false;
@@ -146,19 +146,19 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder {
CCodec_JpegDecoder();
~CCodec_JpegDecoder() override;
- FX_BOOL Create(const uint8_t* src_buf,
- uint32_t src_size,
- int width,
- int height,
- int nComps,
- FX_BOOL ColorTransform);
+ bool Create(const uint8_t* src_buf,
+ uint32_t src_size,
+ int width,
+ int height,
+ int nComps,
+ bool ColorTransform);
// CCodec_ScanlineDecoder
- FX_BOOL v_Rewind() override;
+ bool v_Rewind() override;
uint8_t* v_GetNextLine() override;
uint32_t GetSrcOffset() override;
- FX_BOOL InitDecode();
+ bool InitDecode();
jmp_buf m_JmpBuf;
struct jpeg_decompress_struct cinfo;
@@ -168,9 +168,9 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder {
uint32_t m_SrcSize;
uint8_t* m_pScanlineBuf;
- FX_BOOL m_bInited;
- FX_BOOL m_bStarted;
- FX_BOOL m_bJpegTransform;
+ bool m_bInited;
+ bool m_bStarted;
+ bool m_bJpegTransform;
protected:
uint32_t m_nDefaultScaleDenom;
@@ -178,8 +178,8 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder {
CCodec_JpegDecoder::CCodec_JpegDecoder() {
m_pScanlineBuf = nullptr;
- m_bStarted = FALSE;
- m_bInited = FALSE;
+ m_bStarted = false;
+ m_bInited = false;
FXSYS_memset(&cinfo, 0, sizeof(cinfo));
FXSYS_memset(&jerr, 0, sizeof(jerr));
FXSYS_memset(&src, 0, sizeof(src));
@@ -192,30 +192,30 @@ CCodec_JpegDecoder::~CCodec_JpegDecoder() {
jpeg_destroy_decompress(&cinfo);
}
-FX_BOOL CCodec_JpegDecoder::InitDecode() {
+bool CCodec_JpegDecoder::InitDecode() {
cinfo.err = &jerr;
cinfo.client_data = &m_JmpBuf;
if (setjmp(m_JmpBuf) == -1)
- return FALSE;
+ return false;
jpeg_create_decompress(&cinfo);
- m_bInited = TRUE;
+ m_bInited = true;
cinfo.src = &src;
src.bytes_in_buffer = m_SrcSize;
src.next_input_byte = m_SrcBuf;
if (setjmp(m_JmpBuf) == -1) {
jpeg_destroy_decompress(&cinfo);
- m_bInited = FALSE;
- return FALSE;
+ m_bInited = false;
+ return false;
}
cinfo.image_width = m_OrigWidth;
cinfo.image_height = m_OrigHeight;
- int ret = jpeg_read_header(&cinfo, TRUE);
+ int ret = jpeg_read_header(&cinfo, true);
if (ret != JPEG_HEADER_OK)
- return FALSE;
+ return false;
if (cinfo.saw_Adobe_marker)
- m_bJpegTransform = TRUE;
+ m_bJpegTransform = true;
if (cinfo.num_components == 3 && !m_bJpegTransform)
cinfo.out_color_space = cinfo.jpeg_color_space;
@@ -225,15 +225,15 @@ FX_BOOL CCodec_JpegDecoder::InitDecode() {
m_OutputWidth = m_OrigWidth;
m_OutputHeight = m_OrigHeight;
m_nDefaultScaleDenom = cinfo.scale_denom;
- return TRUE;
+ return true;
}
-FX_BOOL CCodec_JpegDecoder::Create(const uint8_t* src_buf,
- uint32_t src_size,
- int width,
- int height,
- int nComps,
- FX_BOOL ColorTransform) {
+bool CCodec_JpegDecoder::Create(const uint8_t* src_buf,
+ uint32_t src_size,
+ int width,
+ int height,
+ int nComps,
+ bool ColorTransform) {
JpegScanSOI(&src_buf, &src_size);
m_SrcBuf = src_buf;
m_SrcSize = src_size;
@@ -256,13 +256,13 @@ FX_BOOL CCodec_JpegDecoder::Create(const uint8_t* src_buf,
m_OutputWidth = m_OrigWidth = width;
m_OutputHeight = m_OrigHeight = height;
if (!InitDecode())
- return FALSE;
+ return false;
if (cinfo.num_components < nComps)
- return FALSE;
+ return false;
if ((int)cinfo.image_width < width)
- return FALSE;
+ return false;
m_Pitch =
(static_cast<uint32_t>(cinfo.image_width) * cinfo.num_components + 3) /
@@ -270,33 +270,33 @@ FX_BOOL CCodec_JpegDecoder::Create(const uint8_t* src_buf,
m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch);
m_nComps = cinfo.num_components;
m_bpc = 8;
- m_bStarted = FALSE;
- return TRUE;
+ m_bStarted = false;
+ return true;
}
-FX_BOOL CCodec_JpegDecoder::v_Rewind() {
+bool CCodec_JpegDecoder::v_Rewind() {
if (m_bStarted) {
jpeg_destroy_decompress(&cinfo);
if (!InitDecode()) {
- return FALSE;
+ return false;
}
}
if (setjmp(m_JmpBuf) == -1) {
- return FALSE;
+ return false;
}
cinfo.scale_denom = m_nDefaultScaleDenom;
m_OutputWidth = m_OrigWidth;
m_OutputHeight = m_OrigHeight;
if (!jpeg_start_decompress(&cinfo)) {
jpeg_destroy_decompress(&cinfo);
- return FALSE;
+ return false;
}
if ((int)cinfo.output_width > m_OrigWidth) {
- ASSERT(FALSE);
- return FALSE;
+ ASSERT(false);
+ return false;
}
- m_bStarted = TRUE;
- return TRUE;
+ m_bStarted = true;
+ return true;
}
uint8_t* CCodec_JpegDecoder::v_GetNextLine() {
@@ -311,13 +311,12 @@ uint32_t CCodec_JpegDecoder::GetSrcOffset() {
return (uint32_t)(m_SrcSize - src.bytes_in_buffer);
}
-CCodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(
- const uint8_t* src_buf,
- uint32_t src_size,
- int width,
- int height,
- int nComps,
- FX_BOOL ColorTransform) {
+CCodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(const uint8_t* src_buf,
+ uint32_t src_size,
+ int width,
+ int height,
+ int nComps,
+ bool ColorTransform) {
if (!src_buf || src_size == 0)
return nullptr;
@@ -449,18 +448,18 @@ int CCodec_JpegModule::ReadHeader(FXJPEG_Context* ctx,
return 0;
}
-FX_BOOL CCodec_JpegModule::StartScanline(FXJPEG_Context* ctx, int down_scale) {
+bool CCodec_JpegModule::StartScanline(FXJPEG_Context* ctx, int down_scale) {
if (setjmp(ctx->m_JumpMark) == -1)
- return FALSE;
+ return false;
ctx->m_Info.scale_denom = down_scale;
return !!jpeg_start_decompress(&ctx->m_Info);
}
-FX_BOOL CCodec_JpegModule::ReadScanline(FXJPEG_Context* ctx,
- unsigned char* dest_buf) {
+bool CCodec_JpegModule::ReadScanline(FXJPEG_Context* ctx,
+ unsigned char* dest_buf) {
if (setjmp(ctx->m_JumpMark) == -1)
- return FALSE;
+ return false;
int nlines = jpeg_read_scanlines(&ctx->m_Info, &dest_buf, 1);
return nlines == 1;
diff --git a/core/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/fxcodec/codec/fx_codec_jpx_opj.cpp
index 85446c1d9b..bb46da4d26 100644
--- a/core/fxcodec/codec/fx_codec_jpx_opj.cpp
+++ b/core/fxcodec/codec/fx_codec_jpx_opj.cpp
@@ -691,7 +691,7 @@ class CJPX_Decoder {
public:
explicit CJPX_Decoder(CPDF_ColorSpace* cs);
~CJPX_Decoder();
- FX_BOOL Init(const unsigned char* src_data, uint32_t src_size);
+ 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,
@@ -721,11 +721,11 @@ CJPX_Decoder::~CJPX_Decoder() {
}
}
-FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, uint32_t src_size) {
+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))
- return FALSE;
+ return false;
image = nullptr;
m_SrcData = src_data;
@@ -734,7 +734,7 @@ FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, uint32_t src_size) {
l_stream = fx_opj_stream_create_memory_stream(&srcData,
OPJ_J2K_STREAM_CHUNK_SIZE, 1);
if (!l_stream) {
- return FALSE;
+ return false;
}
opj_dparameters_t parameters;
opj_set_default_decoder_parameters(&parameters);
@@ -747,7 +747,7 @@ FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, uint32_t src_size) {
l_codec = opj_create_decompress(OPJ_CODEC_J2K);
}
if (!l_codec) {
- return FALSE;
+ return false;
}
if (m_ColorSpace && m_ColorSpace->GetFamily() == PDFCS_INDEXED)
parameters.flags |= OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
@@ -755,11 +755,11 @@ FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, uint32_t src_size) {
opj_set_warning_handler(l_codec, fx_warning_callback, 00);
opj_set_error_handler(l_codec, fx_error_callback, 00);
if (!opj_setup_decoder(l_codec, &parameters)) {
- return FALSE;
+ return false;
}
if (!opj_read_header(l_stream, l_codec, &image)) {
image = nullptr;
- return FALSE;
+ return false;
}
image->pdfium_use_colorspace = !!m_ColorSpace;
@@ -768,18 +768,18 @@ FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, uint32_t src_size) {
parameters.DA_x1, parameters.DA_y1)) {
opj_image_destroy(image);
image = nullptr;
- return FALSE;
+ return false;
}
if (!(opj_decode(l_codec, l_stream, image) &&
opj_end_decompress(l_codec, l_stream))) {
opj_image_destroy(image);
image = nullptr;
- return FALSE;
+ return false;
}
} else {
if (!opj_get_decoded_tile(l_codec, l_stream, image,
parameters.tile_index)) {
- return FALSE;
+ return false;
}
}
opj_stream_destroy(l_stream);
@@ -799,9 +799,9 @@ FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, uint32_t src_size) {
image->icc_profile_len = 0;
}
if (!image) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
void CJPX_Decoder::GetInfo(uint32_t* width,
diff --git a/core/fxcodec/codec/fx_codec_png.cpp b/core/fxcodec/codec/fx_codec_png.cpp
index 8630887a70..0b55a97dbe 100644
--- a/core/fxcodec/codec/fx_codec_png.cpp
+++ b/core/fxcodec/codec/fx_codec_png.cpp
@@ -240,17 +240,17 @@ void CCodec_PngModule::Finish(FXPNG_Context* ctx) {
}
}
-FX_BOOL CCodec_PngModule::Input(FXPNG_Context* ctx,
- const uint8_t* src_buf,
- uint32_t src_size,
- CFX_DIBAttribute* pAttribute) {
+bool CCodec_PngModule::Input(FXPNG_Context* ctx,
+ const uint8_t* src_buf,
+ uint32_t src_size,
+ CFX_DIBAttribute* pAttribute) {
if (setjmp(png_jmpbuf(ctx->png_ptr))) {
if (pAttribute &&
0 == FXSYS_strcmp(m_szLastError, "Read Header Callback Error")) {
_png_load_bmp_attribute(ctx->png_ptr, ctx->info_ptr, pAttribute);
}
- return FALSE;
+ return false;
}
png_process_data(ctx->png_ptr, ctx->info_ptr, (uint8_t*)src_buf, src_size);
- return TRUE;
+ return true;
}
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp
index 4de62baad2..7d8a3203e9 100644
--- a/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/fxcodec/codec/fx_codec_progress.cpp
@@ -47,7 +47,7 @@ void CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len,
int src_len,
int src_min,
int src_max,
- FX_BOOL bInterpol) {
+ bool bInterpol) {
double scale, base;
scale = (FX_FLOAT)src_len / (FX_FLOAT)dest_len;
if (dest_len < 0) {
@@ -146,7 +146,7 @@ CCodec_ProgressiveDecoder::CFXCODEC_HorzTable::~CFXCODEC_HorzTable() {}
void CCodec_ProgressiveDecoder::CFXCODEC_HorzTable::Calc(int dest_len,
int src_len,
- FX_BOOL bInterpol) {
+ bool bInterpol) {
double scale = (double)dest_len / (double)src_len;
m_ItemSize = sizeof(int) * 4;
int size = dest_len * m_ItemSize + 4;
@@ -282,7 +282,7 @@ CCodec_ProgressiveDecoder::CCodec_ProgressiveDecoder(
m_TransMethod = -1;
m_SrcRow = 0;
m_SrcFormat = FXCodec_Invalid;
- m_bInterpol = TRUE;
+ m_bInterpol = true;
m_FrameNumber = 0;
m_FrameCur = 0;
m_SrcPaletteNumber = 0;
@@ -291,7 +291,7 @@ CCodec_ProgressiveDecoder::CCodec_ProgressiveDecoder(
m_pGifPalette = nullptr;
m_GifTransIndex = -1;
m_GifFrameRect = FX_RECT(0, 0, 0, 0);
- m_BmpIsTopBottom = FALSE;
+ m_BmpIsTopBottom = false;
}
CCodec_ProgressiveDecoder::~CCodec_ProgressiveDecoder() {
@@ -311,12 +311,11 @@ CCodec_ProgressiveDecoder::~CCodec_ProgressiveDecoder() {
FX_Free(m_pSrcPalette);
}
-FX_BOOL CCodec_ProgressiveDecoder::JpegReadMoreData(
- CCodec_JpegModule* pJpegModule,
- FXCODEC_STATUS& err_status) {
+bool CCodec_ProgressiveDecoder::JpegReadMoreData(CCodec_JpegModule* pJpegModule,
+ FXCODEC_STATUS& err_status) {
uint32_t dwSize = (uint32_t)m_pFile->GetSize();
if (dwSize <= m_offSet) {
- return FALSE;
+ return false;
}
dwSize = dwSize - m_offSet;
uint32_t dwAvail = pJpegModule->GetAvailInput(m_pJpegContext, nullptr);
@@ -329,7 +328,7 @@ FX_BOOL CCodec_ProgressiveDecoder::JpegReadMoreData(
m_pSrcBuf = FX_Realloc(uint8_t, m_pSrcBuf, m_SrcSize);
if (!m_pSrcBuf) {
err_status = FXCODEC_STATUS_ERR_MEMORY;
- return FALSE;
+ return false;
}
} else {
uint32_t dwConsume = m_SrcSize - dwAvail;
@@ -342,20 +341,20 @@ FX_BOOL CCodec_ProgressiveDecoder::JpegReadMoreData(
}
if (!m_pFile->ReadBlock(m_pSrcBuf + dwAvail, m_offSet, dwSize)) {
err_status = FXCODEC_STATUS_ERR_READ;
- return FALSE;
+ return false;
}
m_offSet += dwSize;
pJpegModule->Input(m_pJpegContext, m_pSrcBuf, dwSize + dwAvail);
- return TRUE;
+ return true;
}
-FX_BOOL CCodec_ProgressiveDecoder::PngReadHeaderFunc(void* pModule,
- int width,
- int height,
- int bpc,
- int pass,
- int* color_type,
- double* gamma) {
+bool CCodec_ProgressiveDecoder::PngReadHeaderFunc(void* pModule,
+ int width,
+ int height,
+ int bpc,
+ int pass,
+ int* color_type,
+ double* gamma) {
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
if (!pCodec->m_pDeviceBitmap) {
pCodec->m_SrcWidth = width;
@@ -381,14 +380,14 @@ FX_BOOL CCodec_ProgressiveDecoder::PngReadHeaderFunc(void* pModule,
break;
}
pCodec->m_clipBox = FX_RECT(0, 0, width, height);
- return FALSE;
+ return false;
}
FXDIB_Format format = pCodec->m_pDeviceBitmap->GetFormat();
switch (format) {
case FXDIB_1bppMask:
case FXDIB_1bppRgb:
- ASSERT(FALSE);
- return FALSE;
+ ASSERT(false);
+ return false;
case FXDIB_8bppMask:
case FXDIB_8bppRgb:
*color_type = 0;
@@ -401,21 +400,21 @@ FX_BOOL CCodec_ProgressiveDecoder::PngReadHeaderFunc(void* pModule,
*color_type = 6;
break;
default:
- ASSERT(FALSE);
- return FALSE;
+ ASSERT(false);
+ return false;
}
*gamma = kPngGamma;
- return TRUE;
+ return true;
}
-FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule,
- int line,
- uint8_t*& src_buf) {
+bool CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule,
+ int line,
+ uint8_t*& src_buf) {
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
CFX_DIBitmap* pDIBitmap = pCodec->m_pDeviceBitmap;
if (!pDIBitmap) {
ASSERT(false);
- return FALSE;
+ return false;
}
if (line >= pCodec->m_clipBox.top && line < pCodec->m_clipBox.bottom) {
double scale_y =
@@ -440,12 +439,12 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule,
switch (pDIBitmap->GetFormat()) {
case FXDIB_1bppMask:
case FXDIB_1bppRgb:
- ASSERT(FALSE);
- return FALSE;
+ ASSERT(false);
+ return false;
case FXDIB_8bppMask:
case FXDIB_8bppRgb: {
if (pDIBitmap->GetPalette()) {
- return FALSE;
+ return false;
}
uint32_t des_g = 0;
des_g += pPixelWeights->m_Weights[0] * src_scan[src_col];
@@ -476,11 +475,11 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule,
*pDes = *p;
} break;
default:
- return FALSE;
+ return false;
}
}
}
- return TRUE;
+ return true;
}
void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(
@@ -500,7 +499,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(
switch (pDeviceBitmap->GetFormat()) {
case FXDIB_1bppMask:
case FXDIB_1bppRgb:
- ASSERT(FALSE);
+ ASSERT(false);
return;
case FXDIB_8bppMask:
case FXDIB_8bppRgb: {
@@ -585,11 +584,11 @@ void CCodec_ProgressiveDecoder::PngFillScanlineBufCompletedFunc(void* pModule,
}
}
-FX_BOOL CCodec_ProgressiveDecoder::GifReadMoreData(CCodec_GifModule* pGifModule,
- FXCODEC_STATUS& err_status) {
+bool CCodec_ProgressiveDecoder::GifReadMoreData(CCodec_GifModule* pGifModule,
+ FXCODEC_STATUS& err_status) {
uint32_t dwSize = (uint32_t)m_pFile->GetSize();
if (dwSize <= m_offSet) {
- return FALSE;
+ return false;
}
dwSize = dwSize - m_offSet;
uint32_t dwAvail = pGifModule->GetAvailInput(m_pGifContext, nullptr);
@@ -602,7 +601,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifReadMoreData(CCodec_GifModule* pGifModule,
m_pSrcBuf = FX_Realloc(uint8_t, m_pSrcBuf, m_SrcSize);
if (!m_pSrcBuf) {
err_status = FXCODEC_STATUS_ERR_MEMORY;
- return FALSE;
+ return false;
}
} else {
uint32_t dwConsume = m_SrcSize - dwAvail;
@@ -615,11 +614,11 @@ FX_BOOL CCodec_ProgressiveDecoder::GifReadMoreData(CCodec_GifModule* pGifModule,
}
if (!m_pFile->ReadBlock(m_pSrcBuf + dwAvail, m_offSet, dwSize)) {
err_status = FXCODEC_STATUS_ERR_READ;
- return FALSE;
+ return false;
}
m_offSet += dwSize;
pGifModule->Input(m_pGifContext, m_pSrcBuf, dwSize + dwAvail);
- return TRUE;
+ return true;
}
void CCodec_ProgressiveDecoder::GifRecordCurrentPositionCallback(
@@ -638,23 +637,23 @@ uint8_t* CCodec_ProgressiveDecoder::GifAskLocalPaletteBufCallback(
return FX_Alloc(uint8_t, pal_size);
}
-FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(
+bool CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(
void* pModule,
uint32_t rcd_pos,
const FX_RECT& img_rc,
int32_t pal_num,
void* pal_ptr,
int32_t delay_time,
- FX_BOOL user_input,
+ bool user_input,
int32_t trans_index,
int32_t disposal_method,
- FX_BOOL interlace) {
+ bool interlace) {
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
pCodec->m_offSet = rcd_pos;
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERROR;
if (!pCodec->GifReadMoreData(pCodec->m_pCodecMgr->GetGifModule(),
error_status)) {
- return FALSE;
+ return false;
}
uint8_t* pPalette = nullptr;
if (pal_num != 0 && pal_ptr) {
@@ -669,7 +668,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(
pCodec->m_pSrcPalette = FX_Realloc(FX_ARGB, pCodec->m_pSrcPalette, pal_num);
}
if (!pCodec->m_pSrcPalette)
- return FALSE;
+ return false;
pCodec->m_SrcPaletteNumber = pal_num;
for (int i = 0; i < pal_num; i++) {
@@ -725,7 +724,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(
}
}
}
- return TRUE;
+ return true;
}
void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule,
@@ -875,11 +874,11 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(
}
}
-FX_BOOL CCodec_ProgressiveDecoder::BmpReadMoreData(CCodec_BmpModule* pBmpModule,
- FXCODEC_STATUS& err_status) {
+bool CCodec_ProgressiveDecoder::BmpReadMoreData(CCodec_BmpModule* pBmpModule,
+ FXCODEC_STATUS& err_status) {
uint32_t dwSize = (uint32_t)m_pFile->GetSize();
if (dwSize <= m_offSet)
- return FALSE;
+ return false;
dwSize = dwSize - m_offSet;
uint32_t dwAvail = pBmpModule->GetAvailInput(m_pBmpContext, nullptr);
@@ -892,7 +891,7 @@ FX_BOOL CCodec_ProgressiveDecoder::BmpReadMoreData(CCodec_BmpModule* pBmpModule,
m_pSrcBuf = FX_Realloc(uint8_t, m_pSrcBuf, m_SrcSize);
if (!m_pSrcBuf) {
err_status = FXCODEC_STATUS_ERR_MEMORY;
- return FALSE;
+ return false;
}
} else {
uint32_t dwConsume = m_SrcSize - dwAvail;
@@ -905,14 +904,14 @@ FX_BOOL CCodec_ProgressiveDecoder::BmpReadMoreData(CCodec_BmpModule* pBmpModule,
}
if (!m_pFile->ReadBlock(m_pSrcBuf + dwAvail, m_offSet, dwSize)) {
err_status = FXCODEC_STATUS_ERR_READ;
- return FALSE;
+ return false;
}
m_offSet += dwSize;
pBmpModule->Input(m_pBmpContext, m_pSrcBuf, dwSize + dwAvail);
- return TRUE;
+ return true;
}
-FX_BOOL CCodec_ProgressiveDecoder::BmpInputImagePositionBufCallback(
+bool CCodec_ProgressiveDecoder::BmpInputImagePositionBufCallback(
void* pModule,
uint32_t rcd_pos) {
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
@@ -1039,9 +1038,8 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap,
}
}
-FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
- FXCODEC_IMAGE_TYPE imageType,
- CFX_DIBAttribute* pAttribute) {
+bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType,
+ CFX_DIBAttribute* pAttribute) {
m_offSet = 0;
uint32_t size = (uint32_t)m_pFile->GetSize();
if (size > FXCODEC_BLOCK_SIZE) {
@@ -1056,7 +1054,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
CCodec_BmpModule* pBmpModule = m_pCodecMgr->GetBmpModule();
if (!pBmpModule) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
- return FALSE;
+ return false;
}
pBmpModule->InputImagePositionBufCallback =
BmpInputImagePositionBufCallback;
@@ -1064,12 +1062,12 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
m_pBmpContext = pBmpModule->Start((void*)this);
if (!m_pBmpContext) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
- return FALSE;
+ return false;
}
- FX_BOOL bResult = m_pFile->ReadBlock(m_pSrcBuf, 0, size);
+ bool bResult = m_pFile->ReadBlock(m_pSrcBuf, 0, size);
if (!bResult) {
m_status = FXCODEC_STATUS_ERR_READ;
- return FALSE;
+ return false;
}
m_offSet += size;
pBmpModule->Input(m_pBmpContext, m_pSrcBuf, size);
@@ -1081,7 +1079,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_FORMAT;
if (!BmpReadMoreData(pBmpModule, error_status)) {
m_status = error_status;
- return FALSE;
+ return false;
}
readResult = pBmpModule->ReadHeader(
m_pBmpContext, &m_SrcWidth, &m_SrcHeight, &m_BmpIsTopBottom,
@@ -1098,30 +1096,30 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
} else {
m_pSrcPalette = nullptr;
}
- return TRUE;
+ return true;
}
if (m_pBmpContext) {
pBmpModule->Finish(m_pBmpContext);
m_pBmpContext = nullptr;
}
m_status = FXCODEC_STATUS_ERR_FORMAT;
- return FALSE;
+ return false;
}
case FXCODEC_IMAGE_JPG: {
CCodec_JpegModule* pJpegModule = m_pCodecMgr->GetJpegModule();
if (!pJpegModule) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
- return FALSE;
+ return false;
}
m_pJpegContext = pJpegModule->Start();
if (!m_pJpegContext) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
- return FALSE;
+ return false;
}
- FX_BOOL bResult = m_pFile->ReadBlock(m_pSrcBuf, 0, size);
+ bool bResult = m_pFile->ReadBlock(m_pSrcBuf, 0, size);
if (!bResult) {
m_status = FXCODEC_STATUS_ERR_READ;
- return FALSE;
+ return false;
}
m_offSet += size;
pJpegModule->Input(m_pJpegContext, m_pSrcBuf, size);
@@ -1132,7 +1130,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_FORMAT;
if (!JpegReadMoreData(pJpegModule, error_status)) {
m_status = error_status;
- return FALSE;
+ return false;
}
readResult =
pJpegModule->ReadHeader(m_pJpegContext, &m_SrcWidth, &m_SrcHeight,
@@ -1141,20 +1139,20 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
if (!readResult) {
m_SrcBPC = 8;
m_clipBox = FX_RECT(0, 0, m_SrcWidth, m_SrcHeight);
- return TRUE;
+ return true;
}
if (m_pJpegContext) {
pJpegModule->Finish(m_pJpegContext);
m_pJpegContext = nullptr;
}
m_status = FXCODEC_STATUS_ERR_FORMAT;
- return FALSE;
+ return false;
}
case FXCODEC_IMAGE_PNG: {
CCodec_PngModule* pPngModule = m_pCodecMgr->GetPngModule();
if (!pPngModule) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
- return FALSE;
+ return false;
}
pPngModule->ReadHeaderCallback =
CCodec_ProgressiveDecoder::PngReadHeaderFunc;
@@ -1165,12 +1163,12 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
m_pPngContext = pPngModule->Start((void*)this);
if (!m_pPngContext) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
- return FALSE;
+ return false;
}
- FX_BOOL bResult = m_pFile->ReadBlock(m_pSrcBuf, 0, size);
+ bool bResult = m_pFile->ReadBlock(m_pSrcBuf, 0, size);
if (!bResult) {
m_status = FXCODEC_STATUS_ERR_READ;
- return FALSE;
+ return false;
}
m_offSet += size;
bResult = pPngModule->Input(m_pPngContext, m_pSrcBuf, size, pAttribute);
@@ -1184,7 +1182,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
}
m_pPngContext = nullptr;
m_status = FXCODEC_STATUS_ERR_FORMAT;
- return FALSE;
+ return false;
}
if (m_pSrcBuf && input_size > m_SrcSize) {
FX_Free(m_pSrcBuf);
@@ -1195,7 +1193,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
bResult = m_pFile->ReadBlock(m_pSrcBuf, m_offSet, input_size);
if (!bResult) {
m_status = FXCODEC_STATUS_ERR_READ;
- return FALSE;
+ return false;
}
m_offSet += input_size;
bResult =
@@ -1208,15 +1206,15 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
}
if (m_SrcPassNumber == 0) {
m_status = FXCODEC_STATUS_ERR_FORMAT;
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
case FXCODEC_IMAGE_GIF: {
CCodec_GifModule* pGifModule = m_pCodecMgr->GetGifModule();
if (!pGifModule) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
- return FALSE;
+ return false;
}
pGifModule->RecordCurrentPositionCallback =
CCodec_ProgressiveDecoder::GifRecordCurrentPositionCallback;
@@ -1229,12 +1227,12 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
m_pGifContext = pGifModule->Start((void*)this);
if (!m_pGifContext) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
- return FALSE;
+ return false;
}
- FX_BOOL bResult = m_pFile->ReadBlock(m_pSrcBuf, 0, size);
+ bool bResult = m_pFile->ReadBlock(m_pSrcBuf, 0, size);
if (!bResult) {
m_status = FXCODEC_STATUS_ERR_READ;
- return FALSE;
+ return false;
}
m_offSet += size;
pGifModule->Input(m_pGifContext, m_pSrcBuf, size);
@@ -1246,7 +1244,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_FORMAT;
if (!GifReadMoreData(pGifModule, error_status)) {
m_status = error_status;
- return FALSE;
+ return false;
}
readResult = pGifModule->ReadHeader(
m_pGifContext, &m_SrcWidth, &m_SrcHeight, &m_GifPltNumber,
@@ -1255,43 +1253,43 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
if (readResult == 1) {
m_SrcBPC = 8;
m_clipBox = FX_RECT(0, 0, m_SrcWidth, m_SrcHeight);
- return TRUE;
+ return true;
}
if (m_pGifContext) {
pGifModule->Finish(m_pGifContext);
m_pGifContext = nullptr;
}
m_status = FXCODEC_STATUS_ERR_FORMAT;
- return FALSE;
+ return false;
}
case FXCODEC_IMAGE_TIF: {
CCodec_TiffModule* pTiffModule = m_pCodecMgr->GetTiffModule();
if (!pTiffModule) {
m_status = FXCODEC_STATUS_ERR_FORMAT;
- return FALSE;
+ return false;
}
m_pTiffContext = pTiffModule->CreateDecoder(m_pFile);
if (!m_pTiffContext) {
m_status = FXCODEC_STATUS_ERR_FORMAT;
- return FALSE;
+ return false;
}
int32_t dummy_bpc;
- FX_BOOL ret = pTiffModule->LoadFrameInfo(m_pTiffContext, 0, &m_SrcWidth,
- &m_SrcHeight, &m_SrcComponents,
- &dummy_bpc, pAttribute);
+ bool ret = pTiffModule->LoadFrameInfo(m_pTiffContext, 0, &m_SrcWidth,
+ &m_SrcHeight, &m_SrcComponents,
+ &dummy_bpc, pAttribute);
m_SrcComponents = 4;
m_clipBox = FX_RECT(0, 0, m_SrcWidth, m_SrcHeight);
if (!ret) {
pTiffModule->DestroyDecoder(m_pTiffContext);
m_pTiffContext = nullptr;
m_status = FXCODEC_STATUS_ERR_FORMAT;
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
default:
m_status = FXCODEC_STATUS_ERR_FORMAT;
- return FALSE;
+ return false;
}
}
@@ -1880,7 +1878,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap,
int size_x,
int size_y,
int32_t frames,
- FX_BOOL bInterpol) {
+ bool bInterpol) {
if (m_status != FXCODEC_STATUS_DECODE_READY)
return FXCODEC_STATUS_ERROR;
@@ -1935,7 +1933,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap,
CCodec_JpegModule* pJpegModule = m_pCodecMgr->GetJpegModule();
int down_scale = 1;
GetDownScale(down_scale);
- FX_BOOL bStart = pJpegModule->StartScanline(m_pJpegContext, down_scale);
+ bool bStart = pJpegModule->StartScanline(m_pJpegContext, down_scale);
while (!bStart) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERROR;
if (!JpegReadMoreData(pJpegModule, error_status)) {
@@ -2088,8 +2086,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) {
case FXCODEC_IMAGE_JPG: {
CCodec_JpegModule* pJpegModule = m_pCodecMgr->GetJpegModule();
while (true) {
- FX_BOOL readRes =
- pJpegModule->ReadScanline(m_pJpegContext, m_pDecodeBuf);
+ bool readRes = pJpegModule->ReadScanline(m_pJpegContext, m_pDecodeBuf);
while (!readRes) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_DECODE_FINISH;
if (!JpegReadMoreData(pJpegModule, error_status)) {
@@ -2140,7 +2137,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) {
FXSYS_memset(m_pSrcBuf, 0, input_size);
m_SrcSize = input_size;
}
- FX_BOOL bResult = m_pFile->ReadBlock(m_pSrcBuf, m_offSet, input_size);
+ bool bResult = m_pFile->ReadBlock(m_pSrcBuf, m_offSet, input_size);
if (!bResult) {
m_pDeviceBitmap = nullptr;
m_pFile = nullptr;
@@ -2225,7 +2222,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) {
};
case FXCODEC_IMAGE_TIF: {
CCodec_TiffModule* pTiffModule = m_pCodecMgr->GetTiffModule();
- FX_BOOL ret = FALSE;
+ bool ret = false;
if (m_pDeviceBitmap->GetBPP() == 32 &&
m_pDeviceBitmap->GetWidth() == m_SrcWidth && m_SrcWidth == m_sizeX &&
m_pDeviceBitmap->GetHeight() == m_SrcHeight &&