summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fdrm/crypto/fx_crypt.cpp16
-rw-r--r--core/fdrm/crypto/fx_crypt.h10
-rw-r--r--core/fdrm/crypto/fx_crypt_aes.cpp2
-rw-r--r--core/fdrm/crypto/fx_crypt_sha.cpp2
-rw-r--r--core/fpdfapi/edit/cpdf_creator.h14
-rw-r--r--core/fpdfapi/edit/editint.h10
-rw-r--r--core/fpdfapi/edit/fpdf_edit_create.cpp163
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.cpp6
-rw-r--r--core/fpdfapi/font/fpdf_font.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_allstates.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_clippath.cpp12
-rw-r--r--core/fpdfapi/page/cpdf_color.cpp8
-rw-r--r--core/fpdfapi/page/cpdf_color.h2
-rw-r--r--core/fpdfapi/page/cpdf_colorspace.cpp466
-rw-r--r--core/fpdfapi/page/cpdf_colorspace.h63
-rw-r--r--core/fpdfapi/page/cpdf_colorstate.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_contentmark.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_contentmark.h4
-rw-r--r--core/fpdfapi/page/cpdf_contentmarkitem.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_contentmarkitem.h2
-rw-r--r--core/fpdfapi/page/cpdf_docpagedata.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_docpagedata.h2
-rw-r--r--core/fpdfapi/page/cpdf_image.cpp40
-rw-r--r--core/fpdfapi/page/cpdf_image.h16
-rw-r--r--core/fpdfapi/page/cpdf_meshstream.cpp10
-rw-r--r--core/fpdfapi/page/cpdf_meshstream.h6
-rw-r--r--core/fpdfapi/page/cpdf_pageobjectholder.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_pageobjectholder.h12
-rw-r--r--core/fpdfapi/page/cpdf_path.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_path.h2
-rw-r--r--core/fpdfapi/page/cpdf_pathobject.h2
-rw-r--r--core/fpdfapi/page/cpdf_psengine.h10
-rw-r--r--core/fpdfapi/page/cpdf_shadingpattern.cpp10
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp20
-rw-r--r--core/fpdfapi/page/cpdf_textobject.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_tilingpattern.cpp10
-rw-r--r--core/fpdfapi/page/cpdf_tilingpattern.h2
-rw-r--r--core/fpdfapi/page/fpdf_page_colors.cpp66
-rw-r--r--core/fpdfapi/page/fpdf_page_func.cpp128
-rw-r--r--core/fpdfapi/page/fpdf_page_parser_old.cpp24
-rw-r--r--core/fpdfapi/page/pageint.h74
-rw-r--r--core/fpdfapi/parser/cfdf_document.cpp15
-rw-r--r--core/fpdfapi/parser/cfdf_document.h8
-rw-r--r--core/fpdfapi/parser/cpdf_array.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_crypto_handler.cpp99
-rw-r--r--core/fpdfapi/parser/cpdf_crypto_handler.h44
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.cpp560
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.h138
-rw-r--r--core/fpdfapi/parser/cpdf_dictionary.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_document.cpp18
-rw-r--r--core/fpdfapi/parser/cpdf_document.h12
-rw-r--r--core/fpdfapi/parser/cpdf_object.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp164
-rw-r--r--core/fpdfapi/parser/cpdf_parser.h23
-rw-r--r--core/fpdfapi/parser/cpdf_parser_unittest.cpp8
-rw-r--r--core/fpdfapi/parser/cpdf_security_handler.cpp158
-rw-r--r--core/fpdfapi/parser/cpdf_security_handler.h62
-rw-r--r--core/fpdfapi/parser/cpdf_stream.cpp12
-rw-r--r--core/fpdfapi/parser/cpdf_stream.h6
-rw-r--r--core/fpdfapi/parser/cpdf_stream_acc.cpp12
-rw-r--r--core/fpdfapi/parser/cpdf_stream_acc.h6
-rw-r--r--core/fpdfapi/parser/cpdf_string.cpp6
-rw-r--r--core/fpdfapi/parser/cpdf_string.h6
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser.cpp74
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser.h22
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp26
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode.cpp42
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode.h23
-rw-r--r--core/fpdfapi/parser/fpdf_parser_utility.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_pagerendercache.h22
-rw-r--r--core/fpdfapi/render/cpdf_textrenderer.h46
-rw-r--r--core/fpdfapi/render/cpdf_type3cache.cpp18
-rw-r--r--core/fpdfapi/render/fpdf_render.cpp196
-rw-r--r--core/fpdfapi/render/fpdf_render_cache.cpp60
-rw-r--r--core/fpdfapi/render/fpdf_render_image.cpp166
-rw-r--r--core/fpdfapi/render/fpdf_render_loadimage.cpp160
-rw-r--r--core/fpdfapi/render/fpdf_render_pattern.cpp48
-rw-r--r--core/fpdfapi/render/fpdf_render_text.cpp106
-rw-r--r--core/fpdfapi/render/render_int.h324
-rw-r--r--core/fpdfdoc/cpdf_aaction.cpp2
-rw-r--r--core/fpdfdoc/cpdf_aaction.h2
-rw-r--r--core/fpdfdoc/cpdf_annot.cpp30
-rw-r--r--core/fpdfdoc/cpdf_annot.h18
-rw-r--r--core/fpdfdoc/cpdf_annotlist.cpp14
-rw-r--r--core/fpdfdoc/cpdf_annotlist.h10
-rw-r--r--core/fpdfdoc/cpdf_defaultappearance.cpp16
-rw-r--r--core/fpdfdoc/cpdf_defaultappearance.h6
-rw-r--r--core/fpdfdoc/cpdf_formcontrol.cpp4
-rw-r--r--core/fpdfdoc/cpdf_formcontrol.h2
-rw-r--r--core/fpdfdoc/cpdf_formfield.cpp164
-rw-r--r--core/fpdfdoc/cpdf_formfield.h40
-rw-r--r--core/fpdfdoc/cpdf_iconfit.cpp4
-rw-r--r--core/fpdfdoc/cpdf_iconfit.h2
-rw-r--r--core/fpdfdoc/cpdf_interform.cpp64
-rw-r--r--core/fpdfdoc/cpdf_interform.h6
-rw-r--r--core/fpdfdoc/cpdf_metadata.cpp2
-rw-r--r--core/fpdfdoc/cpdf_variabletext.cpp162
-rw-r--r--core/fpdfdoc/cpdf_variabletext.h58
-rw-r--r--core/fpdfdoc/cpdf_viewerpreferences.cpp8
-rw-r--r--core/fpdfdoc/cpdf_viewerpreferences.h4
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp30
-rw-r--r--core/fpdfdoc/cpvt_generateap.h2
-rw-r--r--core/fpdfdoc/cpvt_wordplace.h2
-rw-r--r--core/fpdfdoc/cpvt_wordrange.h4
-rw-r--r--core/fpdfdoc/csection.cpp8
-rw-r--r--core/fpdfdoc/ctypeset.cpp22
-rw-r--r--core/fpdfdoc/ctypeset.h2
-rw-r--r--core/fpdfdoc/doc_tagged.cpp32
-rw-r--r--core/fpdfdoc/fpdf_tagged.h10
-rw-r--r--core/fpdfdoc/tagged_int.h16
-rw-r--r--core/fpdftext/cpdf_linkextract.cpp2
-rw-r--r--core/fpdftext/cpdf_textpage.cpp64
-rw-r--r--core/fpdftext/cpdf_textpage.h23
-rw-r--r--core/fpdftext/cpdf_textpagefind.cpp100
-rw-r--r--core/fpdftext/cpdf_textpagefind.h28
-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
-rw-r--r--core/fxcodec/fx_codec.h2
-rw-r--r--core/fxcodec/jbig2/JBig2_BitStream.cpp2
-rw-r--r--core/fxcodec/jbig2/JBig2_BitStream.h2
-rw-r--r--core/fxcodec/jbig2/JBig2_Context.cpp6
-rw-r--r--core/fxcodec/jbig2/JBig2_GrdProc.h6
-rw-r--r--core/fxcodec/jbig2/JBig2_GrrdProc.h2
-rw-r--r--core/fxcodec/jbig2/JBig2_GsidProc.h4
-rw-r--r--core/fxcodec/jbig2/JBig2_HtrdProc.h6
-rw-r--r--core/fxcodec/jbig2/JBig2_Image.cpp74
-rw-r--r--core/fxcodec/jbig2/JBig2_Image.h48
-rw-r--r--core/fxcodec/jbig2/JBig2_Page.h2
-rw-r--r--core/fxcodec/jbig2/JBig2_PddProc.h2
-rw-r--r--core/fxcodec/jbig2/JBig2_SddProc.cpp12
-rw-r--r--core/fxcodec/jbig2/JBig2_SddProc.h4
-rw-r--r--core/fxcodec/jbig2/JBig2_TrdProc.cpp2
-rw-r--r--core/fxcodec/jbig2/JBig2_TrdProc.h8
-rw-r--r--core/fxcodec/lbmp/fx_bmp.cpp20
-rw-r--r--core/fxcodec/lbmp/fx_bmp.h14
-rw-r--r--core/fxcodec/lgif/fx_gif.cpp85
-rw-r--r--core/fxcodec/lgif/fx_gif.h39
-rw-r--r--core/fxcrt/extension.h16
-rw-r--r--core/fxcrt/fx_arabic.cpp28
-rw-r--r--core/fxcrt/fx_arabic.h4
-rw-r--r--core/fxcrt/fx_basic.h66
-rw-r--r--core/fxcrt/fx_basic_array.cpp40
-rw-r--r--core/fxcrt/fx_basic_bstring.cpp4
-rw-r--r--core/fxcrt/fx_basic_coords.cpp38
-rw-r--r--core/fxcrt/fx_basic_maps.cpp16
-rw-r--r--core/fxcrt/fx_basic_util.cpp2
-rw-r--r--core/fxcrt/fx_basic_wstring.cpp4
-rw-r--r--core/fxcrt/fx_coordinates.h34
-rw-r--r--core/fxcrt/fx_ext.h2
-rw-r--r--core/fxcrt/fx_extension.cpp34
-rw-r--r--core/fxcrt/fx_stream.h8
-rw-r--r--core/fxcrt/fx_ucd.h8
-rw-r--r--core/fxcrt/fx_unicode.cpp8
-rw-r--r--core/fxcrt/fx_xml.h44
-rw-r--r--core/fxcrt/fx_xml_parser.cpp91
-rw-r--r--core/fxcrt/fxcrt_stream.cpp2
-rw-r--r--core/fxcrt/fxcrt_windows.cpp4
-rw-r--r--core/fxcrt/xml_int.h14
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp244
-rw-r--r--core/fxge/agg/fx_agg_driver.h116
-rw-r--r--core/fxge/android/cfpf_skiafont.cpp38
-rw-r--r--core/fxge/android/cfpf_skiafont.h14
-rw-r--r--core/fxge/android/cfx_androidfontinfo.cpp24
-rw-r--r--core/fxge/android/cfx_androidfontinfo.h10
-rw-r--r--core/fxge/apple/apple_int.h130
-rw-r--r--core/fxge/apple/cfx_quartzdevice.h8
-rw-r--r--core/fxge/apple/fx_apple_platform.cpp50
-rw-r--r--core/fxge/apple/fx_mac_imp.cpp6
-rw-r--r--core/fxge/apple/fx_quartz_device.cpp221
-rw-r--r--core/fxge/cfx_facecache.h6
-rw-r--r--core/fxge/cfx_fontmapper.h8
-rw-r--r--core/fxge/cfx_fontmgr.h6
-rw-r--r--core/fxge/cfx_pathdata.h12
-rw-r--r--core/fxge/cfx_renderdevice.h216
-rw-r--r--core/fxge/dib/dib_int.h10
-rw-r--r--core/fxge/dib/fx_dib_composite.cpp236
-rw-r--r--core/fxge/dib/fx_dib_convert.cpp318
-rw-r--r--core/fxge/dib/fx_dib_engine.cpp91
-rw-r--r--core/fxge/dib/fx_dib_main.cpp299
-rw-r--r--core/fxge/dib/fx_dib_transform.cpp36
-rw-r--r--core/fxge/fx_dib.h278
-rw-r--r--core/fxge/fx_font.h20
-rw-r--r--core/fxge/ge/cfx_cliprgn.cpp2
-rw-r--r--core/fxge/ge/cfx_facecache.cpp6
-rw-r--r--core/fxge/ge/cfx_folderfontinfo.cpp24
-rw-r--r--core/fxge/ge/cfx_folderfontinfo.h14
-rw-r--r--core/fxge/ge/cfx_font.cpp64
-rw-r--r--core/fxge/ge/cfx_fontmapper.cpp28
-rw-r--r--core/fxge/ge/cfx_fontmgr.cpp12
-rw-r--r--core/fxge/ge/cfx_pathdata.cpp74
-rw-r--r--core/fxge/ge/cfx_renderdevice.cpp258
-rw-r--r--core/fxge/ge/fx_ge_fontmap.cpp2
-rw-r--r--core/fxge/ge/fx_ge_linux.cpp16
-rw-r--r--core/fxge/ifx_renderdevicedriver.cpp71
-rw-r--r--core/fxge/ifx_renderdevicedriver.h120
-rw-r--r--core/fxge/ifx_systemfontinfo.h10
-rw-r--r--core/fxge/skia/fx_skia_device.cpp152
-rw-r--r--core/fxge/skia/fx_skia_device.h118
-rw-r--r--core/fxge/win32/dwrite_int.h30
-rw-r--r--core/fxge/win32/fx_win32_device.cpp270
-rw-r--r--core/fxge/win32/fx_win32_dib.cpp10
-rw-r--r--core/fxge/win32/fx_win32_dwrite.cpp42
-rw-r--r--core/fxge/win32/fx_win32_gdipext.cpp168
-rw-r--r--core/fxge/win32/fx_win32_print.cpp102
-rw-r--r--core/fxge/win32/win32_int.h290
220 files changed, 5328 insertions, 5389 deletions
diff --git a/core/fdrm/crypto/fx_crypt.cpp b/core/fdrm/crypto/fx_crypt.cpp
index 885b468839..12b955d93d 100644
--- a/core/fdrm/crypto/fx_crypt.cpp
+++ b/core/fdrm/crypto/fx_crypt.cpp
@@ -245,14 +245,14 @@ void CRYPT_MD5Generate(const uint8_t* input,
CRYPT_MD5Update(&ctx, input, length);
CRYPT_MD5Finish(&ctx, digest);
}
-static FX_BOOL (*g_PubKeyDecryptor)(const uint8_t* pData,
- uint32_t size,
- uint8_t* data_buf,
- uint32_t& data_len) = nullptr;
-void CRYPT_SetPubKeyDecryptor(FX_BOOL (*func)(const uint8_t* pData,
- uint32_t size,
- uint8_t* data_buf,
- uint32_t& data_len)) {
+static bool (*g_PubKeyDecryptor)(const uint8_t* pData,
+ uint32_t size,
+ uint8_t* data_buf,
+ uint32_t& data_len) = nullptr;
+void CRYPT_SetPubKeyDecryptor(bool (*func)(const uint8_t* pData,
+ uint32_t size,
+ uint8_t* data_buf,
+ uint32_t& data_len)) {
g_PubKeyDecryptor = func;
}
#ifdef __cplusplus
diff --git a/core/fdrm/crypto/fx_crypt.h b/core/fdrm/crypto/fx_crypt.h
index 75cab89435..24650bec9a 100644
--- a/core/fdrm/crypto/fx_crypt.h
+++ b/core/fdrm/crypto/fx_crypt.h
@@ -23,7 +23,7 @@ void CRYPT_AESSetKey(void* context,
uint32_t blocklen,
const uint8_t* key,
uint32_t keylen,
- FX_BOOL bEncrypt);
+ bool bEncrypt);
void CRYPT_AESSetIV(void* context, const uint8_t* iv);
void CRYPT_AESDecrypt(void* context,
uint8_t* dest,
@@ -59,10 +59,10 @@ void CRYPT_SHA512Finish(void* context, uint8_t digest[64]);
void CRYPT_SHA512Generate(const uint8_t* data,
uint32_t size,
uint8_t digest[64]);
-void CRYPT_SetPubKeyDecryptor(FX_BOOL (*func)(const uint8_t* pData,
- uint32_t size,
- uint8_t* data_buf,
- uint32_t& data_len));
+void CRYPT_SetPubKeyDecryptor(bool (*func)(const uint8_t* pData,
+ uint32_t size,
+ uint8_t* data_buf,
+ uint32_t& data_len));
#ifdef __cplusplus
};
diff --git a/core/fdrm/crypto/fx_crypt_aes.cpp b/core/fdrm/crypto/fx_crypt_aes.cpp
index 27c064e19f..8484b6f4a5 100644
--- a/core/fdrm/crypto/fx_crypt_aes.cpp
+++ b/core/fdrm/crypto/fx_crypt_aes.cpp
@@ -807,7 +807,7 @@ void CRYPT_AESSetKey(void* context,
uint32_t blocklen,
const uint8_t* key,
uint32_t keylen,
- FX_BOOL bEncrypt) {
+ bool bEncrypt) {
aes_setup((AESContext*)context, blocklen, key, keylen);
}
void CRYPT_AESSetIV(void* context, const uint8_t* iv) {
diff --git a/core/fdrm/crypto/fx_crypt_sha.cpp b/core/fdrm/crypto/fx_crypt_sha.cpp
index eb3373cfb0..5fb45ab66a 100644
--- a/core/fdrm/crypto/fx_crypt_sha.cpp
+++ b/core/fdrm/crypto/fx_crypt_sha.cpp
@@ -384,7 +384,7 @@ uint64_t FX_ato64i(const FX_CHAR* str) {
} else if (str[i] >= 'A' && str[i] <= 'F') {
ret |= (str[i] - 'A' + 10) & 0xFF;
} else {
- ASSERT(FALSE);
+ ASSERT(false);
}
}
return ret;
diff --git a/core/fpdfapi/edit/cpdf_creator.h b/core/fpdfapi/edit/cpdf_creator.h
index 8b0efdd309..f462115cf7 100644
--- a/core/fpdfapi/edit/cpdf_creator.h
+++ b/core/fpdfapi/edit/cpdf_creator.h
@@ -34,7 +34,7 @@ class CPDF_Creator {
void RemoveSecurity();
bool Create(IFX_WriteStream* pFile, uint32_t flags = 0);
int32_t Continue(IFX_Pause* pPause = nullptr);
- FX_BOOL SetFileVersion(int32_t fileVersion = 17);
+ bool SetFileVersion(int32_t fileVersion = 17);
private:
friend class CPDF_ObjectStream;
@@ -46,7 +46,7 @@ class CPDF_Creator {
void InitOldObjNumOffsets();
void InitNewObjNumOffsets();
- void InitID(FX_BOOL bDefault = TRUE);
+ void InitID(bool bDefault = true);
void AppendNewObjNum(uint32_t objbum);
int32_t AppendObjectNumberToXRef(uint32_t objnum);
@@ -58,11 +58,11 @@ class CPDF_Creator {
int32_t WriteOldIndirectObject(uint32_t objnum);
int32_t WriteOldObjs(IFX_Pause* pPause);
- int32_t WriteNewObjs(FX_BOOL bIncremental, IFX_Pause* pPause);
+ int32_t WriteNewObjs(bool bIncremental, IFX_Pause* pPause);
int32_t WriteIndirectObj(const CPDF_Object* pObj);
int32_t WriteDirectObj(uint32_t objnum,
const CPDF_Object* pObj,
- FX_BOOL bEncrypt = TRUE);
+ bool bEncrypt = true);
int32_t WriteIndirectObjectToStream(const CPDF_Object* pObj);
int32_t WriteIndirectObj(uint32_t objnum, const CPDF_Object* pObj);
int32_t WriteIndirectObjectToStream(uint32_t objnum,
@@ -75,13 +75,13 @@ class CPDF_Creator {
CPDF_Document* const m_pDocument;
CPDF_Parser* const m_pParser;
- FX_BOOL m_bSecurityChanged;
+ bool m_bSecurityChanged;
CPDF_Dictionary* m_pEncryptDict;
uint32_t m_dwEncryptObjNum;
- FX_BOOL m_bEncryptCloned;
+ bool m_bEncryptCloned;
CPDF_CryptoHandler* m_pCryptoHandler;
// Whether this owns the crypto handler |m_pCryptoHandler|.
- FX_BOOL m_bLocalCryptoHandler;
+ bool m_bLocalCryptoHandler;
CPDF_Object* m_pMetadata;
std::unique_ptr<CPDF_XRefStream> m_pXRefStream;
int32_t m_ObjectStreamSize;
diff --git a/core/fpdfapi/edit/editint.h b/core/fpdfapi/edit/editint.h
index f1f88f8b09..881c2cca36 100644
--- a/core/fpdfapi/edit/editint.h
+++ b/core/fpdfapi/edit/editint.h
@@ -49,7 +49,7 @@ class CPDF_XRefStream {
CPDF_XRefStream();
~CPDF_XRefStream();
- FX_BOOL Start();
+ bool Start();
int32_t CompressIndirectObject(uint32_t dwObjNum,
const CPDF_Object* pObj,
CPDF_Creator* pCreator);
@@ -57,17 +57,17 @@ class CPDF_XRefStream {
const uint8_t* pBuffer,
uint32_t dwSize,
CPDF_Creator* pCreator);
- FX_BOOL End(CPDF_Creator* pCreator, FX_BOOL bEOF = FALSE);
+ bool End(CPDF_Creator* pCreator, bool bEOF = false);
void AddObjectNumberToIndexArray(uint32_t objnum);
- FX_BOOL EndXRefStream(CPDF_Creator* pCreator);
+ bool EndXRefStream(CPDF_Creator* pCreator);
std::vector<Index> m_IndexArray;
FX_FILESIZE m_PrevOffset;
uint32_t m_dwTempObjNum;
protected:
- int32_t EndObjectStream(CPDF_Creator* pCreator, FX_BOOL bEOF = TRUE);
- FX_BOOL GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF);
+ int32_t EndObjectStream(CPDF_Creator* pCreator, bool bEOF = true);
+ bool GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF);
size_t m_iSeg;
CPDF_ObjectStream m_ObjStream;
diff --git a/core/fpdfapi/edit/fpdf_edit_create.cpp b/core/fpdfapi/edit/fpdf_edit_create.cpp
index b4e1157d9e..ed638d4c40 100644
--- a/core/fpdfapi/edit/fpdf_edit_create.cpp
+++ b/core/fpdfapi/edit/fpdf_edit_create.cpp
@@ -60,7 +60,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
break;
case CPDF_Object::STRING: {
CFX_ByteString str = pObj->GetString();
- FX_BOOL bHex = pObj->AsString()->IsHex();
+ bool bHex = pObj->AsString()->IsHex();
if ((len = pFile->AppendString(PDF_EncodeString(str, bHex).AsStringC())) <
0) {
return -1;
@@ -169,7 +169,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
}
offset += 8;
CPDF_StreamAcc acc;
- acc.LoadAllData(p, TRUE);
+ acc.LoadAllData(p, true);
if (pFile->AppendBlock(acc.GetData(), acc.GetSize()) < 0) {
return -1;
}
@@ -181,7 +181,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
break;
}
default:
- ASSERT(FALSE);
+ ASSERT(false);
break;
}
return 1;
@@ -385,7 +385,7 @@ int32_t OutputIndex(CFX_FileBufferArchive* pFile, FX_FILESIZE offset) {
class CPDF_FlateEncoder {
public:
- CPDF_FlateEncoder(CPDF_Stream* pStream, FX_BOOL bFlateEncode);
+ CPDF_FlateEncoder(CPDF_Stream* pStream, bool bFlateEncode);
CPDF_FlateEncoder(const uint8_t* pBuffer,
uint32_t size,
bool bFlateEncode,
@@ -397,8 +397,8 @@ class CPDF_FlateEncoder {
uint8_t* m_pData;
uint32_t m_dwSize;
CPDF_Dictionary* m_pDict;
- FX_BOOL m_bCloned;
- FX_BOOL m_bNewData;
+ bool m_bCloned;
+ bool m_bNewData;
CPDF_StreamAcc m_Acc;
};
@@ -406,17 +406,17 @@ void CPDF_FlateEncoder::CloneDict() {
if (!m_bCloned) {
m_pDict = ToDictionary(m_pDict->Clone());
ASSERT(m_pDict);
- m_bCloned = TRUE;
+ m_bCloned = true;
}
}
-CPDF_FlateEncoder::CPDF_FlateEncoder(CPDF_Stream* pStream, FX_BOOL bFlateEncode)
+CPDF_FlateEncoder::CPDF_FlateEncoder(CPDF_Stream* pStream, bool bFlateEncode)
: m_pData(nullptr),
m_dwSize(0),
m_pDict(nullptr),
- m_bCloned(FALSE),
- m_bNewData(FALSE) {
- m_Acc.LoadAllData(pStream, TRUE);
+ m_bCloned(false),
+ m_bNewData(false) {
+ m_Acc.LoadAllData(pStream, true);
if ((pStream && pStream->GetDict() &&
pStream->GetDict()->KeyExist("Filter")) ||
!bFlateEncode) {
@@ -427,8 +427,8 @@ CPDF_FlateEncoder::CPDF_FlateEncoder(CPDF_Stream* pStream, FX_BOOL bFlateEncode)
m_pData = (uint8_t*)destAcc.DetachData();
m_pDict = ToDictionary(pStream->GetDict()->Clone());
m_pDict->RemoveFor("Filter");
- m_bNewData = TRUE;
- m_bCloned = TRUE;
+ m_bNewData = true;
+ m_bCloned = true;
} else {
m_pData = (uint8_t*)m_Acc.GetData();
m_dwSize = m_Acc.GetSize();
@@ -437,8 +437,8 @@ CPDF_FlateEncoder::CPDF_FlateEncoder(CPDF_Stream* pStream, FX_BOOL bFlateEncode)
return;
}
- m_bNewData = TRUE;
- m_bCloned = TRUE;
+ m_bNewData = true;
+ m_bCloned = true;
// TODO(thestig): Move to Init() and check return value.
::FlateEncode(m_Acc.GetData(), m_Acc.GetSize(), &m_pData, &m_dwSize);
m_pDict = ToDictionary(pStream->GetDict()->Clone());
@@ -454,14 +454,14 @@ CPDF_FlateEncoder::CPDF_FlateEncoder(const uint8_t* pBuffer,
: m_pData(nullptr),
m_dwSize(0),
m_pDict(nullptr),
- m_bCloned(FALSE),
- m_bNewData(FALSE) {
+ m_bCloned(false),
+ m_bNewData(false) {
if (!bFlateEncode) {
m_pData = (uint8_t*)pBuffer;
m_dwSize = size;
return;
}
- m_bNewData = TRUE;
+ m_bNewData = true;
// TODO(thestig): Move to Init() and check return value.
if (bXRefStream)
::PngEncode(pBuffer, size, &m_pData, &m_dwSize);
@@ -486,14 +486,14 @@ class CPDF_Encryptor {
uint8_t* m_pData;
uint32_t m_dwSize;
- FX_BOOL m_bNewBuf;
+ bool m_bNewBuf;
};
CPDF_Encryptor::CPDF_Encryptor(CPDF_CryptoHandler* pHandler,
int objnum,
uint8_t* src_data,
uint32_t src_size)
- : m_pData(nullptr), m_dwSize(0), m_bNewBuf(FALSE) {
+ : m_pData(nullptr), m_dwSize(0), m_bNewBuf(false) {
if (src_size == 0)
return;
@@ -505,7 +505,7 @@ CPDF_Encryptor::CPDF_Encryptor(CPDF_CryptoHandler* pHandler,
m_dwSize = pHandler->EncryptGetSize(objnum, 0, src_data, src_size);
m_pData = FX_Alloc(uint8_t, m_dwSize);
pHandler->EncryptContent(objnum, 0, src_data, src_size, m_pData, m_dwSize);
- m_bNewBuf = TRUE;
+ m_bNewBuf = true;
}
CPDF_Encryptor::~CPDF_Encryptor() {
@@ -611,11 +611,11 @@ CPDF_XRefStream::CPDF_XRefStream()
CPDF_XRefStream::~CPDF_XRefStream() {}
-FX_BOOL CPDF_XRefStream::Start() {
+bool CPDF_XRefStream::Start() {
m_IndexArray.clear();
m_Buffer.Clear();
m_iSeg = 0;
- return TRUE;
+ return true;
}
int32_t CPDF_XRefStream::CompressIndirectObject(uint32_t dwObjNum,
const CPDF_Object* pObj,
@@ -647,7 +647,7 @@ int32_t CPDF_XRefStream::CompressIndirectObject(uint32_t dwObjNum,
return EndObjectStream(pCreator);
}
-int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator* pCreator, FX_BOOL bEOF) {
+int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator* pCreator, bool bEOF) {
FX_FILESIZE objOffset = 0;
if (bEOF) {
objOffset = m_ObjStream.End(pCreator);
@@ -713,12 +713,11 @@ int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator* pCreator, FX_BOOL bEOF) {
}
return 1;
}
-FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator,
- FX_BOOL bEOF) {
+bool CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF) {
FX_FILESIZE offset_tmp = pCreator->m_Offset;
uint32_t objnum = ++pCreator->m_dwLastObjNum;
CFX_FileBufferArchive* pFile = &pCreator->m_File;
- FX_BOOL bIncremental = (pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL) != 0;
+ bool bIncremental = (pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL) != 0;
if (bIncremental) {
AddObjectNumberToIndexArray(objnum);
} else {
@@ -735,87 +734,87 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator,
FX_FILESIZE& offset = pCreator->m_Offset;
int32_t len = pFile->AppendDWord(objnum);
if (len < 0) {
- return FALSE;
+ return false;
}
offset += len;
if ((len = pFile->AppendString(" 0 obj\r\n<</Type /XRef/W[1 4 2]/Index[")) <
0) {
- return FALSE;
+ return false;
}
offset += len;
if (!bIncremental) {
if ((len = pFile->AppendDWord(0)) < 0) {
- return FALSE;
+ return false;
}
if ((len = pFile->AppendString(" ")) < 0) {
- return FALSE;
+ return false;
}
offset += len + 1;
if ((len = pFile->AppendDWord(objnum + 1)) < 0) {
- return FALSE;
+ return false;
}
offset += len;
} else {
for (const auto& pair : m_IndexArray) {
if ((len = pFile->AppendDWord(pair.objnum)) < 0) {
- return FALSE;
+ return false;
}
if (pFile->AppendString(" ") < 0) {
- return FALSE;
+ return false;
}
offset += len + 1;
if ((len = pFile->AppendDWord(pair.count)) < 0) {
- return FALSE;
+ return false;
}
if (pFile->AppendString(" ") < 0) {
- return FALSE;
+ return false;
}
offset += len + 1;
}
}
if (pFile->AppendString("]/Size ") < 0) {
- return FALSE;
+ return false;
}
if ((len = pFile->AppendDWord(objnum + 1)) < 0) {
- return FALSE;
+ return false;
}
offset += len + 7;
if (m_PrevOffset > 0) {
if (pFile->AppendString("/Prev ") < 0) {
- return FALSE;
+ return false;
}
FX_CHAR offset_buf[20];
FXSYS_memset(offset_buf, 0, sizeof(offset_buf));
FXSYS_i64toa(m_PrevOffset, offset_buf, 10);
int32_t offset_len = (int32_t)FXSYS_strlen(offset_buf);
if (pFile->AppendBlock(offset_buf, offset_len) < 0) {
- return FALSE;
+ return false;
}
offset += offset_len + 6;
}
- CPDF_FlateEncoder encoder(m_Buffer.GetBuffer(), m_Buffer.GetLength(), TRUE,
- TRUE);
+ CPDF_FlateEncoder encoder(m_Buffer.GetBuffer(), m_Buffer.GetLength(), true,
+ true);
if (pFile->AppendString("/Filter /FlateDecode") < 0)
- return FALSE;
+ return false;
offset += 20;
if ((len = pFile->AppendString("/DecodeParms<</Columns 7/Predictor 12>>")) <
0) {
- return FALSE;
+ return false;
}
offset += len;
if (pFile->AppendString("/Length ") < 0)
- return FALSE;
+ return false;
if ((len = pFile->AppendDWord(encoder.m_dwSize)) < 0)
- return FALSE;
+ return false;
offset += len + 8;
if (bEOF) {
if ((len = PDF_CreatorWriteTrailer(pCreator->m_pDocument, pFile,
pCreator->m_pIDArray.get())) < 0) {
- return FALSE;
+ return false;
}
offset += len;
if (pCreator->m_pEncryptDict) {
@@ -825,32 +824,32 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator,
}
if ((len = PDF_CreatorWriteEncrypt(pCreator->m_pEncryptDict,
dwEncryptObjNum, pFile)) < 0) {
- return FALSE;
+ return false;
}
offset += len;
}
}
if ((len = pFile->AppendString(">>stream\r\n")) < 0) {
- return FALSE;
+ return false;
}
offset += len;
if (pFile->AppendBlock(encoder.m_pData, encoder.m_dwSize) < 0) {
- return FALSE;
+ return false;
}
if ((len = pFile->AppendString("\r\nendstream\r\nendobj\r\n")) < 0) {
- return FALSE;
+ return false;
}
offset += encoder.m_dwSize + len;
m_PrevOffset = offset_tmp;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_XRefStream::End(CPDF_Creator* pCreator, FX_BOOL bEOF) {
+bool CPDF_XRefStream::End(CPDF_Creator* pCreator, bool bEOF) {
if (EndObjectStream(pCreator, bEOF) < 0) {
- return FALSE;
+ return false;
}
return GenerateXRefStream(pCreator, bEOF);
}
-FX_BOOL CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator) {
+bool CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator) {
if (!(pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL)) {
AppendIndex0(m_Buffer, true);
for (uint32_t i = 1; i < pCreator->m_dwLastObjNum + 1; i++) {
@@ -867,7 +866,7 @@ FX_BOOL CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator) {
AppendIndex1(m_Buffer, pCreator->m_ObjectOffset[j]);
}
}
- return GenerateXRefStream(pCreator, FALSE);
+ return GenerateXRefStream(pCreator, false);
}
void CPDF_XRefStream::AddObjectNumberToIndexArray(uint32_t objnum) {
if (m_IndexArray.empty()) {
@@ -884,12 +883,12 @@ void CPDF_XRefStream::AddObjectNumberToIndexArray(uint32_t objnum) {
CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc)
: m_pDocument(pDoc),
m_pParser(pDoc->GetParser()),
- m_bSecurityChanged(FALSE),
+ m_bSecurityChanged(false),
m_pEncryptDict(m_pParser ? m_pParser->GetEncryptDict() : nullptr),
m_dwEncryptObjNum(0),
- m_bEncryptCloned(FALSE),
+ m_bEncryptCloned(false),
m_pCryptoHandler(m_pParser ? m_pParser->GetCryptoHandler() : nullptr),
- m_bLocalCryptoHandler(FALSE),
+ m_bLocalCryptoHandler(false),
m_pMetadata(nullptr),
m_ObjectStreamSize(200),
m_dwLastObjNum(m_pDocument->GetLastObjNum()),
@@ -1053,7 +1052,7 @@ int32_t CPDF_Creator::WriteIndirectObj(const CPDF_Object* pObj) {
}
int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
const CPDF_Object* pObj,
- FX_BOOL bEncrypt) {
+ bool bEncrypt) {
int32_t len = 0;
if (!pObj) {
if (m_File.AppendString(" null") < 0) {
@@ -1081,7 +1080,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
break;
case CPDF_Object::STRING: {
CFX_ByteString str = pObj->GetString();
- FX_BOOL bHex = pObj->AsString()->IsHex();
+ bool bHex = pObj->AsString()->IsHex();
if (!m_pCryptoHandler || !bEncrypt) {
CFX_ByteString content = PDF_EncodeString(str, bHex);
if ((len = m_File.AppendString(content.AsStringC())) < 0) {
@@ -1103,7 +1102,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
}
case CPDF_Object::STREAM: {
CPDF_FlateEncoder encoder(const_cast<CPDF_Stream*>(pObj->AsStream()),
- TRUE);
+ true);
CPDF_Encryptor encryptor(m_pCryptoHandler, objnum, encoder.m_pData,
encoder.m_dwSize);
if ((uint32_t)encoder.m_pDict->GetIntegerFor("Length") !=
@@ -1190,7 +1189,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
const CPDF_Dictionary* p = pObj->AsDictionary();
bool bSignDict = p->IsSignatureDict();
for (const auto& it : *p) {
- FX_BOOL bSignValue = FALSE;
+ bool bSignValue = false;
const CFX_ByteString& key = it.first;
CPDF_Object* pValue = it.second;
if (m_File.AppendString("/") < 0) {
@@ -1201,7 +1200,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
}
m_Offset += len + 1;
if (bSignDict && key == "Contents") {
- bSignValue = TRUE;
+ bSignValue = true;
}
if (!pValue->IsInline()) {
if (m_File.AppendString(" ") < 0) {
@@ -1234,7 +1233,7 @@ int32_t CPDF_Creator::WriteOldIndirectObject(uint32_t objnum) {
return 0;
m_ObjectOffset[objnum] = m_Offset;
- FX_BOOL bExistInMap = !!m_pDocument->GetIndirectObject(objnum);
+ bool bExistInMap = !!m_pDocument->GetIndirectObject(objnum);
const uint8_t object_type = m_pParser->GetObjectType(objnum);
bool bObjStm = (object_type == 2) && m_pEncryptDict && !m_pXRefStream;
if (m_pParser->IsVersionUpdated() || m_bSecurityChanged || bExistInMap ||
@@ -1315,7 +1314,7 @@ int32_t CPDF_Creator::WriteOldObjs(IFX_Pause* pPause) {
}
return 0;
}
-int32_t CPDF_Creator::WriteNewObjs(FX_BOOL bIncremental, IFX_Pause* pPause) {
+int32_t CPDF_Creator::WriteNewObjs(bool bIncremental, IFX_Pause* pPause) {
int32_t iCount = m_NewObjNumArray.GetSize();
int32_t index = (int32_t)(uintptr_t)m_Pos;
while (index < iCount) {
@@ -1361,8 +1360,8 @@ void CPDF_Creator::InitOldObjNumOffsets() {
}
void CPDF_Creator::InitNewObjNumOffsets() {
- FX_BOOL bIncremental = (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0;
- FX_BOOL bNoOriginal = (m_dwFlags & FPDFCREATE_NO_ORIGINAL) != 0;
+ bool bIncremental = (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0;
+ bool bNoOriginal = (m_dwFlags & FPDFCREATE_NO_ORIGINAL) != 0;
for (const auto& pair : *m_pDocument) {
const uint32_t objnum = pair.first;
const CPDF_Object* pObj = pair.second.get();
@@ -1381,7 +1380,7 @@ void CPDF_Creator::InitNewObjNumOffsets() {
int32_t i = 0;
uint32_t dwStartObjNum = 0;
- FX_BOOL bCrossRefValid = m_pParser && m_pParser->GetLastXRefOffset() > 0;
+ bool bCrossRefValid = m_pParser && m_pParser->GetLastXRefOffset() > 0;
while (i < iCount) {
dwStartObjNum = m_NewObjNumArray.ElementAt(i);
if ((bIncremental && (bNoOriginal || bCrossRefValid)) ||
@@ -1585,7 +1584,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) {
if (m_iStage == 80) {
m_XrefStart = m_Offset;
if (m_dwFlags & FPDFCREATE_OBJECTSTREAM) {
- m_pXRefStream->End(this, TRUE);
+ m_pXRefStream->End(this, true);
m_XrefStart = m_pXRefStream->m_PrevOffset;
m_iStage = 90;
} else if ((m_dwFlags & FPDFCREATE_INCREMENTAL) == 0 ||
@@ -1696,7 +1695,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) {
int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
ASSERT(m_iStage >= 90);
if ((m_dwFlags & FPDFCREATE_OBJECTSTREAM) == 0) {
- FX_BOOL bXRefStream =
+ bool bXRefStream =
(m_dwFlags & FPDFCREATE_INCREMENTAL) != 0 && m_pParser->IsXRefStream();
if (!bXRefStream) {
if (m_File.AppendString("trailer\r\n<<") < 0) {
@@ -1925,9 +1924,9 @@ bool CPDF_Creator::Create(uint32_t flags) {
return Continue(nullptr) > -1;
}
-void CPDF_Creator::InitID(FX_BOOL bDefault) {
+void CPDF_Creator::InitID(bool bDefault) {
CPDF_Array* pOldIDArray = m_pParser ? m_pParser->GetIDArray() : nullptr;
- FX_BOOL bNewId = !m_pIDArray;
+ bool bNewId = !m_pIDArray;
if (bNewId) {
m_pIDArray.reset(new CPDF_Array);
CPDF_Object* pID1 = pOldIDArray ? pOldIDArray->GetObjectAt(0) : nullptr;
@@ -1937,7 +1936,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) {
std::vector<uint8_t> buffer =
PDF_GenerateFileID((uint32_t)(uintptr_t)this, m_dwLastObjNum);
CFX_ByteString bsBuffer(buffer.data(), buffer.size());
- m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE));
+ m_pIDArray->Add(new CPDF_String(bsBuffer, true));
}
}
if (!bDefault) {
@@ -1952,7 +1951,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) {
std::vector<uint8_t> buffer =
PDF_GenerateFileID((uint32_t)(uintptr_t)this, m_dwLastObjNum);
CFX_ByteString bsBuffer(buffer.data(), buffer.size());
- m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE));
+ m_pIDArray->Add(new CPDF_String(bsBuffer, true));
return;
}
m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone());
@@ -1968,8 +1967,8 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) {
delete m_pCryptoHandler;
m_pCryptoHandler = new CPDF_CryptoHandler;
m_pCryptoHandler->Init(m_pEncryptDict, &handler);
- m_bLocalCryptoHandler = TRUE;
- m_bSecurityChanged = TRUE;
+ m_bLocalCryptoHandler = true;
+ m_bSecurityChanged = true;
}
}
}
@@ -1999,16 +1998,16 @@ int32_t CPDF_Creator::Continue(IFX_Pause* pPause) {
}
return m_iStage;
}
-FX_BOOL CPDF_Creator::SetFileVersion(int32_t fileVersion) {
+bool CPDF_Creator::SetFileVersion(int32_t fileVersion) {
if (fileVersion < 10 || fileVersion > 17) {
- return FALSE;
+ return false;
}
m_FileVersion = fileVersion;
- return TRUE;
+ return true;
}
void CPDF_Creator::RemoveSecurity() {
ResetStandardSecurity();
- m_bSecurityChanged = TRUE;
+ m_bSecurityChanged = true;
m_pEncryptDict = nullptr;
m_pCryptoHandler = nullptr;
}
@@ -2018,5 +2017,5 @@ void CPDF_Creator::ResetStandardSecurity() {
delete m_pCryptoHandler;
m_pCryptoHandler = nullptr;
- m_bLocalCryptoHandler = FALSE;
+ m_bLocalCryptoHandler = false;
}
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index 00c8a3662b..0217391c12 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -362,7 +362,7 @@ bool CPDF_CIDFont::Load() {
m_pCMap = new CPDF_CMap;
m_pAllocatedCMap.reset(m_pCMap);
CPDF_StreamAcc acc;
- acc.LoadAllData(pStream, FALSE);
+ acc.LoadAllData(pStream, false);
m_pCMap->LoadEmbedded(acc.GetData(), acc.GetSize());
} else {
return false;
@@ -399,7 +399,7 @@ bool CPDF_CIDFont::Load() {
if (pmap) {
if (CPDF_Stream* pStream = pmap->AsStream()) {
m_pStreamAcc.reset(new CPDF_StreamAcc);
- m_pStreamAcc->LoadAllData(pStream, FALSE);
+ m_pStreamAcc->LoadAllData(pStream, false);
} else if (pmap->GetString() == "Identity") {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
if (m_pFontFile)
@@ -600,7 +600,7 @@ int CPDF_CIDFont::GetVerticalGlyph(int index, bool* pVertGlyph) {
int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
if (pVertGlyph)
- *pVertGlyph = FALSE;
+ *pVertGlyph = false;
if (!m_pFontFile && !m_pStreamAcc) {
uint16_t cid = CIDFromCharCode(charcode);
diff --git a/core/fpdfapi/font/fpdf_font.cpp b/core/fpdfapi/font/fpdf_font.cpp
index 056204ad7e..c827ea5793 100644
--- a/core/fpdfapi/font/fpdf_font.cpp
+++ b/core/fpdfapi/font/fpdf_font.cpp
@@ -208,7 +208,7 @@ uint32_t CPDF_ToUnicodeMap::GetUnicode() {
void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
CIDSet cid_set = CIDSET_UNKNOWN;
CPDF_StreamAcc stream;
- stream.LoadAllData(pStream, FALSE);
+ stream.LoadAllData(pStream, false);
CPDF_SimpleParser parser(stream.GetData(), stream.GetSize());
while (1) {
CFX_ByteStringC word = parser.GetWord();
@@ -307,7 +307,7 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
m_pBaseMap = CPDF_ModuleMgr::Get()
->GetPageModule()
->GetFontGlobals()
- ->m_CMapManager.GetCID2UnicodeMap(cid_set, FALSE);
+ ->m_CMapManager.GetCID2UnicodeMap(cid_set, false);
} else {
m_pBaseMap = nullptr;
}
diff --git a/core/fpdfapi/page/cpdf_allstates.cpp b/core/fpdfapi/page/cpdf_allstates.cpp
index 70de98e3f0..012c1349c0 100644
--- a/core/fpdfapi/page/cpdf_allstates.cpp
+++ b/core/fpdfapi/page/cpdf_allstates.cpp
@@ -109,7 +109,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
m_GeneralState.SetBlendMode(pArray ? pArray->GetStringAt(0)
: pObject->GetString());
if (m_GeneralState.GetBlendType() > FXDIB_BLEND_MULTIPLY)
- pParser->GetPageObjectHolder()->SetBackgroundAlphaNeeded(TRUE);
+ pParser->GetPageObjectHolder()->SetBackgroundAlphaNeeded(true);
break;
}
case FXBSTR_ID('S', 'M', 'a', 's'):
diff --git a/core/fpdfapi/page/cpdf_clippath.cpp b/core/fpdfapi/page/cpdf_clippath.cpp
index 9d4b737d33..465a1c7997 100644
--- a/core/fpdfapi/page/cpdf_clippath.cpp
+++ b/core/fpdfapi/page/cpdf_clippath.cpp
@@ -42,7 +42,7 @@ CPDF_TextObject* CPDF_ClipPath::GetText(size_t i) const {
CFX_FloatRect CPDF_ClipPath::GetClipBox() const {
CFX_FloatRect rect;
- FX_BOOL bStarted = FALSE;
+ bool bStarted = false;
int count = GetPathCount();
if (count) {
rect = GetPath(0).GetBoundingBox();
@@ -50,26 +50,26 @@ CFX_FloatRect CPDF_ClipPath::GetClipBox() const {
CFX_FloatRect path_rect = GetPath(i).GetBoundingBox();
rect.Intersect(path_rect);
}
- bStarted = TRUE;
+ bStarted = true;
}
count = GetTextCount();
if (count) {
CFX_FloatRect layer_rect;
- FX_BOOL bLayerStarted = FALSE;
+ bool bLayerStarted = false;
for (int i = 0; i < count; i++) {
CPDF_TextObject* pTextObj = GetText(i);
if (!pTextObj) {
if (!bStarted) {
rect = layer_rect;
- bStarted = TRUE;
+ bStarted = true;
} else {
rect.Intersect(layer_rect);
}
- bLayerStarted = FALSE;
+ bLayerStarted = false;
} else {
if (!bLayerStarted) {
layer_rect = CFX_FloatRect(pTextObj->GetBBox(nullptr));
- bLayerStarted = TRUE;
+ bLayerStarted = true;
} else {
layer_rect.Union(CFX_FloatRect(pTextObj->GetBBox(nullptr)));
}
diff --git a/core/fpdfapi/page/cpdf_color.cpp b/core/fpdfapi/page/cpdf_color.cpp
index 68fa0edacf..4ba28ce314 100644
--- a/core/fpdfapi/page/cpdf_color.cpp
+++ b/core/fpdfapi/page/cpdf_color.cpp
@@ -132,18 +132,18 @@ void CPDF_Color::Copy(const CPDF_Color* pSrc) {
}
}
-FX_BOOL CPDF_Color::GetRGB(int& R, int& G, int& B) const {
+bool CPDF_Color::GetRGB(int& R, int& G, int& B) const {
if (!m_pCS || !m_pBuffer)
- return FALSE;
+ return false;
FX_FLOAT r = 0.0f, g = 0.0f, b = 0.0f;
if (!m_pCS->GetRGB(m_pBuffer, r, g, b))
- return FALSE;
+ return false;
R = (int32_t)(r * 255 + 0.5f);
G = (int32_t)(g * 255 + 0.5f);
B = (int32_t)(b * 255 + 0.5f);
- return TRUE;
+ return true;
}
CPDF_Pattern* CPDF_Color::GetPattern() const {
diff --git a/core/fpdfapi/page/cpdf_color.h b/core/fpdfapi/page/cpdf_color.h
index 3eb839a684..e81b531055 100644
--- a/core/fpdfapi/page/cpdf_color.h
+++ b/core/fpdfapi/page/cpdf_color.h
@@ -26,7 +26,7 @@ class CPDF_Color {
void SetValue(FX_FLOAT* comp);
void SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comp, int ncomps);
- FX_BOOL GetRGB(int& R, int& G, int& B) const;
+ bool GetRGB(int& R, int& G, int& B) const;
CPDF_Pattern* GetPattern() const;
const CPDF_ColorSpace* GetColorSpace() const { return m_pCS; }
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp
index e43bacc079..2740169d04 100644
--- a/core/fpdfapi/page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/page/cpdf_colorspace.cpp
@@ -60,23 +60,23 @@ class CPDF_CalGray : public CPDF_ColorSpace {
public:
explicit CPDF_CalGray(CPDF_Document* pDoc);
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
+ bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
- FX_BOOL SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const override;
+ bool GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const override;
+ bool SetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT R,
+ FX_FLOAT G,
+ FX_FLOAT B) const override;
void TranslateImageLine(uint8_t* pDestBuf,
const uint8_t* pSrcBuf,
int pixels,
int image_width,
int image_height,
- FX_BOOL bTransMask = FALSE) const override;
+ bool bTransMask = false) const override;
private:
FX_FLOAT m_WhitePoint[3];
@@ -88,57 +88,57 @@ class CPDF_CalRGB : public CPDF_ColorSpace {
public:
explicit CPDF_CalRGB(CPDF_Document* pDoc);
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
+ bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
- FX_BOOL SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const override;
+ bool GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const override;
+ bool SetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT R,
+ FX_FLOAT G,
+ FX_FLOAT B) const override;
void TranslateImageLine(uint8_t* pDestBuf,
const uint8_t* pSrcBuf,
int pixels,
int image_width,
int image_height,
- FX_BOOL bTransMask = FALSE) const override;
+ bool bTransMask = false) const override;
FX_FLOAT m_WhitePoint[3];
FX_FLOAT m_BlackPoint[3];
FX_FLOAT m_Gamma[3];
FX_FLOAT m_Matrix[9];
- FX_BOOL m_bGamma;
- FX_BOOL m_bMatrix;
+ bool m_bGamma;
+ bool m_bMatrix;
};
class CPDF_LabCS : public CPDF_ColorSpace {
public:
explicit CPDF_LabCS(CPDF_Document* pDoc);
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
+ bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
void GetDefaultValue(int iComponent,
FX_FLOAT& value,
FX_FLOAT& min,
FX_FLOAT& max) const override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
- FX_BOOL SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const override;
+ bool GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const override;
+ bool SetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT R,
+ FX_FLOAT G,
+ FX_FLOAT B) const override;
void TranslateImageLine(uint8_t* pDestBuf,
const uint8_t* pSrcBuf,
int pixels,
int image_width,
int image_height,
- FX_BOOL bTransMask = FALSE) const override;
+ bool bTransMask = false) const override;
FX_FLOAT m_WhitePoint[3];
FX_FLOAT m_BlackPoint[3];
@@ -150,36 +150,36 @@ class CPDF_ICCBasedCS : public CPDF_ColorSpace {
explicit CPDF_ICCBasedCS(CPDF_Document* pDoc);
~CPDF_ICCBasedCS() override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
+ bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
- FX_BOOL SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const override;
-
- FX_BOOL v_GetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) const override;
-
- void EnableStdConversion(FX_BOOL bEnabled) override;
+ bool GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const override;
+ bool SetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT R,
+ FX_FLOAT G,
+ FX_FLOAT B) const override;
+
+ bool v_GetCMYK(FX_FLOAT* pBuf,
+ FX_FLOAT& c,
+ FX_FLOAT& m,
+ FX_FLOAT& y,
+ FX_FLOAT& k) const override;
+
+ void EnableStdConversion(bool bEnabled) override;
void TranslateImageLine(uint8_t* pDestBuf,
const uint8_t* pSrcBuf,
int pixels,
int image_width,
int image_height,
- FX_BOOL bTransMask = FALSE) const override;
+ bool bTransMask = false) const override;
CPDF_ColorSpace* m_pAlterCS;
CPDF_IccProfile* m_pProfile;
uint8_t* m_pCache;
FX_FLOAT* m_pRanges;
- FX_BOOL m_bOwn;
+ bool m_bOwn;
};
class CPDF_IndexedCS : public CPDF_ColorSpace {
@@ -187,15 +187,15 @@ class CPDF_IndexedCS : public CPDF_ColorSpace {
explicit CPDF_IndexedCS(CPDF_Document* pDoc);
~CPDF_IndexedCS() override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
+ bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
+ bool GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const override;
CPDF_ColorSpace* GetBaseCS() const override;
- void EnableStdConversion(FX_BOOL bEnabled) override;
+ void EnableStdConversion(bool bEnabled) override;
CPDF_ColorSpace* m_pBaseCS;
CPDF_CountedColorSpace* m_pCountedBaseCS;
@@ -215,12 +215,12 @@ class CPDF_SeparationCS : public CPDF_ColorSpace {
FX_FLOAT& value,
FX_FLOAT& min,
FX_FLOAT& max) const override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
- void EnableStdConversion(FX_BOOL bEnabled) override;
+ bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
+ bool GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const override;
+ void EnableStdConversion(bool bEnabled) override;
std::unique_ptr<CPDF_ColorSpace> m_pAltCS;
std::unique_ptr<CPDF_Function> m_pFunc;
@@ -237,12 +237,12 @@ class CPDF_DeviceNCS : public CPDF_ColorSpace {
FX_FLOAT& value,
FX_FLOAT& min,
FX_FLOAT& max) const override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
- void EnableStdConversion(FX_BOOL bEnabled) override;
+ bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
+ bool GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const override;
+ void EnableStdConversion(bool bEnabled) override;
std::unique_ptr<CPDF_ColorSpace> m_pAltCS;
std::unique_ptr<CPDF_Function> m_pFunc;
@@ -418,47 +418,47 @@ FX_FLOAT* CPDF_ColorSpace::CreateBuf() {
return (FX_FLOAT*)pBuf;
}
-FX_BOOL CPDF_ColorSpace::sRGB() const {
+bool CPDF_ColorSpace::sRGB() const {
if (m_Family == PDFCS_DEVICERGB) {
- return TRUE;
+ return true;
}
if (m_Family != PDFCS_ICCBASED) {
- return FALSE;
+ return false;
}
CPDF_ICCBasedCS* pCS = (CPDF_ICCBasedCS*)this;
return pCS->m_pProfile->m_bsRGB;
}
-FX_BOOL CPDF_ColorSpace::SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const {
- return FALSE;
+bool CPDF_ColorSpace::SetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT R,
+ FX_FLOAT G,
+ FX_FLOAT B) const {
+ return false;
}
-FX_BOOL CPDF_ColorSpace::GetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) const {
+bool CPDF_ColorSpace::GetCMYK(FX_FLOAT* pBuf,
+ FX_FLOAT& c,
+ FX_FLOAT& m,
+ FX_FLOAT& y,
+ FX_FLOAT& k) const {
if (v_GetCMYK(pBuf, c, m, y, k)) {
- return TRUE;
+ return true;
}
FX_FLOAT R, G, B;
if (!GetRGB(pBuf, R, G, B)) {
- return FALSE;
+ return false;
}
sRGB_to_AdobeCMYK(R, G, B, c, m, y, k);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_ColorSpace::SetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT c,
- FX_FLOAT m,
- FX_FLOAT y,
- FX_FLOAT k) const {
+bool CPDF_ColorSpace::SetCMYK(FX_FLOAT* pBuf,
+ FX_FLOAT c,
+ FX_FLOAT m,
+ FX_FLOAT y,
+ FX_FLOAT k) const {
if (v_SetCMYK(pBuf, c, m, y, k)) {
- return TRUE;
+ return true;
}
FX_FLOAT R, G, B;
AdobeCMYK_to_sRGB(c, m, y, k, R, G, B);
@@ -493,7 +493,7 @@ void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf,
int pixels,
int image_width,
int image_height,
- FX_BOOL bTransMask) const {
+ bool bTransMask) const {
CFX_FixedBufGrow<FX_FLOAT, 16> srcbuf(m_nComponents);
FX_FLOAT* src = srcbuf;
FX_FLOAT R, G, B;
@@ -515,7 +515,7 @@ CPDF_ColorSpace* CPDF_ColorSpace::GetBaseCS() const {
return nullptr;
}
-void CPDF_ColorSpace::EnableStdConversion(FX_BOOL bEnabled) {
+void CPDF_ColorSpace::EnableStdConversion(bool bEnabled) {
if (bEnabled)
m_dwStdConversion++;
else if (m_dwStdConversion)
@@ -533,33 +533,33 @@ CPDF_ColorSpace::CPDF_ColorSpace(CPDF_Document* pDoc,
CPDF_ColorSpace::~CPDF_ColorSpace() {}
-FX_BOOL CPDF_ColorSpace::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
- return TRUE;
+bool CPDF_ColorSpace::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
+ return true;
}
-FX_BOOL CPDF_ColorSpace::v_GetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) const {
- return FALSE;
+bool CPDF_ColorSpace::v_GetCMYK(FX_FLOAT* pBuf,
+ FX_FLOAT& c,
+ FX_FLOAT& m,
+ FX_FLOAT& y,
+ FX_FLOAT& k) const {
+ return false;
}
-FX_BOOL CPDF_ColorSpace::v_SetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT c,
- FX_FLOAT m,
- FX_FLOAT y,
- FX_FLOAT k) const {
- return FALSE;
+bool CPDF_ColorSpace::v_SetCMYK(FX_FLOAT* pBuf,
+ FX_FLOAT c,
+ FX_FLOAT m,
+ FX_FLOAT y,
+ FX_FLOAT k) const {
+ return false;
}
CPDF_CalGray::CPDF_CalGray(CPDF_Document* pDoc)
: CPDF_ColorSpace(pDoc, PDFCS_CALGRAY, 1) {}
-FX_BOOL CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
+bool CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
CPDF_Dictionary* pDict = pArray->GetDictAt(1);
if (!pDict)
- return FALSE;
+ return false;
CPDF_Array* pParam = pDict->GetArrayFor("WhitePoint");
int i;
@@ -573,26 +573,26 @@ FX_BOOL CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
m_Gamma = pDict->GetNumberFor("Gamma");
if (m_Gamma == 0)
m_Gamma = 1.0f;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CalGray::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
+bool CPDF_CalGray::GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const {
R = G = B = *pBuf;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CalGray::SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const {
+bool CPDF_CalGray::SetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT R,
+ FX_FLOAT G,
+ FX_FLOAT B) const {
if (R == G && R == B) {
*pBuf = R;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void CPDF_CalGray::TranslateImageLine(uint8_t* pDestBuf,
@@ -600,7 +600,7 @@ void CPDF_CalGray::TranslateImageLine(uint8_t* pDestBuf,
int pixels,
int image_width,
int image_height,
- FX_BOOL bTransMask) const {
+ bool bTransMask) const {
for (int i = 0; i < pixels; i++) {
*pDestBuf++ = pSrcBuf[i];
*pDestBuf++ = pSrcBuf[i];
@@ -611,10 +611,10 @@ void CPDF_CalGray::TranslateImageLine(uint8_t* pDestBuf,
CPDF_CalRGB::CPDF_CalRGB(CPDF_Document* pDoc)
: CPDF_ColorSpace(pDoc, PDFCS_CALRGB, 3) {}
-FX_BOOL CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
+bool CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
CPDF_Dictionary* pDict = pArray->GetDictAt(1);
if (!pDict)
- return FALSE;
+ return false;
CPDF_Array* pParam = pDict->GetArrayFor("WhitePoint");
int i;
@@ -627,28 +627,28 @@ FX_BOOL CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
pParam = pDict->GetArrayFor("Gamma");
if (pParam) {
- m_bGamma = TRUE;
+ m_bGamma = true;
for (i = 0; i < 3; i++)
m_Gamma[i] = pParam->GetNumberAt(i);
} else {
- m_bGamma = FALSE;
+ m_bGamma = false;
}
pParam = pDict->GetArrayFor("Matrix");
if (pParam) {
- m_bMatrix = TRUE;
+ m_bMatrix = true;
for (i = 0; i < 9; i++)
m_Matrix[i] = pParam->GetNumberAt(i);
} else {
- m_bMatrix = FALSE;
+ m_bMatrix = false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CalRGB::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
+bool CPDF_CalRGB::GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const {
FX_FLOAT A_ = pBuf[0];
FX_FLOAT B_ = pBuf[1];
FX_FLOAT C_ = pBuf[2];
@@ -672,17 +672,17 @@ FX_BOOL CPDF_CalRGB::GetRGB(FX_FLOAT* pBuf,
}
XYZ_to_sRGB_WhitePoint(X, Y, Z, R, G, B, m_WhitePoint[0], m_WhitePoint[1],
m_WhitePoint[2]);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CalRGB::SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const {
+bool CPDF_CalRGB::SetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT R,
+ FX_FLOAT G,
+ FX_FLOAT B) const {
pBuf[0] = R;
pBuf[1] = G;
pBuf[2] = B;
- return TRUE;
+ return true;
}
void CPDF_CalRGB::TranslateImageLine(uint8_t* pDestBuf,
@@ -690,7 +690,7 @@ void CPDF_CalRGB::TranslateImageLine(uint8_t* pDestBuf,
int pixels,
int image_width,
int image_height,
- FX_BOOL bTransMask) const {
+ bool bTransMask) const {
if (bTransMask) {
FX_FLOAT Cal[3];
FX_FLOAT R;
@@ -733,10 +733,10 @@ void CPDF_LabCS::GetDefaultValue(int iComponent,
}
}
-FX_BOOL CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
+bool CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
CPDF_Dictionary* pDict = pArray->GetDictAt(1);
if (!pDict)
- return FALSE;
+ return false;
CPDF_Array* pParam = pDict->GetArrayFor("WhitePoint");
int i;
@@ -752,13 +752,13 @@ FX_BOOL CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
100 * 1.0f};
for (i = 0; i < 4; i++)
m_Ranges[i] = pParam ? pParam->GetNumberAt(i) : def_ranges[i];
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_LabCS::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
+bool CPDF_LabCS::GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const {
FX_FLOAT Lstar = pBuf[0];
FX_FLOAT astar = pBuf[1];
FX_FLOAT bstar = pBuf[2];
@@ -782,14 +782,14 @@ FX_BOOL CPDF_LabCS::GetRGB(FX_FLOAT* pBuf,
Z = 1.0889f * N * N * N;
XYZ_to_sRGB(X, Y, Z, R, G, B);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_LabCS::SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const {
- return FALSE;
+bool CPDF_LabCS::SetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT R,
+ FX_FLOAT G,
+ FX_FLOAT B) const {
+ return false;
}
void CPDF_LabCS::TranslateImageLine(uint8_t* pDestBuf,
@@ -797,7 +797,7 @@ void CPDF_LabCS::TranslateImageLine(uint8_t* pDestBuf,
int pixels,
int image_width,
int image_height,
- FX_BOOL bTransMask) const {
+ bool bTransMask) const {
for (int i = 0; i < pixels; i++) {
FX_FLOAT lab[3];
FX_FLOAT R, G, B;
@@ -819,7 +819,7 @@ CPDF_ICCBasedCS::CPDF_ICCBasedCS(CPDF_Document* pDoc)
m_pProfile(nullptr),
m_pCache(nullptr),
m_pRanges(nullptr),
- m_bOwn(FALSE) {}
+ m_bOwn(false) {}
CPDF_ICCBasedCS::~CPDF_ICCBasedCS() {
FX_Free(m_pCache);
@@ -830,14 +830,14 @@ CPDF_ICCBasedCS::~CPDF_ICCBasedCS() {
m_pDocument->GetPageData()->ReleaseIccProfile(m_pProfile);
}
-FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
+bool CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
CPDF_Stream* pStream = pArray->GetStreamAt(1);
if (!pStream)
- return FALSE;
+ return false;
m_pProfile = pDoc->LoadIccProfile(pStream);
if (!m_pProfile)
- return FALSE;
+ return false;
m_nComponents =
m_pProfile
@@ -854,19 +854,19 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
if (pAlterCS->CountComponents() > 0) { // Use Alternative colorspace
m_nComponents = pAlterCS->CountComponents();
m_pAlterCS = pAlterCS.release();
- m_bOwn = TRUE;
+ m_bOwn = true;
} else { // No valid alternative colorspace
int32_t nDictComponents = pDict ? pDict->GetIntegerFor("N") : 0;
if (nDictComponents != 1 && nDictComponents != 3 &&
nDictComponents != 4) {
- return FALSE;
+ return false;
}
m_nComponents = nDictComponents;
}
} else { // Using sRGB
if (pAlterCS->CountComponents() == m_nComponents) {
m_pAlterCS = pAlterCS.release();
- m_bOwn = TRUE;
+ m_bOwn = true;
}
}
}
@@ -890,18 +890,18 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
else
m_pRanges[i] = 0;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
+bool CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const {
if (m_pProfile && m_pProfile->m_bsRGB) {
R = pBuf[0];
G = pBuf[1];
B = pBuf[2];
- return TRUE;
+ return true;
}
CCodec_IccModule* pIccModule = CPDF_ModuleMgr::Get()->GetIccModule();
if (!m_pProfile->m_pTransform || !pIccModule) {
@@ -911,7 +911,7 @@ FX_BOOL CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf,
R = 0.0f;
G = 0.0f;
B = 0.0f;
- return TRUE;
+ return true;
}
FX_FLOAT rgb[3];
pIccModule->SetComponents(m_nComponents);
@@ -919,32 +919,32 @@ FX_BOOL CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf,
R = rgb[0];
G = rgb[1];
B = rgb[2];
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_ICCBasedCS::SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const {
- return FALSE;
+bool CPDF_ICCBasedCS::SetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT R,
+ FX_FLOAT G,
+ FX_FLOAT B) const {
+ return false;
}
-FX_BOOL CPDF_ICCBasedCS::v_GetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) const {
+bool CPDF_ICCBasedCS::v_GetCMYK(FX_FLOAT* pBuf,
+ FX_FLOAT& c,
+ FX_FLOAT& m,
+ FX_FLOAT& y,
+ FX_FLOAT& k) const {
if (m_nComponents != 4)
- return FALSE;
+ return false;
c = pBuf[0];
m = pBuf[1];
y = pBuf[2];
k = pBuf[3];
- return TRUE;
+ return true;
}
-void CPDF_ICCBasedCS::EnableStdConversion(FX_BOOL bEnabled) {
+void CPDF_ICCBasedCS::EnableStdConversion(bool bEnabled) {
CPDF_ColorSpace::EnableStdConversion(bEnabled);
if (m_pAlterCS)
m_pAlterCS->EnableStdConversion(bEnabled);
@@ -955,7 +955,7 @@ void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf,
int pixels,
int image_width,
int image_height,
- FX_BOOL bTransMask) const {
+ bool bTransMask) const {
if (m_pProfile->m_bsRGB) {
ReverseRGB(pDestBuf, pSrcBuf, pixels);
} else if (m_pProfile->m_pTransform) {
@@ -1016,18 +1016,18 @@ CPDF_IndexedCS::~CPDF_IndexedCS() {
}
}
-FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
+bool CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
if (pArray->GetCount() < 4) {
- return FALSE;
+ return false;
}
CPDF_Object* pBaseObj = pArray->GetDirectObjectAt(1);
if (pBaseObj == m_pArray) {
- return FALSE;
+ return false;
}
CPDF_DocPageData* pDocPageData = pDoc->GetPageData();
m_pBaseCS = pDocPageData->GetColorSpace(pBaseObj, nullptr);
if (!m_pBaseCS) {
- return FALSE;
+ return false;
}
m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray());
m_nBaseComponents = m_pBaseCS->CountComponents();
@@ -1042,31 +1042,31 @@ FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
CPDF_Object* pTableObj = pArray->GetDirectObjectAt(3);
if (!pTableObj)
- return FALSE;
+ return false;
if (CPDF_String* pString = pTableObj->AsString()) {
m_Table = pString->GetString();
} else if (CPDF_Stream* pStream = pTableObj->AsStream()) {
CPDF_StreamAcc acc;
- acc.LoadAllData(pStream, FALSE);
+ acc.LoadAllData(pStream, false);
m_Table = CFX_ByteStringC(acc.GetData(), acc.GetSize());
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
+bool CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const {
int index = (int32_t)(*pBuf);
if (index < 0 || index > m_MaxIndex) {
- return FALSE;
+ return false;
}
if (m_nBaseComponents) {
if (index == INT_MAX || (index + 1) > INT_MAX / m_nBaseComponents ||
(index + 1) * m_nBaseComponents > (int)m_Table.GetLength()) {
R = G = B = 0;
- return FALSE;
+ return false;
}
}
CFX_FixedBufGrow<FX_FLOAT, 16> Comps(m_nBaseComponents);
@@ -1084,7 +1084,7 @@ CPDF_ColorSpace* CPDF_IndexedCS::GetBaseCS() const {
return m_pBaseCS;
}
-void CPDF_IndexedCS::EnableStdConversion(FX_BOOL bEnabled) {
+void CPDF_IndexedCS::EnableStdConversion(bool bEnabled) {
CPDF_ColorSpace::EnableStdConversion(bEnabled);
if (m_pBaseCS) {
m_pBaseCS->EnableStdConversion(bEnabled);
@@ -1103,41 +1103,41 @@ CPDF_PatternCS::~CPDF_PatternCS() {
}
}
-FX_BOOL CPDF_PatternCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
+bool CPDF_PatternCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
CPDF_Object* pBaseCS = pArray->GetDirectObjectAt(1);
if (pBaseCS == m_pArray) {
- return FALSE;
+ return false;
}
CPDF_DocPageData* pDocPageData = pDoc->GetPageData();
m_pBaseCS = pDocPageData->GetColorSpace(pBaseCS, nullptr);
if (m_pBaseCS) {
if (m_pBaseCS->GetFamily() == PDFCS_PATTERN) {
- return FALSE;
+ return false;
}
m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray());
m_nComponents = m_pBaseCS->CountComponents() + 1;
if (m_pBaseCS->CountComponents() > MAX_PATTERN_COLORCOMPS) {
- return FALSE;
+ return false;
}
} else {
m_nComponents = 1;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_PatternCS::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
+bool CPDF_PatternCS::GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const {
if (m_pBaseCS) {
ASSERT(m_pBaseCS->GetFamily() != PDFCS_PATTERN);
PatternValue* pvalue = (PatternValue*)pBuf;
if (m_pBaseCS->GetRGB(pvalue->m_Comps, R, G, B)) {
- return TRUE;
+ return true;
}
}
R = G = B = 0.75f;
- return FALSE;
+ return false;
}
CPDF_ColorSpace* CPDF_PatternCS::GetBaseCS() const {
@@ -1158,21 +1158,21 @@ void CPDF_SeparationCS::GetDefaultValue(int iComponent,
max = 1.0f;
}
-FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
+bool CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
CFX_ByteString name = pArray->GetStringAt(1);
if (name == "None") {
m_Type = None;
- return TRUE;
+ return true;
}
m_Type = Colorant;
CPDF_Object* pAltCS = pArray->GetDirectObjectAt(2);
if (pAltCS == m_pArray)
- return FALSE;
+ return false;
m_pAltCS = Load(pDoc, pAltCS);
if (!m_pAltCS)
- return FALSE;
+ return false;
CPDF_Object* pFuncObj = pArray->GetDirectObjectAt(3);
if (pFuncObj && !pFuncObj->IsName())
@@ -1180,19 +1180,19 @@ FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
if (m_pFunc && m_pFunc->CountOutputs() < m_pAltCS->CountComponents())
m_pFunc.reset();
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
+bool CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const {
if (m_Type == None)
- return FALSE;
+ return false;
if (!m_pFunc) {
if (!m_pAltCS)
- return FALSE;
+ return false;
int nComps = m_pAltCS->CountComponents();
CFX_FixedBufGrow<FX_FLOAT, 16> results(nComps);
@@ -1205,7 +1205,7 @@ FX_BOOL CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf,
int nresults = 0;
m_pFunc->Call(pBuf, 1, results, nresults);
if (nresults == 0)
- return FALSE;
+ return false;
if (m_pAltCS)
return m_pAltCS->GetRGB(results, R, G, B);
@@ -1213,10 +1213,10 @@ FX_BOOL CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf,
R = 0;
G = 0;
B = 0;
- return FALSE;
+ return false;
}
-void CPDF_SeparationCS::EnableStdConversion(FX_BOOL bEnabled) {
+void CPDF_SeparationCS::EnableStdConversion(bool bEnabled) {
CPDF_ColorSpace::EnableStdConversion(bEnabled);
if (m_pAltCS)
m_pAltCS->EnableStdConversion(bEnabled);
@@ -1236,41 +1236,41 @@ void CPDF_DeviceNCS::GetDefaultValue(int iComponent,
max = 1.0f;
}
-FX_BOOL CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
+bool CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
CPDF_Array* pObj = ToArray(pArray->GetDirectObjectAt(1));
if (!pObj)
- return FALSE;
+ return false;
m_nComponents = pObj->GetCount();
CPDF_Object* pAltCS = pArray->GetDirectObjectAt(2);
if (!pAltCS || pAltCS == m_pArray)
- return FALSE;
+ return false;
m_pAltCS = Load(pDoc, pAltCS);
m_pFunc = CPDF_Function::Load(pArray->GetDirectObjectAt(3));
if (!m_pAltCS || !m_pFunc)
- return FALSE;
+ return false;
return m_pFunc->CountOutputs() >= m_pAltCS->CountComponents();
}
-FX_BOOL CPDF_DeviceNCS::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
+bool CPDF_DeviceNCS::GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const {
if (!m_pFunc)
- return FALSE;
+ return false;
CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs());
int nresults = 0;
m_pFunc->Call(pBuf, m_nComponents, results, nresults);
if (nresults == 0)
- return FALSE;
+ return false;
return m_pAltCS->GetRGB(results, R, G, B);
}
-void CPDF_DeviceNCS::EnableStdConversion(FX_BOOL bEnabled) {
+void CPDF_DeviceNCS::EnableStdConversion(bool bEnabled) {
CPDF_ColorSpace::EnableStdConversion(bEnabled);
if (m_pAltCS) {
m_pAltCS->EnableStdConversion(bEnabled);
diff --git a/core/fpdfapi/page/cpdf_colorspace.h b/core/fpdfapi/page/cpdf_colorspace.h
index 78311ce195..c4d62ed849 100644
--- a/core/fpdfapi/page/cpdf_colorspace.h
+++ b/core/fpdfapi/page/cpdf_colorspace.h
@@ -47,38 +47,35 @@ class CPDF_ColorSpace {
FX_FLOAT& min,
FX_FLOAT& max) const;
- FX_BOOL sRGB() const;
- virtual FX_BOOL GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const = 0;
- virtual FX_BOOL SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const;
-
- FX_BOOL GetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) const;
- FX_BOOL SetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT c,
- FX_FLOAT m,
- FX_FLOAT y,
- FX_FLOAT k) const;
+ bool sRGB() const;
+ virtual bool GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const = 0;
+ virtual bool SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const;
+
+ bool GetCMYK(FX_FLOAT* pBuf,
+ FX_FLOAT& c,
+ FX_FLOAT& m,
+ FX_FLOAT& y,
+ FX_FLOAT& k) const;
+ bool SetCMYK(FX_FLOAT* pBuf,
+ FX_FLOAT c,
+ FX_FLOAT m,
+ FX_FLOAT y,
+ FX_FLOAT k) const;
virtual void TranslateImageLine(uint8_t* dest_buf,
const uint8_t* src_buf,
int pixels,
int image_width,
int image_height,
- FX_BOOL bTransMask = FALSE) const;
+ bool bTransMask = false) const;
CPDF_Array*& GetArray() { return m_pArray; }
virtual CPDF_ColorSpace* GetBaseCS() const;
- virtual void EnableStdConversion(FX_BOOL bEnabled);
+ virtual void EnableStdConversion(bool bEnabled);
CPDF_Document* const m_pDocument;
@@ -86,17 +83,17 @@ class CPDF_ColorSpace {
CPDF_ColorSpace(CPDF_Document* pDoc, int family, uint32_t nComponents);
virtual ~CPDF_ColorSpace();
- virtual FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray);
- virtual FX_BOOL v_GetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) const;
- virtual FX_BOOL v_SetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT c,
- FX_FLOAT m,
- FX_FLOAT y,
- FX_FLOAT k) const;
+ virtual bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray);
+ virtual bool v_GetCMYK(FX_FLOAT* pBuf,
+ FX_FLOAT& c,
+ FX_FLOAT& m,
+ FX_FLOAT& y,
+ FX_FLOAT& k) const;
+ virtual bool v_SetCMYK(FX_FLOAT* pBuf,
+ FX_FLOAT c,
+ FX_FLOAT m,
+ FX_FLOAT y,
+ FX_FLOAT k) const;
int m_Family;
uint32_t m_nComponents;
diff --git a/core/fpdfapi/page/cpdf_colorstate.cpp b/core/fpdfapi/page/cpdf_colorstate.cpp
index da583122af..c43a331c64 100644
--- a/core/fpdfapi/page/cpdf_colorstate.cpp
+++ b/core/fpdfapi/page/cpdf_colorstate.cpp
@@ -89,7 +89,7 @@ void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern,
ColorData* pData = m_Ref.GetPrivateCopy();
pData->m_FillColor.SetValue(pPattern, pValue, nValues);
int R, G, B;
- FX_BOOL ret = pData->m_FillColor.GetRGB(R, G, B);
+ bool ret = pData->m_FillColor.GetRGB(R, G, B);
if (CPDF_TilingPattern* pTilingPattern = pPattern->AsTilingPattern()) {
if (!ret && pTilingPattern->colored()) {
pData->m_FillRGB = 0x00BFBFBF;
@@ -105,7 +105,7 @@ void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern,
ColorData* pData = m_Ref.GetPrivateCopy();
pData->m_StrokeColor.SetValue(pPattern, pValue, nValues);
int R, G, B;
- FX_BOOL ret = pData->m_StrokeColor.GetRGB(R, G, B);
+ bool ret = pData->m_StrokeColor.GetRGB(R, G, B);
if (CPDF_TilingPattern* pTilingPattern = pPattern->AsTilingPattern()) {
if (!ret && pTilingPattern->colored()) {
pData->m_StrokeRGB = 0x00BFBFBF;
diff --git a/core/fpdfapi/page/cpdf_contentmark.cpp b/core/fpdfapi/page/cpdf_contentmark.cpp
index 4e8625b940..d60e144d6e 100644
--- a/core/fpdfapi/page/cpdf_contentmark.cpp
+++ b/core/fpdfapi/page/cpdf_contentmark.cpp
@@ -35,7 +35,7 @@ int CPDF_ContentMark::GetMCID() const {
void CPDF_ContentMark::AddMark(const CFX_ByteString& name,
CPDF_Dictionary* pDict,
- FX_BOOL bDirect) {
+ bool bDirect) {
m_Ref.GetPrivateCopy()->AddMark(name, pDict, bDirect);
}
@@ -104,7 +104,7 @@ int CPDF_ContentMark::MarkData::GetMCID() const {
void CPDF_ContentMark::MarkData::AddMark(const CFX_ByteString& name,
CPDF_Dictionary* pDict,
- FX_BOOL bDirect) {
+ bool bDirect) {
CPDF_ContentMarkItem item;
item.SetName(name);
if (pDict) {
diff --git a/core/fpdfapi/page/cpdf_contentmark.h b/core/fpdfapi/page/cpdf_contentmark.h
index 485fe3b4c6..154f19d529 100644
--- a/core/fpdfapi/page/cpdf_contentmark.h
+++ b/core/fpdfapi/page/cpdf_contentmark.h
@@ -32,7 +32,7 @@ class CPDF_ContentMark {
bool LookupMark(const CFX_ByteStringC& mark, CPDF_Dictionary*& pDict) const;
void AddMark(const CFX_ByteString& name,
CPDF_Dictionary* pDict,
- FX_BOOL bDirect);
+ bool bDirect);
void DeleteLastMark();
explicit operator bool() const { return !!m_Ref; }
@@ -51,7 +51,7 @@ class CPDF_ContentMark {
int GetMCID() const;
void AddMark(const CFX_ByteString& name,
CPDF_Dictionary* pDict,
- FX_BOOL bDictNeedClone);
+ bool bDictNeedClone);
void DeleteLastMark();
private:
diff --git a/core/fpdfapi/page/cpdf_contentmarkitem.cpp b/core/fpdfapi/page/cpdf_contentmarkitem.cpp
index 507dc22d9a..597f8a595c 100644
--- a/core/fpdfapi/page/cpdf_contentmarkitem.cpp
+++ b/core/fpdfapi/page/cpdf_contentmarkitem.cpp
@@ -33,7 +33,7 @@ CPDF_Dictionary* CPDF_ContentMarkItem::GetParam() const {
}
}
-FX_BOOL CPDF_ContentMarkItem::HasMCID() const {
+bool CPDF_ContentMarkItem::HasMCID() const {
CPDF_Dictionary* pDict = GetParam();
return pDict && pDict->KeyExist("MCID");
}
diff --git a/core/fpdfapi/page/cpdf_contentmarkitem.h b/core/fpdfapi/page/cpdf_contentmarkitem.h
index ef691e252c..f1f06c3a38 100644
--- a/core/fpdfapi/page/cpdf_contentmarkitem.h
+++ b/core/fpdfapi/page/cpdf_contentmarkitem.h
@@ -28,7 +28,7 @@ class CPDF_ContentMarkItem {
CFX_ByteString GetName() const { return m_MarkName; }
ParamType GetParamType() const { return m_ParamType; }
CPDF_Dictionary* GetParam() const;
- FX_BOOL HasMCID() const;
+ bool HasMCID() const;
void SetName(const CFX_ByteString& name) { m_MarkName = name; }
void SetDirectDict(
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp
index 5f1f561ebb..c4dc050215 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.cpp
+++ b/core/fpdfapi/page/cpdf_docpagedata.cpp
@@ -445,7 +445,7 @@ CPDF_IccProfile* CPDF_DocPageData::GetIccProfile(
return it->second->AddRef();
CPDF_StreamAcc stream;
- stream.LoadAllData(pIccProfileStream, FALSE);
+ stream.LoadAllData(pIccProfileStream, false);
uint8_t digest[20];
CRYPT_SHA1Generate(stream.GetData(), stream.GetSize(), digest);
CFX_ByteString bsDigest(digest, 20);
@@ -497,7 +497,7 @@ CPDF_StreamAcc* CPDF_DocPageData::GetFontFileStreamAcc(
org_size = std::max(org_size, 0);
CPDF_StreamAcc* pFontFile = new CPDF_StreamAcc;
- pFontFile->LoadAllData(pFontStream, FALSE, org_size);
+ pFontFile->LoadAllData(pFontStream, false, org_size);
CPDF_CountedStreamAcc* pCountedFont = new CPDF_CountedStreamAcc(pFontFile);
m_FontFileMap[pFontStream] = pCountedFont;
diff --git a/core/fpdfapi/page/cpdf_docpagedata.h b/core/fpdfapi/page/cpdf_docpagedata.h
index 64c0444a5e..bf2b80498d 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.h
+++ b/core/fpdfapi/page/cpdf_docpagedata.h
@@ -29,7 +29,7 @@ class CPDF_DocPageData {
explicit CPDF_DocPageData(CPDF_Document* pPDFDoc);
~CPDF_DocPageData();
- void Clear(bool bRelease = FALSE);
+ void Clear(bool bRelease = false);
CPDF_Font* GetFont(CPDF_Dictionary* pFontDict);
CPDF_Font* GetStandardFont(const CFX_ByteString& fontName,
CPDF_FontEncoding* pEncoding);
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp
index b40bc3ca8e..23c6e4f786 100644
--- a/core/fpdfapi/page/cpdf_image.cpp
+++ b/core/fpdfapi/page/cpdf_image.cpp
@@ -115,7 +115,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, uint32_t size) {
pDict->SetFor("DecodeParms", pParms);
pParms->SetIntegerFor("ColorTransform", 0);
}
- m_bIsMask = FALSE;
+ m_bIsMask = false;
m_Width = width;
m_Height = height;
if (!m_pStream)
@@ -170,7 +170,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) {
ArgbDecode(pBitmap->GetPaletteArgb(1), set_a, set_r, set_g, set_b);
}
if (set_a == 0 || reset_a == 0) {
- pDict->SetFor("ImageMask", new CPDF_Boolean(TRUE));
+ pDict->SetFor("ImageMask", new CPDF_Boolean(true));
if (reset_a == 0) {
CPDF_Array* pArray = new CPDF_Array;
pArray->AddInteger(1);
@@ -191,7 +191,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) {
pBuf[4] = (FX_CHAR)set_g;
pBuf[5] = (FX_CHAR)set_b;
ct.ReleaseBuffer(6);
- pCS->Add(new CPDF_String(ct, TRUE));
+ pCS->Add(new CPDF_String(ct, true));
pDict->SetFor("ColorSpace", pCS);
}
pDict->SetIntegerFor("BitsPerComponent", 1);
@@ -244,10 +244,10 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) {
}
}
const CFX_DIBitmap* pMaskBitmap = nullptr;
- FX_BOOL bDeleteMask = FALSE;
+ bool bDeleteMask = false;
if (pBitmap->HasAlpha()) {
pMaskBitmap = pBitmap->GetAlphaMask();
- bDeleteMask = TRUE;
+ bDeleteMask = true;
}
if (pMaskBitmap) {
int32_t maskWidth = pMaskBitmap->GetWidth();
@@ -348,9 +348,9 @@ void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) {
CFX_DIBSource* CPDF_Image::LoadDIBSource(CFX_DIBSource** ppMask,
uint32_t* pMatteColor,
- FX_BOOL bStdCS,
+ bool bStdCS,
uint32_t GroupFamily,
- FX_BOOL bLoadMask) const {
+ bool bLoadMask) const {
std::unique_ptr<CPDF_DIBSource> source(new CPDF_DIBSource);
if (source->Load(m_pDocument, m_pStream,
reinterpret_cast<CPDF_DIBSource**>(ppMask), pMatteColor,
@@ -372,41 +372,41 @@ CFX_DIBSource* CPDF_Image::DetachMask() {
return pBitmap;
}
-FX_BOOL CPDF_Image::StartLoadDIBSource(CPDF_Dictionary* pFormResource,
- CPDF_Dictionary* pPageResource,
- FX_BOOL bStdCS,
- uint32_t GroupFamily,
- FX_BOOL bLoadMask) {
+bool CPDF_Image::StartLoadDIBSource(CPDF_Dictionary* pFormResource,
+ CPDF_Dictionary* pPageResource,
+ bool bStdCS,
+ uint32_t GroupFamily,
+ bool bLoadMask) {
std::unique_ptr<CPDF_DIBSource> source(new CPDF_DIBSource);
int ret =
- source->StartLoadDIBSource(m_pDocument, m_pStream, TRUE, pFormResource,
+ source->StartLoadDIBSource(m_pDocument, m_pStream, true, pFormResource,
pPageResource, bStdCS, GroupFamily, bLoadMask);
if (ret == 2) {
m_pDIBSource = source.release();
- return TRUE;
+ return true;
}
if (!ret) {
m_pDIBSource = nullptr;
- return FALSE;
+ return false;
}
m_pMask = source->DetachMask();
m_MatteColor = source->GetMatteColor();
m_pDIBSource = source.release();
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_Image::Continue(IFX_Pause* pPause) {
+bool CPDF_Image::Continue(IFX_Pause* pPause) {
CPDF_DIBSource* pSource = static_cast<CPDF_DIBSource*>(m_pDIBSource);
int ret = pSource->ContinueLoadDIBSource(pPause);
if (ret == 2) {
- return TRUE;
+ return true;
}
if (!ret) {
delete m_pDIBSource;
m_pDIBSource = nullptr;
- return FALSE;
+ return false;
}
m_pMask = pSource->DetachMask();
m_MatteColor = pSource->GetMatteColor();
- return FALSE;
+ return false;
}
diff --git a/core/fpdfapi/page/cpdf_image.h b/core/fpdfapi/page/cpdf_image.h
index 1e6f70fa33..f619845597 100644
--- a/core/fpdfapi/page/cpdf_image.h
+++ b/core/fpdfapi/page/cpdf_image.h
@@ -51,21 +51,21 @@ class CPDF_Image {
CFX_DIBSource* LoadDIBSource(CFX_DIBSource** ppMask = nullptr,
uint32_t* pMatteColor = nullptr,
- FX_BOOL bStdCS = FALSE,
+ bool bStdCS = false,
uint32_t GroupFamily = 0,
- FX_BOOL bLoadMask = FALSE) const;
+ bool bLoadMask = false) const;
void SetImage(const CFX_DIBitmap* pDIBitmap, int32_t iCompress);
void SetJpegImage(IFX_SeekableReadStream* pFile);
void ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pDIBitmap);
- FX_BOOL StartLoadDIBSource(CPDF_Dictionary* pFormResource,
- CPDF_Dictionary* pPageResource,
- FX_BOOL bStdCS = FALSE,
- uint32_t GroupFamily = 0,
- FX_BOOL bLoadMask = FALSE);
- FX_BOOL Continue(IFX_Pause* pPause);
+ bool StartLoadDIBSource(CPDF_Dictionary* pFormResource,
+ CPDF_Dictionary* pPageResource,
+ bool bStdCS = false,
+ uint32_t GroupFamily = 0,
+ bool bLoadMask = false);
+ bool Continue(IFX_Pause* pPause);
CFX_DIBSource* DetachBitmap();
CFX_DIBSource* DetachMask();
diff --git a/core/fpdfapi/page/cpdf_meshstream.cpp b/core/fpdfapi/page/cpdf_meshstream.cpp
index c3bfcb4ab5..8bc2a851cc 100644
--- a/core/fpdfapi/page/cpdf_meshstream.cpp
+++ b/core/fpdfapi/page/cpdf_meshstream.cpp
@@ -201,17 +201,17 @@ uint32_t CPDF_MeshStream::GetVertex(CPDF_MeshVertex& vertex,
return flag;
}
-FX_BOOL CPDF_MeshStream::GetVertexRow(CPDF_MeshVertex* vertex,
- int count,
- CFX_Matrix* pObject2Bitmap) {
+bool CPDF_MeshStream::GetVertexRow(CPDF_MeshVertex* vertex,
+ int count,
+ CFX_Matrix* pObject2Bitmap) {
for (int i = 0; i < count; i++) {
if (m_BitStream.IsEOF())
- return FALSE;
+ return false;
GetCoords(vertex[i].x, vertex[i].y);
pObject2Bitmap->Transform(vertex[i].x, vertex[i].y);
GetColor(vertex[i].r, vertex[i].g, vertex[i].b);
m_BitStream.ByteAlign();
}
- return TRUE;
+ return true;
}
diff --git a/core/fpdfapi/page/cpdf_meshstream.h b/core/fpdfapi/page/cpdf_meshstream.h
index 4d37f17889..21a6c2fa8c 100644
--- a/core/fpdfapi/page/cpdf_meshstream.h
+++ b/core/fpdfapi/page/cpdf_meshstream.h
@@ -42,9 +42,9 @@ class CPDF_MeshStream {
void GetColor(FX_FLOAT& r, FX_FLOAT& g, FX_FLOAT& b);
uint32_t GetVertex(CPDF_MeshVertex& vertex, CFX_Matrix* pObject2Bitmap);
- FX_BOOL GetVertexRow(CPDF_MeshVertex* vertex,
- int count,
- CFX_Matrix* pObject2Bitmap);
+ bool GetVertexRow(CPDF_MeshVertex* vertex,
+ int count,
+ CFX_Matrix* pObject2Bitmap);
CFX_BitStream* BitStream() { return &m_BitStream; }
uint32_t ComponentBits() const { return m_nComponentBits; }
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.cpp b/core/fpdfapi/page/cpdf_pageobjectholder.cpp
index 885d9639bd..a52d97f27e 100644
--- a/core/fpdfapi/page/cpdf_pageobjectholder.cpp
+++ b/core/fpdfapi/page/cpdf_pageobjectholder.cpp
@@ -17,8 +17,8 @@ CPDF_PageObjectHolder::CPDF_PageObjectHolder()
m_pPageResources(nullptr),
m_pResources(nullptr),
m_Transparency(0),
- m_bBackgroundAlphaNeeded(FALSE),
- m_bHasImageMask(FALSE),
+ m_bBackgroundAlphaNeeded(false),
+ m_bHasImageMask(false),
m_ParseState(CONTENT_NOT_PARSED) {}
CPDF_PageObjectHolder::~CPDF_PageObjectHolder() {}
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.h b/core/fpdfapi/page/cpdf_pageobjectholder.h
index 96a0a80838..ce5424e009 100644
--- a/core/fpdfapi/page/cpdf_pageobjectholder.h
+++ b/core/fpdfapi/page/cpdf_pageobjectholder.h
@@ -34,13 +34,13 @@ class CPDF_PageObjectHolder {
return &m_PageObjectList;
}
- FX_BOOL BackgroundAlphaNeeded() const { return m_bBackgroundAlphaNeeded; }
- void SetBackgroundAlphaNeeded(FX_BOOL needed) {
+ bool BackgroundAlphaNeeded() const { return m_bBackgroundAlphaNeeded; }
+ void SetBackgroundAlphaNeeded(bool needed) {
m_bBackgroundAlphaNeeded = needed;
}
- FX_BOOL HasImageMask() const { return m_bHasImageMask; }
- void SetHasImageMask(FX_BOOL value) { m_bHasImageMask = value; }
+ bool HasImageMask() const { return m_bHasImageMask; }
+ void SetHasImageMask(bool value) { m_bHasImageMask = value; }
void Transform(const CFX_Matrix& matrix);
CFX_FloatRect CalcBoundingBox() const;
@@ -58,8 +58,8 @@ class CPDF_PageObjectHolder {
void LoadTransInfo();
- FX_BOOL m_bBackgroundAlphaNeeded;
- FX_BOOL m_bHasImageMask;
+ bool m_bBackgroundAlphaNeeded;
+ bool m_bHasImageMask;
ParseState m_ParseState;
std::unique_ptr<CPDF_ContentParser> m_pParser;
CPDF_PageObjectList m_PageObjectList;
diff --git a/core/fpdfapi/page/cpdf_path.cpp b/core/fpdfapi/page/cpdf_path.cpp
index e80edf798e..2bfda75f56 100644
--- a/core/fpdfapi/page/cpdf_path.cpp
+++ b/core/fpdfapi/page/cpdf_path.cpp
@@ -49,7 +49,7 @@ CFX_FloatRect CPDF_Path::GetBoundingBox(FX_FLOAT line_width,
return m_Ref.GetObject()->GetBoundingBox(line_width, miter_limit);
}
-FX_BOOL CPDF_Path::IsRect() const {
+bool CPDF_Path::IsRect() const {
return m_Ref.GetObject()->IsRect();
}
diff --git a/core/fpdfapi/page/cpdf_path.h b/core/fpdfapi/page/cpdf_path.h
index d69672a4de..407905e429 100644
--- a/core/fpdfapi/page/cpdf_path.h
+++ b/core/fpdfapi/page/cpdf_path.h
@@ -33,7 +33,7 @@ class CPDF_Path {
CFX_FloatRect GetBoundingBox() const;
CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const;
- FX_BOOL IsRect() const;
+ bool IsRect() const;
void Transform(const CFX_Matrix* pMatrix);
void Append(const CPDF_Path& other, const CFX_Matrix* pMatrix);
diff --git a/core/fpdfapi/page/cpdf_pathobject.h b/core/fpdfapi/page/cpdf_pathobject.h
index 65578a1bab..d5ce5c0d02 100644
--- a/core/fpdfapi/page/cpdf_pathobject.h
+++ b/core/fpdfapi/page/cpdf_pathobject.h
@@ -29,7 +29,7 @@ class CPDF_PathObject : public CPDF_PageObject {
CPDF_Path m_Path;
int m_FillType;
- FX_BOOL m_bStroke;
+ bool m_bStroke;
CFX_Matrix m_Matrix;
};
diff --git a/core/fpdfapi/page/cpdf_psengine.h b/core/fpdfapi/page/cpdf_psengine.h
index d3eec6629c..9bdaa67464 100644
--- a/core/fpdfapi/page/cpdf_psengine.h
+++ b/core/fpdfapi/page/cpdf_psengine.h
@@ -70,8 +70,8 @@ class CPDF_PSProc {
CPDF_PSProc();
~CPDF_PSProc();
- FX_BOOL Parse(CPDF_SimpleParser* parser, int depth);
- FX_BOOL Execute(CPDF_PSEngine* pEngine);
+ bool Parse(CPDF_SimpleParser* parser, int depth);
+ bool Execute(CPDF_PSEngine* pEngine);
private:
static const int kMaxDepth = 128;
@@ -83,9 +83,9 @@ class CPDF_PSEngine {
CPDF_PSEngine();
~CPDF_PSEngine();
- FX_BOOL Parse(const FX_CHAR* str, int size);
- FX_BOOL Execute();
- FX_BOOL DoOperator(PDF_PSOP op);
+ bool Parse(const FX_CHAR* str, int size);
+ bool Execute();
+ bool DoOperator(PDF_PSOP op);
void Reset() { m_StackCount = 0; }
void Push(FX_FLOAT value);
void Push(int value) { Push((FX_FLOAT)value); }
diff --git a/core/fpdfapi/page/cpdf_shadingpattern.cpp b/core/fpdfapi/page/cpdf_shadingpattern.cpp
index d2736870e1..3b0b439a31 100644
--- a/core/fpdfapi/page/cpdf_shadingpattern.cpp
+++ b/core/fpdfapi/page/cpdf_shadingpattern.cpp
@@ -62,12 +62,12 @@ CPDF_ShadingPattern* CPDF_ShadingPattern::AsShadingPattern() {
bool CPDF_ShadingPattern::Load() {
if (m_ShadingType != kInvalidShading)
- return TRUE;
+ return true;
CPDF_Dictionary* pShadingDict =
m_pShadingObj ? m_pShadingObj->GetDict() : nullptr;
if (!pShadingDict)
- return FALSE;
+ return false;
m_pFunctions.clear();
CPDF_Object* pFunc = pShadingDict->GetDirectObjectFor("Function");
@@ -82,7 +82,7 @@ bool CPDF_ShadingPattern::Load() {
}
CPDF_Object* pCSObj = pShadingDict->GetDirectObjectFor("ColorSpace");
if (!pCSObj)
- return FALSE;
+ return false;
CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData();
m_pCS = pDocPageData->GetColorSpace(pCSObj, nullptr);
@@ -93,7 +93,7 @@ bool CPDF_ShadingPattern::Load() {
// We expect to have a stream if our shading type is a mesh.
if (IsMeshShading() && !ToStream(m_pShadingObj))
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 4ad763e3b2..ed6701382c 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -285,7 +285,7 @@ CPDF_Object* CPDF_StreamContentParser::GetObject(uint32_t index) {
if (param.m_Type == ContentParam::OBJECT) {
return param.m_pObject;
}
- ASSERT(FALSE);
+ ASSERT(false);
return nullptr;
}
@@ -587,7 +587,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() {
}
void CPDF_StreamContentParser::Handle_BeginMarkedContent() {
- m_CurContentMark.AddMark(GetString(0), nullptr, FALSE);
+ m_CurContentMark.AddMark(GetString(0), nullptr, false);
}
void CPDF_StreamContentParser::Handle_BeginText() {
@@ -697,7 +697,7 @@ void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) {
pFormObj->m_pForm->ParseContent(&status, nullptr, nullptr, m_Level + 1);
if (!m_pObjectHolder->BackgroundAlphaNeeded() &&
pFormObj->m_pForm->BackgroundAlphaNeeded()) {
- m_pObjectHolder->SetBackgroundAlphaNeeded(TRUE);
+ m_pObjectHolder->SetBackgroundAlphaNeeded(true);
}
pFormObj->CalcBoundingBox();
SetGraphicStates(pFormObj.get(), true, true, true);
@@ -1410,7 +1410,7 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, bool bStroke) {
if (PathPointCount && PathClipType) {
CPDF_Path path;
path.AppendRect(0, 0, 0, 0);
- m_pCurStates->m_ClipPath.AppendPath(path, FXFILL_WINDING, TRUE);
+ m_pCurStates->m_ClipPath.AppendPath(path, FXFILL_WINDING, true);
}
return;
}
@@ -1439,7 +1439,7 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, bool bStroke) {
Path.Transform(&matrix);
matrix.SetIdentity();
}
- m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, TRUE);
+ m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, true);
}
}
@@ -1484,7 +1484,7 @@ void CPDF_StreamContentParser::ParsePathObject() {
int last_pos = m_pSyntax->GetPos();
while (1) {
CPDF_StreamParser::SyntaxType type = m_pSyntax->ParseNextElement();
- FX_BOOL bProcessed = TRUE;
+ bool bProcessed = true;
switch (type) {
case CPDF_StreamParser::EndOfData:
return;
@@ -1523,7 +1523,7 @@ void CPDF_StreamContentParser::ParsePathObject() {
nParams = 0;
break;
default:
- bProcessed = FALSE;
+ bProcessed = false;
break;
}
} else if (len == 2) {
@@ -1532,10 +1532,10 @@ void CPDF_StreamContentParser::ParsePathObject() {
AddPathRect(params[0], params[1], params[2], params[3]);
nParams = 0;
} else {
- bProcessed = FALSE;
+ bProcessed = false;
}
} else {
- bProcessed = FALSE;
+ bProcessed = false;
}
if (bProcessed) {
last_pos = m_pSyntax->GetPos();
@@ -1554,7 +1554,7 @@ void CPDF_StreamContentParser::ParsePathObject() {
break;
}
default:
- bProcessed = FALSE;
+ bProcessed = false;
}
if (!bProcessed) {
m_pSyntax->SetPos(last_pos);
diff --git a/core/fpdfapi/page/cpdf_textobject.cpp b/core/fpdfapi/page/cpdf_textobject.cpp
index 0b44522835..d5a2ea6d29 100644
--- a/core/fpdfapi/page/cpdf_textobject.cpp
+++ b/core/fpdfapi/page/cpdf_textobject.cpp
@@ -211,7 +211,7 @@ void CPDF_TextObject::SetText(const CFX_ByteString& str) {
FX_FLOAT CPDF_TextObject::GetCharWidth(uint32_t charcode) const {
FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000;
CPDF_Font* pFont = m_TextState.GetFont();
- FX_BOOL bVertWriting = FALSE;
+ bool bVertWriting = false;
CPDF_CIDFont* pCIDFont = pFont->AsCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
@@ -248,7 +248,7 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX,
FX_FLOAT min_y = 10000 * 1.0f;
FX_FLOAT max_y = -10000 * 1.0f;
CPDF_Font* pFont = m_TextState.GetFont();
- FX_BOOL bVertWriting = FALSE;
+ bool bVertWriting = false;
CPDF_CIDFont* pCIDFont = pFont->AsCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
diff --git a/core/fpdfapi/page/cpdf_tilingpattern.cpp b/core/fpdfapi/page/cpdf_tilingpattern.cpp
index eb51fbac63..1b7bee4366 100644
--- a/core/fpdfapi/page/cpdf_tilingpattern.cpp
+++ b/core/fpdfapi/page/cpdf_tilingpattern.cpp
@@ -31,13 +31,13 @@ CPDF_ShadingPattern* CPDF_TilingPattern::AsShadingPattern() {
return nullptr;
}
-FX_BOOL CPDF_TilingPattern::Load() {
+bool CPDF_TilingPattern::Load() {
if (m_pForm)
- return TRUE;
+ return true;
CPDF_Dictionary* pDict = m_pPatternObj->GetDict();
if (!pDict)
- return FALSE;
+ return false;
m_bColored = pDict->GetIntegerFor("PaintType") == 1;
m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberFor("XStep"));
@@ -45,10 +45,10 @@ FX_BOOL CPDF_TilingPattern::Load() {
CPDF_Stream* pStream = m_pPatternObj->AsStream();
if (!pStream)
- return FALSE;
+ return false;
m_pForm.reset(new CPDF_Form(m_pDocument, nullptr, pStream));
m_pForm->ParseContent(nullptr, &m_ParentMatrix, nullptr);
m_BBox = pDict->GetRectFor("BBox");
- return TRUE;
+ return true;
}
diff --git a/core/fpdfapi/page/cpdf_tilingpattern.h b/core/fpdfapi/page/cpdf_tilingpattern.h
index 3c9ffb206d..3f0851aa7e 100644
--- a/core/fpdfapi/page/cpdf_tilingpattern.h
+++ b/core/fpdfapi/page/cpdf_tilingpattern.h
@@ -27,7 +27,7 @@ class CPDF_TilingPattern : public CPDF_Pattern {
CPDF_TilingPattern* AsTilingPattern() override;
CPDF_ShadingPattern* AsShadingPattern() override;
- FX_BOOL Load();
+ bool Load();
bool colored() const { return m_bColored; }
const CFX_FloatRect& bbox() const { return m_BBox; }
diff --git a/core/fpdfapi/page/fpdf_page_colors.cpp b/core/fpdfapi/page/fpdf_page_colors.cpp
index e42b695c6c..3ee5328dbc 100644
--- a/core/fpdfapi/page/fpdf_page_colors.cpp
+++ b/core/fpdfapi/page/fpdf_page_colors.cpp
@@ -71,10 +71,10 @@ void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels) {
CPDF_DeviceCS::CPDF_DeviceCS(CPDF_Document* pDoc, int family)
: CPDF_ColorSpace(pDoc, family, ComponentsForFamily(family)) {}
-FX_BOOL CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
+bool CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const {
if (m_Family == PDFCS_DEVICERGB) {
R = pBuf[0];
if (R < 0) {
@@ -114,64 +114,64 @@ FX_BOOL CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf,
} else {
ASSERT(m_Family == PDFCS_PATTERN);
R = G = B = 0;
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DeviceCS::v_GetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) const {
+bool CPDF_DeviceCS::v_GetCMYK(FX_FLOAT* pBuf,
+ FX_FLOAT& c,
+ FX_FLOAT& m,
+ FX_FLOAT& y,
+ FX_FLOAT& k) const {
if (m_Family != PDFCS_DEVICECMYK) {
- return FALSE;
+ return false;
}
c = pBuf[0];
m = pBuf[1];
y = pBuf[2];
k = pBuf[3];
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DeviceCS::SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const {
+bool CPDF_DeviceCS::SetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT R,
+ FX_FLOAT G,
+ FX_FLOAT B) const {
if (m_Family == PDFCS_DEVICERGB) {
pBuf[0] = R;
pBuf[1] = G;
pBuf[2] = B;
- return TRUE;
+ return true;
}
if (m_Family == PDFCS_DEVICEGRAY) {
if (R == G && R == B) {
*pBuf = R;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
if (m_Family == PDFCS_DEVICECMYK) {
sRGB_to_AdobeCMYK(R, G, B, pBuf[0], pBuf[1], pBuf[2], pBuf[3]);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_DeviceCS::v_SetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT c,
- FX_FLOAT m,
- FX_FLOAT y,
- FX_FLOAT k) const {
+bool CPDF_DeviceCS::v_SetCMYK(FX_FLOAT* pBuf,
+ FX_FLOAT c,
+ FX_FLOAT m,
+ FX_FLOAT y,
+ FX_FLOAT k) const {
if (m_Family == PDFCS_DEVICERGB) {
AdobeCMYK_to_sRGB(c, m, y, k, pBuf[0], pBuf[1], pBuf[2]);
- return TRUE;
+ return true;
}
if (m_Family == PDFCS_DEVICECMYK) {
pBuf[0] = c;
pBuf[1] = m;
pBuf[2] = y;
pBuf[3] = k;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf,
@@ -179,7 +179,7 @@ void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf,
int pixels,
int image_width,
int image_height,
- FX_BOOL bTransMask) const {
+ bool bTransMask) const {
if (bTransMask && m_Family == PDFCS_DEVICECMYK) {
for (int i = 0; i < pixels; i++) {
int k = 255 - pSrcBuf[3];
@@ -217,10 +217,10 @@ void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf,
}
CPDF_IccProfile::CPDF_IccProfile(const uint8_t* pData, uint32_t dwSize)
- : m_bsRGB(FALSE), m_pTransform(nullptr), m_nSrcComponents(0) {
+ : m_bsRGB(false), m_pTransform(nullptr), m_nSrcComponents(0) {
if (dwSize == 3144 &&
FXSYS_memcmp(pData + 0x190, "sRGB IEC61966-2.1", 17) == 0) {
- m_bsRGB = TRUE;
+ m_bsRGB = true;
m_nSrcComponents = 3;
} else if (CPDF_ModuleMgr::Get()->GetIccModule()) {
m_pTransform = CPDF_ModuleMgr::Get()->GetIccModule()->CreateTransform_sRGB(
diff --git a/core/fpdfapi/page/fpdf_page_func.cpp b/core/fpdfapi/page/fpdf_page_func.cpp
index df658844cd..a6c73b0e5f 100644
--- a/core/fpdfapi/page/fpdf_page_func.cpp
+++ b/core/fpdfapi/page/fpdf_page_func.cpp
@@ -84,31 +84,31 @@ class CPDF_PSFunc : public CPDF_Function {
~CPDF_PSFunc() override {}
// CPDF_Function
- FX_BOOL v_Init(CPDF_Object* pObj) override;
- FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
+ bool v_Init(CPDF_Object* pObj) override;
+ bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
private:
CPDF_PSEngine m_PS;
};
-FX_BOOL CPDF_PSFunc::v_Init(CPDF_Object* pObj) {
+bool CPDF_PSFunc::v_Init(CPDF_Object* pObj) {
CPDF_StreamAcc acc;
- acc.LoadAllData(pObj->AsStream(), FALSE);
+ acc.LoadAllData(pObj->AsStream(), false);
return m_PS.Parse(reinterpret_cast<const FX_CHAR*>(acc.GetData()),
acc.GetSize());
}
-FX_BOOL CPDF_PSFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
+bool CPDF_PSFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
CPDF_PSEngine& PS = const_cast<CPDF_PSEngine&>(m_PS);
PS.Reset();
for (uint32_t i = 0; i < m_nInputs; i++)
PS.Push(inputs[i]);
PS.Execute();
if (PS.GetStackSize() < m_nOutputs)
- return FALSE;
+ return false;
for (uint32_t i = 0; i < m_nOutputs; i++)
results[m_nOutputs - i - 1] = PS.Pop();
- return TRUE;
+ return true;
}
} // namespace
@@ -145,14 +145,14 @@ class CPDF_PSOP {
std::unique_ptr<CPDF_PSProc> m_proc;
};
-FX_BOOL CPDF_PSEngine::Execute() {
+bool CPDF_PSEngine::Execute() {
return m_MainProc.Execute(this);
}
CPDF_PSProc::CPDF_PSProc() {}
CPDF_PSProc::~CPDF_PSProc() {}
-FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine) {
+bool CPDF_PSProc::Execute(CPDF_PSEngine* pEngine) {
for (size_t i = 0; i < m_Operators.size(); ++i) {
const PDF_PSOP op = m_Operators[i]->GetOp();
if (op == PSOP_PROC)
@@ -165,14 +165,14 @@ FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine) {
if (op == PSOP_IF) {
if (i == 0 || m_Operators[i - 1]->GetOp() != PSOP_PROC)
- return FALSE;
+ return false;
if (static_cast<int>(pEngine->Pop()))
m_Operators[i - 1]->GetProc()->Execute(pEngine);
} else if (op == PSOP_IFELSE) {
if (i < 2 || m_Operators[i - 1]->GetOp() != PSOP_PROC ||
m_Operators[i - 2]->GetOp() != PSOP_PROC) {
- return FALSE;
+ return false;
}
size_t offset = static_cast<int>(pEngine->Pop()) ? 2 : 1;
m_Operators[i - offset]->GetProc()->Execute(pEngine);
@@ -180,7 +180,7 @@ FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine) {
pEngine->DoOperator(op);
}
}
- return TRUE;
+ return true;
}
CPDF_PSEngine::CPDF_PSEngine() {
@@ -199,33 +199,33 @@ FX_FLOAT CPDF_PSEngine::Pop() {
}
return m_Stack[--m_StackCount];
}
-FX_BOOL CPDF_PSEngine::Parse(const FX_CHAR* str, int size) {
+bool CPDF_PSEngine::Parse(const FX_CHAR* str, int size) {
CPDF_SimpleParser parser((uint8_t*)str, size);
CFX_ByteStringC word = parser.GetWord();
if (word != "{") {
- return FALSE;
+ return false;
}
return m_MainProc.Parse(&parser, 0);
}
-FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser* parser, int depth) {
+bool CPDF_PSProc::Parse(CPDF_SimpleParser* parser, int depth) {
if (depth > kMaxDepth)
- return FALSE;
+ return false;
while (1) {
CFX_ByteStringC word = parser->GetWord();
if (word.IsEmpty()) {
- return FALSE;
+ return false;
}
if (word == "}") {
- return TRUE;
+ return true;
}
if (word == "{") {
std::unique_ptr<CPDF_PSProc> proc(new CPDF_PSProc);
std::unique_ptr<CPDF_PSOP> op(new CPDF_PSOP(std::move(proc)));
m_Operators.push_back(std::move(op));
if (!m_Operators.back()->GetProc()->Parse(parser, depth + 1)) {
- return FALSE;
+ return false;
}
} else {
bool found = false;
@@ -245,7 +245,7 @@ FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser* parser, int depth) {
}
}
-FX_BOOL CPDF_PSEngine::DoOperator(PDF_PSOP op) {
+bool CPDF_PSEngine::DoOperator(PDF_PSOP op) {
int i1;
int i2;
FX_FLOAT d1;
@@ -474,14 +474,14 @@ FX_BOOL CPDF_PSEngine::DoOperator(PDF_PSOP op) {
default:
break;
}
- return TRUE;
+ return true;
}
CPDF_SampledFunc::CPDF_SampledFunc() : CPDF_Function(Type::kType0Sampled) {}
CPDF_SampledFunc::~CPDF_SampledFunc() {}
-FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
+bool CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
CPDF_Stream* pStream = pObj->AsStream();
if (!pStream)
return false;
@@ -492,11 +492,11 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
CPDF_Array* pDecode = pDict->GetArrayFor("Decode");
m_nBitsPerSample = pDict->GetIntegerFor("BitsPerSample");
if (!IsValidBitsPerSample(m_nBitsPerSample))
- return FALSE;
+ return false;
m_SampleMax = 0xffffffff >> (32 - m_nBitsPerSample);
m_pSampleStream.reset(new CPDF_StreamAcc);
- m_pSampleStream->LoadAllData(pStream, FALSE);
+ m_pSampleStream->LoadAllData(pStream, false);
FX_SAFE_UINT32 nTotalSampleBits = 1;
m_EncodeInfo.resize(m_nInputs);
for (uint32_t i = 0; i < m_nInputs; i++) {
@@ -520,7 +520,7 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
nTotalSampleBytes /= 8;
if (!nTotalSampleBytes.IsValid() || nTotalSampleBytes.ValueOrDie() == 0 ||
nTotalSampleBytes.ValueOrDie() > m_pSampleStream->GetSize()) {
- return FALSE;
+ return false;
}
m_DecodeInfo.resize(m_nOutputs);
for (uint32_t i = 0; i < m_nOutputs; i++) {
@@ -532,10 +532,10 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
m_DecodeInfo[i].decode_max = m_pRanges[i * 2 + 1];
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
+bool CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
int pos = 0;
CFX_FixedBufGrow<FX_FLOAT, 16> encoded_input_buf(m_nInputs);
FX_FLOAT* encoded_input = encoded_input_buf;
@@ -557,21 +557,21 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
FX_SAFE_INT32 bits_to_output = m_nOutputs;
bits_to_output *= m_nBitsPerSample;
if (!bits_to_output.IsValid())
- return FALSE;
+ return false;
FX_SAFE_INT32 bitpos = pos;
bitpos *= bits_to_output.ValueOrDie();
if (!bitpos.IsValid())
- return FALSE;
+ return false;
FX_SAFE_INT32 range_check = bitpos;
range_check += bits_to_output.ValueOrDie();
if (!range_check.IsValid())
- return FALSE;
+ return false;
const uint8_t* pSampleData = m_pSampleStream->GetData();
if (!pSampleData)
- return FALSE;
+ return false;
for (uint32_t j = 0; j < m_nOutputs; j++) {
uint32_t sample =
@@ -589,7 +589,7 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
bitpos2 += j;
bitpos2 *= m_nBitsPerSample;
if (!bitpos2.IsValid())
- return FALSE;
+ return false;
uint32_t sample1 =
GetBits32(pSampleData, bitpos2.ValueOrDie(), m_nBitsPerSample);
encoded += (encoded_input[i] - index[i]) *
@@ -600,7 +600,7 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
PDF_Interpolate(encoded, 0, (FX_FLOAT)m_SampleMax,
m_DecodeInfo[j].decode_min, m_DecodeInfo[j].decode_max);
}
- return TRUE;
+ return true;
}
CPDF_ExpIntFunc::CPDF_ExpIntFunc()
@@ -612,10 +612,10 @@ CPDF_ExpIntFunc::~CPDF_ExpIntFunc() {
FX_Free(m_pBeginValues);
FX_Free(m_pEndValues);
}
-FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) {
+bool CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) {
CPDF_Dictionary* pDict = pObj->GetDict();
if (!pDict) {
- return FALSE;
+ return false;
}
CPDF_Array* pArray0 = pDict->GetArrayFor("C0");
if (m_nOutputs == 0) {
@@ -634,12 +634,12 @@ FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) {
m_Exponent = pDict->GetFloatFor("N");
m_nOrigOutputs = m_nOutputs;
if (m_nOutputs && m_nInputs > INT_MAX / m_nOutputs) {
- return FALSE;
+ return false;
}
m_nOutputs *= m_nInputs;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_ExpIntFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
+bool CPDF_ExpIntFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
for (uint32_t i = 0; i < m_nInputs; i++)
for (uint32_t j = 0; j < m_nOrigOutputs; j++) {
results[i * m_nOrigOutputs + j] =
@@ -647,7 +647,7 @@ FX_BOOL CPDF_ExpIntFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
(FX_FLOAT)FXSYS_pow(inputs[i], m_Exponent) *
(m_pEndValues[j] - m_pBeginValues[j]);
}
- return TRUE;
+ return true;
}
CPDF_StitchFunc::CPDF_StitchFunc()
@@ -660,36 +660,36 @@ CPDF_StitchFunc::~CPDF_StitchFunc() {
FX_Free(m_pEncode);
}
-FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
+bool CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
CPDF_Dictionary* pDict = pObj->GetDict();
if (!pDict) {
- return FALSE;
+ return false;
}
if (m_nInputs != kRequiredNumInputs) {
- return FALSE;
+ return false;
}
CPDF_Array* pArray = pDict->GetArrayFor("Functions");
if (!pArray) {
- return FALSE;
+ return false;
}
uint32_t nSubs = pArray->GetCount();
if (nSubs == 0)
- return FALSE;
+ return false;
m_nOutputs = 0;
for (uint32_t i = 0; i < nSubs; i++) {
CPDF_Object* pSub = pArray->GetDirectObjectAt(i);
if (pSub == pObj)
- return FALSE;
+ return false;
std::unique_ptr<CPDF_Function> pFunc(CPDF_Function::Load(pSub));
if (!pFunc)
- return FALSE;
+ return false;
// Check that the input dimensionality is 1, and that all output
// dimensionalities are the same.
if (pFunc->CountInputs() != kRequiredNumInputs)
- return FALSE;
+ return false;
if (pFunc->CountOutputs() != m_nOutputs) {
if (m_nOutputs)
- return FALSE;
+ return false;
m_nOutputs = pFunc->CountOutputs();
}
@@ -700,21 +700,21 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
m_pBounds[0] = m_pDomains[0];
pArray = pDict->GetArrayFor("Bounds");
if (!pArray)
- return FALSE;
+ return false;
for (uint32_t i = 0; i < nSubs - 1; i++)
m_pBounds[i + 1] = pArray->GetFloatAt(i);
m_pBounds[nSubs] = m_pDomains[1];
m_pEncode = FX_Alloc2D(FX_FLOAT, nSubs, 2);
pArray = pDict->GetArrayFor("Encode");
if (!pArray)
- return FALSE;
+ return false;
for (uint32_t i = 0; i < nSubs * 2; i++)
m_pEncode[i] = pArray->GetFloatAt(i);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const {
+bool CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const {
FX_FLOAT input = inputs[0];
size_t i;
for (i = 0; i < m_pSubFunctions.size() - 1; i++) {
@@ -725,7 +725,7 @@ FX_BOOL CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const {
m_pEncode[i * 2], m_pEncode[i * 2 + 1]);
int nresults;
m_pSubFunctions[i]->Call(&input, kRequiredNumInputs, outputs, nresults);
- return TRUE;
+ return true;
}
// static
@@ -777,17 +777,17 @@ CPDF_Function::~CPDF_Function() {
FX_Free(m_pRanges);
}
-FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) {
+bool CPDF_Function::Init(CPDF_Object* pObj) {
CPDF_Stream* pStream = pObj->AsStream();
CPDF_Dictionary* pDict = pStream ? pStream->GetDict() : pObj->AsDictionary();
CPDF_Array* pDomains = pDict->GetArrayFor("Domain");
if (!pDomains)
- return FALSE;
+ return false;
m_nInputs = pDomains->GetCount() / 2;
if (m_nInputs == 0)
- return FALSE;
+ return false;
m_pDomains = FX_Alloc2D(FX_FLOAT, m_nInputs, 2);
for (uint32_t i = 0; i < m_nInputs * 2; i++) {
@@ -803,7 +803,7 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) {
}
uint32_t old_outputs = m_nOutputs;
if (!v_Init(pObj))
- return FALSE;
+ return false;
if (m_pRanges && m_nOutputs > old_outputs) {
m_pRanges = FX_Realloc(FX_FLOAT, m_pRanges, m_nOutputs * 2);
if (m_pRanges) {
@@ -811,15 +811,15 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) {
sizeof(FX_FLOAT) * (m_nOutputs - old_outputs) * 2);
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_Function::Call(FX_FLOAT* inputs,
- uint32_t ninputs,
- FX_FLOAT* results,
- int& nresults) const {
+bool CPDF_Function::Call(FX_FLOAT* inputs,
+ uint32_t ninputs,
+ FX_FLOAT* results,
+ int& nresults) const {
if (m_nInputs != ninputs) {
- return FALSE;
+ return false;
}
nresults = m_nOutputs;
for (uint32_t i = 0; i < m_nInputs; i++) {
@@ -837,7 +837,7 @@ FX_BOOL CPDF_Function::Call(FX_FLOAT* inputs,
results[i] = m_pRanges[i * 2 + 1];
}
}
- return TRUE;
+ return true;
}
const CPDF_SampledFunc* CPDF_Function::ToSampledFunc() const {
diff --git a/core/fpdfapi/page/fpdf_page_parser_old.cpp b/core/fpdfapi/page/fpdf_page_parser_old.cpp
index ccee12dd03..0d1db43825 100644
--- a/core/fpdfapi/page/fpdf_page_parser_old.cpp
+++ b/core/fpdfapi/page/fpdf_page_parser_old.cpp
@@ -96,11 +96,11 @@ uint32_t PDF_DecodeInlineStream(const uint8_t* src_buf,
return HexDecode(src_buf, limit, dest_buf, dest_size);
}
if (decoder == "FlateDecode" || decoder == "Fl") {
- return FPDFAPI_FlateOrLZWDecode(FALSE, src_buf, limit, pParam, dest_size,
+ return FPDFAPI_FlateOrLZWDecode(false, src_buf, limit, pParam, dest_size,
dest_buf, dest_size);
}
if (decoder == "LZWDecode" || decoder == "LZW") {
- return FPDFAPI_FlateOrLZWDecode(TRUE, src_buf, limit, pParam, 0, dest_buf,
+ return FPDFAPI_FlateOrLZWDecode(true, src_buf, limit, pParam, 0, dest_buf,
dest_size);
}
if (decoder == "DCTDecode" || decoder == "DCT") {
@@ -317,7 +317,7 @@ CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement() {
if (m_WordSize == 4) {
if (memcmp(m_WordBuffer, "true", 4) == 0) {
- m_pLastObj = new CPDF_Boolean(TRUE);
+ m_pLastObj = new CPDF_Boolean(true);
return Others;
}
if (memcmp(m_WordBuffer, "null", 4) == 0) {
@@ -326,7 +326,7 @@ CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement() {
}
} else if (m_WordSize == 5) {
if (memcmp(m_WordBuffer, "false", 5) == 0) {
- m_pLastObj = new CPDF_Boolean(FALSE);
+ m_pLastObj = new CPDF_Boolean(false);
return Others;
}
}
@@ -360,12 +360,12 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(bool bAllowNestedArray,
if (first_char == '(') {
CFX_ByteString str = ReadString();
- return new CPDF_String(m_pPool ? m_pPool->Intern(str) : str, FALSE);
+ return new CPDF_String(m_pPool ? m_pPool->Intern(str) : str, false);
}
if (first_char == '<') {
if (m_WordSize == 1)
- return new CPDF_String(ReadHexString(), TRUE);
+ return new CPDF_String(ReadHexString(), true);
CPDF_Dictionary* pDict = new CPDF_Dictionary(m_pPool);
while (1) {
@@ -415,11 +415,11 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(bool bAllowNestedArray,
}
if (m_WordSize == 5 && !memcmp(m_WordBuffer, "false", 5))
- return new CPDF_Boolean(FALSE);
+ return new CPDF_Boolean(false);
if (m_WordSize == 4) {
if (memcmp(m_WordBuffer, "true", 4) == 0)
- return new CPDF_Boolean(TRUE);
+ return new CPDF_Boolean(true);
if (memcmp(m_WordBuffer, "null", 4) == 0)
return new CPDF_Null;
@@ -679,7 +679,7 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage) {
if (CPDF_Stream* pStream = pContent->AsStream()) {
m_nStreams = 0;
m_pSingleStream.reset(new CPDF_StreamAcc);
- m_pSingleStream->LoadAllData(pStream, FALSE);
+ m_pSingleStream->LoadAllData(pStream, false);
} else if (CPDF_Array* pArray = pContent->AsArray()) {
m_nStreams = pArray->GetCount();
if (m_nStreams)
@@ -728,7 +728,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm,
m_pParser->GetCurStates()->m_ParentMatrix = form_matrix;
if (ClipPath) {
m_pParser->GetCurStates()->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING,
- TRUE);
+ true);
}
if (pForm->m_Transparency & PDFTRANS_GROUP) {
CPDF_GeneralState* pState = &m_pParser->GetCurStates()->m_GeneralState;
@@ -739,7 +739,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm,
}
m_nStreams = 0;
m_pSingleStream.reset(new CPDF_StreamAcc);
- m_pSingleStream->LoadAllData(pForm->m_pFormStream, FALSE);
+ m_pSingleStream->LoadAllData(pForm->m_pFormStream, false);
m_pData = (uint8_t*)m_pSingleStream->GetData();
m_Size = m_pSingleStream->GetSize();
m_Status = ToBeContinued;
@@ -783,7 +783,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) {
m_StreamArray[m_CurrentOffset].reset(new CPDF_StreamAcc);
CPDF_Stream* pStreamObj = ToStream(
pContent ? pContent->GetDirectObjectAt(m_CurrentOffset) : nullptr);
- m_StreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, FALSE);
+ m_StreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, false);
m_CurrentOffset++;
}
}
diff --git a/core/fpdfapi/page/pageint.h b/core/fpdfapi/page/pageint.h
index d70ecf1a6e..a96216bbb6 100644
--- a/core/fpdfapi/page/pageint.h
+++ b/core/fpdfapi/page/pageint.h
@@ -133,10 +133,10 @@ class CPDF_Function {
static Type IntegerToFunctionType(int iType);
virtual ~CPDF_Function();
- FX_BOOL Call(FX_FLOAT* inputs,
- uint32_t ninputs,
- FX_FLOAT* results,
- int& nresults) const;
+ bool Call(FX_FLOAT* inputs,
+ uint32_t ninputs,
+ FX_FLOAT* results,
+ int& nresults) const;
uint32_t CountInputs() const { return m_nInputs; }
uint32_t CountOutputs() const { return m_nOutputs; }
FX_FLOAT GetDomain(int i) const { return m_pDomains[i]; }
@@ -149,9 +149,9 @@ class CPDF_Function {
protected:
explicit CPDF_Function(Type type);
- FX_BOOL Init(CPDF_Object* pObj);
- virtual FX_BOOL v_Init(CPDF_Object* pObj) = 0;
- virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0;
+ bool Init(CPDF_Object* pObj);
+ virtual bool v_Init(CPDF_Object* pObj) = 0;
+ virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0;
uint32_t m_nInputs;
uint32_t m_nOutputs;
@@ -166,8 +166,8 @@ class CPDF_ExpIntFunc : public CPDF_Function {
~CPDF_ExpIntFunc() override;
// CPDF_Function
- FX_BOOL v_Init(CPDF_Object* pObj) override;
- FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
+ bool v_Init(CPDF_Object* pObj) override;
+ bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
uint32_t m_nOrigOutputs;
FX_FLOAT m_Exponent;
@@ -192,8 +192,8 @@ class CPDF_SampledFunc : public CPDF_Function {
~CPDF_SampledFunc() override;
// CPDF_Function
- FX_BOOL v_Init(CPDF_Object* pObj) override;
- FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
+ bool v_Init(CPDF_Object* pObj) override;
+ bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
const std::vector<SampleEncodeInfo>& GetEncodeInfo() const {
return m_EncodeInfo;
@@ -217,8 +217,8 @@ class CPDF_StitchFunc : public CPDF_Function {
~CPDF_StitchFunc() override;
// CPDF_Function
- FX_BOOL v_Init(CPDF_Object* pObj) override;
- FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
+ bool v_Init(CPDF_Object* pObj) override;
+ bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
const std::vector<std::unique_ptr<CPDF_Function>>& GetSubFunctions() const {
return m_pSubFunctions;
@@ -249,41 +249,41 @@ class CPDF_DeviceCS : public CPDF_ColorSpace {
public:
CPDF_DeviceCS(CPDF_Document* pDoc, int family);
- FX_BOOL GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
- FX_BOOL SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const override;
- FX_BOOL v_GetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) const override;
- FX_BOOL v_SetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT c,
- FX_FLOAT m,
- FX_FLOAT y,
- FX_FLOAT k) const override;
+ bool GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const override;
+ bool SetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT R,
+ FX_FLOAT G,
+ FX_FLOAT B) const override;
+ bool v_GetCMYK(FX_FLOAT* pBuf,
+ FX_FLOAT& c,
+ FX_FLOAT& m,
+ FX_FLOAT& y,
+ FX_FLOAT& k) const override;
+ bool v_SetCMYK(FX_FLOAT* pBuf,
+ FX_FLOAT c,
+ FX_FLOAT m,
+ FX_FLOAT y,
+ FX_FLOAT k) const override;
void TranslateImageLine(uint8_t* pDestBuf,
const uint8_t* pSrcBuf,
int pixels,
int image_width,
int image_height,
- FX_BOOL bTransMask = FALSE) const override;
+ bool bTransMask = false) const override;
};
class CPDF_PatternCS : public CPDF_ColorSpace {
public:
explicit CPDF_PatternCS(CPDF_Document* pDoc);
~CPDF_PatternCS() override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
+ bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
+ bool GetRGB(FX_FLOAT* pBuf,
+ FX_FLOAT& R,
+ FX_FLOAT& G,
+ FX_FLOAT& B) const override;
CPDF_ColorSpace* GetBaseCS() const override;
private:
diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp
index 3bafdda9f2..d39ec31d3c 100644
--- a/core/fpdfapi/parser/cfdf_document.cpp
+++ b/core/fpdfapi/parser/cfdf_document.cpp
@@ -15,7 +15,7 @@ CFDF_Document::CFDF_Document()
: CPDF_IndirectObjectHolder(),
m_pRootDict(nullptr),
m_pFile(nullptr),
- m_bOwnFile(FALSE),
+ m_bOwnFile(false),
m_pByteStringPool(pdfium::MakeUnique<CFX_ByteStringPool>()) {}
CFDF_Document::~CFDF_Document() {
@@ -34,7 +34,7 @@ CFDF_Document* CFDF_Document::CreateNewDoc() {
}
CFDF_Document* CFDF_Document::ParseFile(IFX_SeekableReadStream* pFile,
- FX_BOOL bOwnFile) {
+ bool bOwnFile) {
if (!pFile)
return nullptr;
@@ -45,11 +45,10 @@ CFDF_Document* CFDF_Document::ParseFile(IFX_SeekableReadStream* pFile,
CFDF_Document* CFDF_Document::ParseMemory(const uint8_t* pData, uint32_t size) {
return CFDF_Document::ParseFile(FX_CreateMemoryStream((uint8_t*)pData, size),
- TRUE);
+ true);
}
-void CFDF_Document::ParseStream(IFX_SeekableReadStream* pFile,
- FX_BOOL bOwnFile) {
+void CFDF_Document::ParseStream(IFX_SeekableReadStream* pFile, bool bOwnFile) {
m_pFile = pFile;
m_bOwnFile = bOwnFile;
CPDF_SyntaxParser parser;
@@ -89,9 +88,9 @@ void CFDF_Document::ParseStream(IFX_SeekableReadStream* pFile,
}
}
-FX_BOOL CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const {
+bool CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const {
if (!m_pRootDict)
- return FALSE;
+ return false;
buf << "%FDF-1.2\r\n";
for (const auto& pair : *this)
@@ -100,5 +99,5 @@ FX_BOOL CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const {
buf << "trailer\r\n<</Root " << m_pRootDict->GetObjNum()
<< " 0 R>>\r\n%%EOF\r\n";
- return TRUE;
+ return true;
}
diff --git a/core/fpdfapi/parser/cfdf_document.h b/core/fpdfapi/parser/cfdf_document.h
index 32d0aab422..181c4697e2 100644
--- a/core/fpdfapi/parser/cfdf_document.h
+++ b/core/fpdfapi/parser/cfdf_document.h
@@ -19,11 +19,11 @@ class CFDF_Document : public CPDF_IndirectObjectHolder {
public:
static CFDF_Document* CreateNewDoc();
static CFDF_Document* ParseFile(IFX_SeekableReadStream* pFile,
- FX_BOOL bOwnFile = FALSE);
+ bool bOwnFile = false);
static CFDF_Document* ParseMemory(const uint8_t* pData, uint32_t size);
~CFDF_Document() override;
- FX_BOOL WriteBuf(CFX_ByteTextBuf& buf) const;
+ bool WriteBuf(CFX_ByteTextBuf& buf) const;
CPDF_Dictionary* GetRoot() const { return m_pRootDict; }
CFX_WeakPtr<CFX_ByteStringPool> GetByteStringPool() const {
return m_pByteStringPool;
@@ -31,11 +31,11 @@ class CFDF_Document : public CPDF_IndirectObjectHolder {
protected:
CFDF_Document();
- void ParseStream(IFX_SeekableReadStream* pFile, FX_BOOL bOwnFile);
+ void ParseStream(IFX_SeekableReadStream* pFile, bool bOwnFile);
CPDF_Dictionary* m_pRootDict;
IFX_SeekableReadStream* m_pFile;
- FX_BOOL m_bOwnFile;
+ bool m_bOwnFile;
CFX_WeakPtr<CFX_ByteStringPool> m_pByteStringPool;
};
diff --git a/core/fpdfapi/parser/cpdf_array.cpp b/core/fpdfapi/parser/cpdf_array.cpp
index 1aec3e06f3..e118fd66e6 100644
--- a/core/fpdfapi/parser/cpdf_array.cpp
+++ b/core/fpdfapi/parser/cpdf_array.cpp
@@ -196,7 +196,7 @@ void CPDF_Array::AddName(const CFX_ByteString& str) {
}
void CPDF_Array::AddString(const CFX_ByteString& str) {
- Add(new CPDF_String(str, FALSE));
+ Add(new CPDF_String(str, false));
}
void CPDF_Array::AddInteger(int i) {
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.cpp b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
index f7dc19e243..5918754c5c 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
@@ -13,7 +13,7 @@
#include "core/fpdfapi/parser/cpdf_security_handler.h"
#include "core/fpdfapi/parser/cpdf_simple_parser.h"
-void CPDF_CryptoHandler::CryptBlock(FX_BOOL bEncrypt,
+void CPDF_CryptoHandler::CryptBlock(bool bEncrypt,
uint32_t objnum,
uint32_t gennum,
const uint8_t* src_buf,
@@ -76,20 +76,20 @@ void CPDF_CryptoHandler::CryptBlock(FX_BOOL bEncrypt,
struct AESCryptContext {
uint8_t m_Context[2048];
- FX_BOOL m_bIV;
+ bool m_bIV;
uint8_t m_Block[16];
uint32_t m_BlockOffset;
};
void* CPDF_CryptoHandler::CryptStart(uint32_t objnum,
uint32_t gennum,
- FX_BOOL bEncrypt) {
+ bool bEncrypt) {
if (m_Cipher == FXCIPHER_NONE) {
return this;
}
if (m_Cipher == FXCIPHER_AES && m_KeyLen == 32) {
AESCryptContext* pContext = FX_Alloc(AESCryptContext, 1);
- pContext->m_bIV = TRUE;
+ pContext->m_bIV = true;
pContext->m_BlockOffset = 0;
CRYPT_AESSetKey(pContext->m_Context, 16, m_EncryptKey, 32, bEncrypt);
if (bEncrypt) {
@@ -115,7 +115,7 @@ void* CPDF_CryptoHandler::CryptStart(uint32_t objnum,
}
if (m_Cipher == FXCIPHER_AES) {
AESCryptContext* pContext = FX_Alloc(AESCryptContext, 1);
- pContext->m_bIV = TRUE;
+ pContext->m_bIV = true;
pContext->m_BlockOffset = 0;
CRYPT_AESSetKey(pContext->m_Context, 16, realkey, 16, bEncrypt);
if (bEncrypt) {
@@ -131,28 +131,28 @@ void* CPDF_CryptoHandler::CryptStart(uint32_t objnum,
return pContext;
}
-FX_BOOL CPDF_CryptoHandler::CryptStream(void* context,
- const uint8_t* src_buf,
- uint32_t src_size,
- CFX_BinaryBuf& dest_buf,
- FX_BOOL bEncrypt) {
+bool CPDF_CryptoHandler::CryptStream(void* context,
+ const uint8_t* src_buf,
+ uint32_t src_size,
+ CFX_BinaryBuf& dest_buf,
+ bool bEncrypt) {
if (!context) {
- return FALSE;
+ return false;
}
if (m_Cipher == FXCIPHER_NONE) {
dest_buf.AppendBlock(src_buf, src_size);
- return TRUE;
+ return true;
}
if (m_Cipher == FXCIPHER_RC4) {
int old_size = dest_buf.GetSize();
dest_buf.AppendBlock(src_buf, src_size);
CRYPT_ArcFourCrypt(context, dest_buf.GetBuffer() + old_size, src_size);
- return TRUE;
+ return true;
}
AESCryptContext* pContext = (AESCryptContext*)context;
if (pContext->m_bIV && bEncrypt) {
dest_buf.AppendBlock(pContext->m_Block, 16);
- pContext->m_bIV = FALSE;
+ pContext->m_bIV = false;
}
uint32_t src_off = 0;
uint32_t src_left = src_size;
@@ -169,7 +169,7 @@ FX_BOOL CPDF_CryptoHandler::CryptStream(void* context,
if (pContext->m_BlockOffset == 16) {
if (!bEncrypt && pContext->m_bIV) {
CRYPT_AESSetIV(pContext->m_Context, pContext->m_Block);
- pContext->m_bIV = FALSE;
+ pContext->m_bIV = false;
pContext->m_BlockOffset = 0;
} else if (src_off < src_size) {
uint8_t block_buf[16];
@@ -188,20 +188,20 @@ FX_BOOL CPDF_CryptoHandler::CryptStream(void* context,
break;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CryptoHandler::CryptFinish(void* context,
- CFX_BinaryBuf& dest_buf,
- FX_BOOL bEncrypt) {
+bool CPDF_CryptoHandler::CryptFinish(void* context,
+ CFX_BinaryBuf& dest_buf,
+ bool bEncrypt) {
if (!context) {
- return FALSE;
+ return false;
}
if (m_Cipher == FXCIPHER_NONE) {
- return TRUE;
+ return true;
}
if (m_Cipher == FXCIPHER_RC4) {
FX_Free(context);
- return TRUE;
+ return true;
}
AESCryptContext* pContext = (AESCryptContext*)context;
if (bEncrypt) {
@@ -224,7 +224,7 @@ FX_BOOL CPDF_CryptoHandler::CryptFinish(void* context,
}
}
FX_Free(pContext);
- return TRUE;
+ return true;
}
void CPDF_CryptoHandler::Decrypt(uint32_t objnum,
@@ -238,20 +238,20 @@ void CPDF_CryptoHandler::Decrypt(uint32_t objnum,
}
void* CPDF_CryptoHandler::DecryptStart(uint32_t objnum, uint32_t gennum) {
- return CryptStart(objnum, gennum, FALSE);
+ return CryptStart(objnum, gennum, false);
}
uint32_t CPDF_CryptoHandler::DecryptGetSize(uint32_t src_size) {
return m_Cipher == FXCIPHER_AES ? src_size - 16 : src_size;
}
-FX_BOOL CPDF_CryptoHandler::Init(CPDF_Dictionary* pEncryptDict,
- CPDF_SecurityHandler* pSecurityHandler) {
+bool CPDF_CryptoHandler::Init(CPDF_Dictionary* pEncryptDict,
+ CPDF_SecurityHandler* pSecurityHandler) {
const uint8_t* key;
if (!pSecurityHandler->GetCryptInfo(m_Cipher, key, m_KeyLen)) {
- return FALSE;
+ return false;
}
if (m_KeyLen > 32 || m_KeyLen < 0) {
- return FALSE;
+ return false;
}
if (m_Cipher != FXCIPHER_NONE) {
FXSYS_memcpy(m_EncryptKey, key, m_KeyLen);
@@ -259,10 +259,10 @@ FX_BOOL CPDF_CryptoHandler::Init(CPDF_Dictionary* pEncryptDict,
if (m_Cipher == FXCIPHER_AES) {
m_pAESContext = FX_Alloc(uint8_t, 2048);
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CryptoHandler::Init(int cipher, const uint8_t* key, int keylen) {
+bool CPDF_CryptoHandler::Init(int cipher, const uint8_t* key, int keylen) {
if (cipher == FXCIPHER_AES) {
switch (keylen) {
case 16:
@@ -270,15 +270,15 @@ FX_BOOL CPDF_CryptoHandler::Init(int cipher, const uint8_t* key, int keylen) {
case 32:
break;
default:
- return FALSE;
+ return false;
}
} else if (cipher == FXCIPHER_AES2) {
if (keylen != 32) {
- return FALSE;
+ return false;
}
} else if (cipher == FXCIPHER_RC4) {
if (keylen < 5 || keylen > 16) {
- return FALSE;
+ return false;
}
} else {
if (keylen > 32) {
@@ -291,17 +291,16 @@ FX_BOOL CPDF_CryptoHandler::Init(int cipher, const uint8_t* key, int keylen) {
if (m_Cipher == FXCIPHER_AES) {
m_pAESContext = FX_Alloc(uint8_t, 2048);
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CryptoHandler::DecryptStream(void* context,
- const uint8_t* src_buf,
- uint32_t src_size,
- CFX_BinaryBuf& dest_buf) {
- return CryptStream(context, src_buf, src_size, dest_buf, FALSE);
+bool CPDF_CryptoHandler::DecryptStream(void* context,
+ const uint8_t* src_buf,
+ uint32_t src_size,
+ CFX_BinaryBuf& dest_buf) {
+ return CryptStream(context, src_buf, src_size, dest_buf, false);
}
-FX_BOOL CPDF_CryptoHandler::DecryptFinish(void* context,
- CFX_BinaryBuf& dest_buf) {
- return CryptFinish(context, dest_buf, FALSE);
+bool CPDF_CryptoHandler::DecryptFinish(void* context, CFX_BinaryBuf& dest_buf) {
+ return CryptFinish(context, dest_buf, false);
}
uint32_t CPDF_CryptoHandler::EncryptGetSize(uint32_t objnum,
uint32_t version,
@@ -312,14 +311,14 @@ uint32_t CPDF_CryptoHandler::EncryptGetSize(uint32_t objnum,
}
return src_size;
}
-FX_BOOL CPDF_CryptoHandler::EncryptContent(uint32_t objnum,
- uint32_t gennum,
- const uint8_t* src_buf,
- uint32_t src_size,
- uint8_t* dest_buf,
- uint32_t& dest_size) {
- CryptBlock(TRUE, objnum, gennum, src_buf, src_size, dest_buf, dest_size);
- return TRUE;
+bool CPDF_CryptoHandler::EncryptContent(uint32_t objnum,
+ uint32_t gennum,
+ const uint8_t* src_buf,
+ uint32_t src_size,
+ uint8_t* dest_buf,
+ uint32_t& dest_size) {
+ CryptBlock(true, objnum, gennum, src_buf, src_size, dest_buf, dest_size);
+ return true;
}
CPDF_CryptoHandler::CPDF_CryptoHandler() {
m_pAESContext = nullptr;
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.h b/core/fpdfapi/parser/cpdf_crypto_handler.h
index 37612f9ef0..63a2590950 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.h
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.h
@@ -19,44 +19,44 @@ class CPDF_CryptoHandler {
CPDF_CryptoHandler();
~CPDF_CryptoHandler();
- FX_BOOL Init(CPDF_Dictionary* pEncryptDict,
- CPDF_SecurityHandler* pSecurityHandler);
+ bool Init(CPDF_Dictionary* pEncryptDict,
+ CPDF_SecurityHandler* pSecurityHandler);
uint32_t DecryptGetSize(uint32_t src_size);
void* DecryptStart(uint32_t objnum, uint32_t gennum);
void Decrypt(uint32_t objnum, uint32_t gennum, CFX_ByteString& str);
- FX_BOOL DecryptStream(void* context,
- const uint8_t* src_buf,
- uint32_t src_size,
- CFX_BinaryBuf& dest_buf);
- FX_BOOL DecryptFinish(void* context, CFX_BinaryBuf& dest_buf);
+ bool DecryptStream(void* context,
+ const uint8_t* src_buf,
+ uint32_t src_size,
+ CFX_BinaryBuf& dest_buf);
+ bool DecryptFinish(void* context, CFX_BinaryBuf& dest_buf);
uint32_t EncryptGetSize(uint32_t objnum,
uint32_t version,
const uint8_t* src_buf,
uint32_t src_size);
- FX_BOOL EncryptContent(uint32_t objnum,
- uint32_t version,
- const uint8_t* src_buf,
- uint32_t src_size,
- uint8_t* dest_buf,
- uint32_t& dest_size);
+ bool EncryptContent(uint32_t objnum,
+ uint32_t version,
+ const uint8_t* src_buf,
+ uint32_t src_size,
+ uint8_t* dest_buf,
+ uint32_t& dest_size);
- FX_BOOL Init(int cipher, const uint8_t* key, int keylen);
+ bool Init(int cipher, const uint8_t* key, int keylen);
protected:
- void CryptBlock(FX_BOOL bEncrypt,
+ void CryptBlock(bool bEncrypt,
uint32_t objnum,
uint32_t gennum,
const uint8_t* src_buf,
uint32_t src_size,
uint8_t* dest_buf,
uint32_t& dest_size);
- void* CryptStart(uint32_t objnum, uint32_t gennum, FX_BOOL bEncrypt);
- FX_BOOL CryptStream(void* context,
- const uint8_t* src_buf,
- uint32_t src_size,
- CFX_BinaryBuf& dest_buf,
- FX_BOOL bEncrypt);
- FX_BOOL CryptFinish(void* context, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt);
+ void* CryptStart(uint32_t objnum, uint32_t gennum, bool bEncrypt);
+ bool CryptStream(void* context,
+ const uint8_t* src_buf,
+ uint32_t src_size,
+ CFX_BinaryBuf& dest_buf,
+ bool bEncrypt);
+ bool CryptFinish(void* context, CFX_BinaryBuf& dest_buf, bool bEncrypt);
uint8_t m_EncryptKey[32];
int m_KeyLen;
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index 318f2cf54d..a077ebb715 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -33,7 +33,7 @@ int CPDF_DataAvail::s_CurrentDataAvailRecursionDepth = 0;
CPDF_DataAvail::CPDF_DataAvail(FileAvail* pFileAvail,
IFX_SeekableReadStream* pFileRead,
- FX_BOOL bSupportHintTable)
+ bool bSupportHintTable)
: m_pFileAvail(pFileAvail), m_pFileRead(pFileRead) {
m_Pos = 0;
m_dwFileLen = 0;
@@ -53,19 +53,19 @@ CPDF_DataAvail::CPDF_DataAvail(FileAvail* pFileAvail,
m_dwEncryptObjNum = 0;
m_dwPrevXRefOffset = 0;
m_dwLastXRefOffset = 0;
- m_bDocAvail = FALSE;
- m_bMainXRefLoadTried = FALSE;
- m_bDocAvail = FALSE;
- m_bLinearized = FALSE;
- m_bPagesLoad = FALSE;
- m_bPagesTreeLoad = FALSE;
- m_bMainXRefLoadedOK = FALSE;
- m_bAnnotsLoad = FALSE;
- m_bHaveAcroForm = FALSE;
- m_bAcroFormLoad = FALSE;
- m_bPageLoadedOK = FALSE;
- m_bNeedDownLoadResource = FALSE;
- m_bLinearizedFormParamLoad = FALSE;
+ m_bDocAvail = false;
+ m_bMainXRefLoadTried = false;
+ m_bDocAvail = false;
+ m_bLinearized = false;
+ m_bPagesLoad = false;
+ m_bPagesTreeLoad = false;
+ m_bMainXRefLoadedOK = false;
+ m_bAnnotsLoad = false;
+ m_bHaveAcroForm = false;
+ m_bAcroFormLoad = false;
+ m_bPageLoadedOK = false;
+ m_bNeedDownLoadResource = false;
+ m_bLinearizedFormParamLoad = false;
m_pLinearized = nullptr;
m_pRoot = nullptr;
m_pTrailer = nullptr;
@@ -75,9 +75,9 @@ CPDF_DataAvail::CPDF_DataAvail(FileAvail* pFileAvail,
m_pPageResource = nullptr;
m_docStatus = PDF_DATAAVAIL_HEADER;
m_parser.m_bOwnFileRead = false;
- m_bTotalLoadPageTree = FALSE;
- m_bCurPageDictLoadOK = FALSE;
- m_bLinearedDataOK = FALSE;
+ m_bTotalLoadPageTree = false;
+ m_bCurPageDictLoadOK = false;
+ m_bLinearedDataOK = false;
m_bSupportHintTable = bSupportHintTable;
}
@@ -125,13 +125,12 @@ uint32_t CPDF_DataAvail::GetObjectSize(uint32_t objnum, FX_FILESIZE& offset) {
return *it - offset;
}
-FX_BOOL CPDF_DataAvail::AreObjectsAvailable(
- std::vector<CPDF_Object*>& obj_array,
- FX_BOOL bParsePage,
- DownloadHints* pHints,
- std::vector<CPDF_Object*>& ret_array) {
+bool CPDF_DataAvail::AreObjectsAvailable(std::vector<CPDF_Object*>& obj_array,
+ bool bParsePage,
+ DownloadHints* pHints,
+ std::vector<CPDF_Object*>& ret_array) {
if (obj_array.empty())
- return TRUE;
+ return true;
uint32_t count = 0;
std::vector<CPDF_Object*> new_obj_array;
@@ -190,11 +189,11 @@ FX_BOOL CPDF_DataAvail::AreObjectsAvailable(
continue;
ret_array.push_back(pObj);
}
- return FALSE;
+ return false;
}
obj_array = new_obj_array;
- return AreObjectsAvailable(obj_array, FALSE, pHints, ret_array);
+ return AreObjectsAvailable(obj_array, false, pHints, ret_array);
}
CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsDocAvail(
@@ -213,52 +212,52 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsDocAvail(
return DataAvailable;
}
-FX_BOOL CPDF_DataAvail::CheckAcroFormSubObject(DownloadHints* pHints) {
+bool CPDF_DataAvail::CheckAcroFormSubObject(DownloadHints* pHints) {
if (m_objs_array.empty()) {
m_ObjectSet.clear();
std::vector<CPDF_Object*> obj_array = m_arrayAcroforms;
- if (!AreObjectsAvailable(obj_array, FALSE, pHints, m_objs_array))
- return FALSE;
+ if (!AreObjectsAvailable(obj_array, false, pHints, m_objs_array))
+ return false;
m_objs_array.clear();
- return TRUE;
+ return true;
}
std::vector<CPDF_Object*> new_objs_array;
- if (!AreObjectsAvailable(m_objs_array, FALSE, pHints, new_objs_array)) {
+ if (!AreObjectsAvailable(m_objs_array, false, pHints, new_objs_array)) {
m_objs_array = new_objs_array;
- return FALSE;
+ return false;
}
for (CPDF_Object* pObject : m_arrayAcroforms)
pObject->Release();
m_arrayAcroforms.clear();
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckAcroForm(DownloadHints* pHints) {
- FX_BOOL bExist = FALSE;
+bool CPDF_DataAvail::CheckAcroForm(DownloadHints* pHints) {
+ bool bExist = false;
m_pAcroForm = GetObject(m_dwAcroFormObjNum, pHints, &bExist);
if (!bExist) {
m_docStatus = PDF_DATAAVAIL_PAGETREE;
- return TRUE;
+ return true;
}
if (!m_pAcroForm) {
if (m_docStatus == PDF_DATAAVAIL_ERROR) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
m_arrayAcroforms.push_back(m_pAcroForm);
m_docStatus = PDF_DATAAVAIL_PAGETREE;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckDocStatus(DownloadHints* pHints) {
+bool CPDF_DataAvail::CheckDocStatus(DownloadHints* pHints) {
switch (m_docStatus) {
case PDF_DATAAVAIL_HEADER:
return CheckHeader(pHints);
@@ -297,18 +296,18 @@ FX_BOOL CPDF_DataAvail::CheckDocStatus(DownloadHints* pHints) {
if (m_bTotalLoadPageTree)
return CheckPage(pHints);
m_docStatus = PDF_DATAAVAIL_PAGE_LATERLOAD;
- return TRUE;
+ return true;
case PDF_DATAAVAIL_ERROR:
return LoadAllFile(pHints);
case PDF_DATAAVAIL_PAGE_LATERLOAD:
m_docStatus = PDF_DATAAVAIL_PAGE;
default:
- m_bDocAvail = TRUE;
- return TRUE;
+ m_bDocAvail = true;
+ return true;
}
}
-FX_BOOL CPDF_DataAvail::CheckPageStatus(DownloadHints* pHints) {
+bool CPDF_DataAvail::CheckPageStatus(DownloadHints* pHints) {
switch (m_docStatus) {
case PDF_DATAAVAIL_PAGETREE:
return CheckPages(pHints);
@@ -317,48 +316,48 @@ FX_BOOL CPDF_DataAvail::CheckPageStatus(DownloadHints* pHints) {
case PDF_DATAAVAIL_ERROR:
return LoadAllFile(pHints);
default:
- m_bPagesTreeLoad = TRUE;
- m_bPagesLoad = TRUE;
- return TRUE;
+ m_bPagesTreeLoad = true;
+ m_bPagesLoad = true;
+ return true;
}
}
-FX_BOOL CPDF_DataAvail::LoadAllFile(DownloadHints* pHints) {
+bool CPDF_DataAvail::LoadAllFile(DownloadHints* pHints) {
if (m_pFileAvail->IsDataAvail(0, (uint32_t)m_dwFileLen)) {
m_docStatus = PDF_DATAAVAIL_DONE;
- return TRUE;
+ return true;
}
pHints->AddSegment(0, (uint32_t)m_dwFileLen);
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_DataAvail::LoadAllXref(DownloadHints* pHints) {
+bool CPDF_DataAvail::LoadAllXref(DownloadHints* pHints) {
m_parser.m_pSyntax->InitParser(m_pFileRead, (uint32_t)m_dwHeaderOffset);
m_parser.m_bOwnFileRead = false;
if (!m_parser.LoadAllCrossRefV4(m_dwLastXRefOffset) &&
!m_parser.LoadAllCrossRefV5(m_dwLastXRefOffset)) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return FALSE;
+ return false;
}
m_dwRootObjNum = m_parser.GetRootObjNum();
m_dwInfoObjNum = m_parser.GetInfoObjNum();
m_pCurrentParser = &m_parser;
m_docStatus = PDF_DATAAVAIL_ROOT;
- return TRUE;
+ return true;
}
CPDF_Object* CPDF_DataAvail::GetObject(uint32_t objnum,
DownloadHints* pHints,
- FX_BOOL* pExistInFile) {
+ bool* pExistInFile) {
CPDF_Object* pRet = nullptr;
uint32_t size = 0;
FX_FILESIZE offset = 0;
CPDF_Parser* pParser = nullptr;
if (pExistInFile)
- *pExistInFile = TRUE;
+ *pExistInFile = true;
if (m_pDocument) {
size = GetObjectSize(objnum, offset);
@@ -376,29 +375,29 @@ CPDF_Object* CPDF_DataAvail::GetObject(uint32_t objnum,
pRet = pParser->ParseIndirectObject(nullptr, objnum);
if (!pRet && pExistInFile)
- *pExistInFile = FALSE;
+ *pExistInFile = false;
return pRet;
}
-FX_BOOL CPDF_DataAvail::CheckInfo(DownloadHints* pHints) {
- FX_BOOL bExist = FALSE;
+bool CPDF_DataAvail::CheckInfo(DownloadHints* pHints) {
+ bool bExist = false;
CPDF_Object* pInfo = GetObject(m_dwInfoObjNum, pHints, &bExist);
if (!bExist) {
m_docStatus =
(m_bHaveAcroForm ? PDF_DATAAVAIL_ACROFORM : PDF_DATAAVAIL_PAGETREE);
- return TRUE;
+ return true;
}
if (!pInfo) {
if (m_docStatus == PDF_DATAAVAIL_ERROR) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
if (m_Pos == m_dwFileLen)
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
if (pInfo)
@@ -407,42 +406,42 @@ FX_BOOL CPDF_DataAvail::CheckInfo(DownloadHints* pHints) {
m_docStatus =
(m_bHaveAcroForm ? PDF_DATAAVAIL_ACROFORM : PDF_DATAAVAIL_PAGETREE);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckRoot(DownloadHints* pHints) {
- FX_BOOL bExist = FALSE;
+bool CPDF_DataAvail::CheckRoot(DownloadHints* pHints) {
+ bool bExist = false;
m_pRoot = GetObject(m_dwRootObjNum, pHints, &bExist);
if (!bExist) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
if (!m_pRoot) {
if (m_docStatus == PDF_DATAAVAIL_ERROR) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
CPDF_Dictionary* pDict = m_pRoot->GetDict();
if (!pDict) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
CPDF_Reference* pRef = ToReference(pDict->GetObjectFor("Pages"));
if (!pRef) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
m_PagesObjNum = pRef->GetRefObjNum();
CPDF_Reference* pAcroFormRef =
ToReference(m_pRoot->GetDict()->GetObjectFor("AcroForm"));
if (pAcroFormRef) {
- m_bHaveAcroForm = TRUE;
+ m_bHaveAcroForm = true;
m_dwAcroFormObjNum = pAcroFormRef->GetRefObjNum();
}
@@ -452,22 +451,22 @@ FX_BOOL CPDF_DataAvail::CheckRoot(DownloadHints* pHints) {
m_docStatus =
m_bHaveAcroForm ? PDF_DATAAVAIL_ACROFORM : PDF_DATAAVAIL_PAGETREE;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::PreparePageItem() {
+bool CPDF_DataAvail::PreparePageItem() {
CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
CPDF_Reference* pRef =
ToReference(pRoot ? pRoot->GetObjectFor("Pages") : nullptr);
if (!pRef) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
m_PagesObjNum = pRef->GetRefObjNum();
m_pCurrentParser = m_pDocument->GetParser();
m_docStatus = PDF_DATAAVAIL_PAGETREE;
- return TRUE;
+ return true;
}
bool CPDF_DataAvail::IsFirstCheck(uint32_t dwPage) {
@@ -478,12 +477,12 @@ void CPDF_DataAvail::ResetFirstCheck(uint32_t dwPage) {
m_pageMapCheckState.erase(dwPage);
}
-FX_BOOL CPDF_DataAvail::CheckPage(DownloadHints* pHints) {
+bool CPDF_DataAvail::CheckPage(DownloadHints* pHints) {
uint32_t iPageObjs = m_PageObjList.GetSize();
CFX_ArrayTemplate<uint32_t> UnavailObjList;
for (uint32_t i = 0; i < iPageObjs; ++i) {
uint32_t dwPageObjNum = m_PageObjList.GetAt(i);
- FX_BOOL bExist = FALSE;
+ bool bExist = false;
CPDF_Object* pObj = GetObject(dwPageObjNum, pHints, &bExist);
if (!pObj) {
if (bExist)
@@ -515,7 +514,7 @@ FX_BOOL CPDF_DataAvail::CheckPage(DownloadHints* pHints) {
m_PageObjList.RemoveAll();
if (UnavailObjList.GetSize()) {
m_PageObjList.Append(UnavailObjList);
- return FALSE;
+ return false;
}
uint32_t iPages = m_PagesArray.size();
@@ -531,7 +530,7 @@ FX_BOOL CPDF_DataAvail::CheckPage(DownloadHints* pHints) {
m_PagesArray.clear();
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
pPages->Release();
}
@@ -539,19 +538,19 @@ FX_BOOL CPDF_DataAvail::CheckPage(DownloadHints* pHints) {
m_PagesArray.clear();
if (!m_PageObjList.GetSize())
m_docStatus = PDF_DATAAVAIL_DONE;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages) {
+bool CPDF_DataAvail::GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages) {
if (!pParser) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
CPDF_Dictionary* pDict = pPages->GetDict();
CPDF_Object* pKids = pDict ? pDict->GetObjectFor("Kids") : nullptr;
if (!pKids)
- return TRUE;
+ return true;
switch (pKids->GetType()) {
case CPDF_Object::REFERENCE:
@@ -566,39 +565,39 @@ FX_BOOL CPDF_DataAvail::GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages) {
} break;
default:
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckPages(DownloadHints* pHints) {
- FX_BOOL bExist = FALSE;
+bool CPDF_DataAvail::CheckPages(DownloadHints* pHints) {
+ bool bExist = false;
CPDF_Object* pPages = GetObject(m_PagesObjNum, pHints, &bExist);
if (!bExist) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
if (!pPages) {
if (m_docStatus == PDF_DATAAVAIL_ERROR) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
if (!GetPageKids(m_pCurrentParser, pPages)) {
pPages->Release();
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
pPages->Release();
m_docStatus = PDF_DATAAVAIL_PAGE;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckHeader(DownloadHints* pHints) {
+bool CPDF_DataAvail::CheckHeader(DownloadHints* pHints) {
ASSERT(m_dwFileLen >= 0);
const uint32_t kReqSize = std::min(static_cast<uint32_t>(m_dwFileLen), 1024U);
@@ -610,37 +609,37 @@ FX_BOOL CPDF_DataAvail::CheckHeader(DownloadHints* pHints) {
m_docStatus = PDF_DATAAVAIL_FIRSTPAGE;
} else {
if (m_docStatus == PDF_DATAAVAIL_ERROR)
- return FALSE;
+ return false;
m_docStatus = PDF_DATAAVAIL_END;
}
- return TRUE;
+ return true;
}
pHints->AddSegment(0, kReqSize);
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_DataAvail::CheckFirstPage(DownloadHints* pHints) {
+bool CPDF_DataAvail::CheckFirstPage(DownloadHints* pHints) {
CPDF_Dictionary* pDict = m_pLinearized->GetDict();
CPDF_Object* pEndOffSet = pDict ? pDict->GetObjectFor("E") : nullptr;
if (!pEndOffSet) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
CPDF_Object* pXRefOffset = pDict ? pDict->GetObjectFor("T") : nullptr;
if (!pXRefOffset) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
CPDF_Object* pFileLen = pDict ? pDict->GetObjectFor("L") : nullptr;
if (!pFileLen) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
- FX_BOOL bNeedDownLoad = FALSE;
+ bool bNeedDownLoad = false;
if (pEndOffSet->IsNumber()) {
uint32_t dwEnd = pEndOffSet->GetInteger();
dwEnd += 512;
@@ -651,7 +650,7 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(DownloadHints* pHints) {
int32_t iSize = dwEnd > 1024 ? dwEnd - 1024 : 0;
if (!m_pFileAvail->IsDataAvail(iStartPos, iSize)) {
pHints->AddSegment(iStartPos, iSize);
- bNeedDownLoad = TRUE;
+ bNeedDownLoad = true;
}
}
@@ -680,19 +679,19 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(DownloadHints* pHints) {
if (bNeedDownLoad || m_docStatus != PDF_DATAAVAIL_FIRSTPAGE_PREPARE) {
m_docStatus = PDF_DATAAVAIL_FIRSTPAGE_PREPARE;
- return FALSE;
+ return false;
}
m_docStatus =
m_bSupportHintTable ? PDF_DATAAVAIL_HINTTABLE : PDF_DATAAVAIL_DONE;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::IsDataAvail(FX_FILESIZE offset,
- uint32_t size,
- DownloadHints* pHints) {
+bool CPDF_DataAvail::IsDataAvail(FX_FILESIZE offset,
+ uint32_t size,
+ DownloadHints* pHints) {
if (offset < 0 || offset > m_dwFileLen)
- return TRUE;
+ return true;
FX_SAFE_FILESIZE safeSize = offset;
safeSize += size;
@@ -704,49 +703,49 @@ FX_BOOL CPDF_DataAvail::IsDataAvail(FX_FILESIZE offset,
if (!m_pFileAvail->IsDataAvail(offset, size)) {
pHints->AddSegment(offset, size);
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckHintTables(DownloadHints* pHints) {
+bool CPDF_DataAvail::CheckHintTables(DownloadHints* pHints) {
CPDF_Dictionary* pDict = m_pLinearized->GetDict();
if (!pDict) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
// The actual value is not required here, but validate its existence and type.
CPDF_Number* pFirstPage = ToNumber(pDict->GetDirectObjectFor("O"));
if (!pFirstPage || !pFirstPage->IsInteger()) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
CPDF_Number* pPageCount = ToNumber(pDict->GetDirectObjectFor("N"));
if (!pPageCount || !pPageCount->IsInteger()) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
int nPageCount = pPageCount->GetInteger();
if (nPageCount <= 1) {
m_docStatus = PDF_DATAAVAIL_DONE;
- return TRUE;
+ return true;
}
CPDF_Array* pHintStreamRange = pDict->GetArrayFor("H");
size_t nHintStreamSize = pHintStreamRange ? pHintStreamRange->GetCount() : 0;
if (nHintStreamSize != 2 && nHintStreamSize != 4) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
for (const CPDF_Object* pArrayObject : *pHintStreamRange) {
const CPDF_Number* pNumber = ToNumber(pArrayObject->GetDirect());
if (!pNumber || !pNumber->IsInteger()) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
}
@@ -754,11 +753,11 @@ FX_BOOL CPDF_DataAvail::CheckHintTables(DownloadHints* pHints) {
FX_FILESIZE szHintLength = pHintStreamRange->GetIntegerAt(1);
if (szHintStart < 0 || szHintLength <= 0) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
if (!IsDataAvail(szHintStart, szHintLength, pHints))
- return FALSE;
+ return false;
m_syntaxParser.InitParser(m_pFileRead, m_dwHeaderOffset);
@@ -771,7 +770,7 @@ FX_BOOL CPDF_DataAvail::CheckHintTables(DownloadHints* pHints) {
m_pHintTables = std::move(pHintTables);
m_docStatus = PDF_DATAAVAIL_DONE;
- return TRUE;
+ return true;
}
CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt(
@@ -826,20 +825,20 @@ CPDF_DataAvail::DocLinearizationStatus CPDF_DataAvail::IsLinearizedPDF() {
return NotLinearized;
}
-FX_BOOL CPDF_DataAvail::IsLinearized() {
+bool CPDF_DataAvail::IsLinearized() {
return m_bLinearized;
}
-FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) {
+bool CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) {
if (m_pLinearized)
return m_bLinearized;
- ScopedFileStream file(FX_CreateMemoryStream(pData, (size_t)dwLen, FALSE));
+ ScopedFileStream file(FX_CreateMemoryStream(pData, (size_t)dwLen, false));
int32_t offset = GetHeaderOffset(file.get());
if (offset == -1) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
m_dwHeaderOffset = offset;
@@ -849,34 +848,34 @@ FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) {
bool bNumber;
CFX_ByteString wordObjNum = m_syntaxParser.GetNextWord(&bNumber);
if (!bNumber)
- return FALSE;
+ return false;
uint32_t objnum = FXSYS_atoui(wordObjNum.c_str());
m_pLinearized =
ParseIndirectObjectAt(m_syntaxParser.m_HeaderOffset + 9, objnum);
if (!m_pLinearized)
- return FALSE;
+ return false;
CPDF_Dictionary* pDict = m_pLinearized->GetDict();
if (!pDict || !pDict->GetObjectFor("Linearized"))
- return FALSE;
+ return false;
CPDF_Object* pLen = pDict->GetObjectFor("L");
if (!pLen)
- return FALSE;
+ return false;
if ((FX_FILESIZE)pLen->GetInteger() != m_pFileRead->GetSize())
- return FALSE;
+ return false;
- m_bLinearized = TRUE;
+ m_bLinearized = true;
if (CPDF_Number* pNo = ToNumber(pDict->GetObjectFor("P")))
m_dwFirstPageNo = pNo->GetInteger();
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckEnd(DownloadHints* pHints) {
+bool CPDF_DataAvail::CheckEnd(DownloadHints* pHints) {
uint32_t req_pos = (uint32_t)(m_dwFileLen > 1024 ? m_dwFileLen - 1024 : 0);
uint32_t dwSize = (uint32_t)(m_dwFileLen - req_pos);
@@ -884,38 +883,38 @@ FX_BOOL CPDF_DataAvail::CheckEnd(DownloadHints* pHints) {
uint8_t buffer[1024];
m_pFileRead->ReadBlock(buffer, req_pos, dwSize);
- ScopedFileStream file(FX_CreateMemoryStream(buffer, (size_t)dwSize, FALSE));
+ ScopedFileStream file(FX_CreateMemoryStream(buffer, (size_t)dwSize, false));
m_syntaxParser.InitParser(file.get(), 0);
m_syntaxParser.RestorePos(dwSize - 1);
- if (m_syntaxParser.SearchWord("startxref", TRUE, FALSE, dwSize)) {
+ if (m_syntaxParser.SearchWord("startxref", true, false, dwSize)) {
m_syntaxParser.GetNextWord(nullptr);
bool bNumber;
CFX_ByteString xrefpos_str = m_syntaxParser.GetNextWord(&bNumber);
if (!bNumber) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
m_dwXRefOffset = (FX_FILESIZE)FXSYS_atoi64(xrefpos_str.c_str());
if (!m_dwXRefOffset || m_dwXRefOffset > m_dwFileLen) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
m_dwLastXRefOffset = m_dwXRefOffset;
SetStartOffset(m_dwXRefOffset);
m_docStatus = PDF_DATAAVAIL_CROSSREF;
- return TRUE;
+ return true;
}
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
pHints->AddSegment(req_pos, dwSize);
- return FALSE;
+ return false;
}
int32_t CPDF_DataAvail::CheckCrossRefStream(DownloadHints* pHints,
@@ -931,7 +930,7 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(DownloadHints* pHints,
m_pFileRead->ReadBlock(pBuf, m_dwCurrentXRefSteam, iSize);
- ScopedFileStream file(FX_CreateMemoryStream(pBuf, (size_t)iSize, FALSE));
+ ScopedFileStream file(FX_CreateMemoryStream(pBuf, (size_t)iSize, false));
m_parser.m_pSyntax->InitParser(file.get(), 0);
bool bNumber;
@@ -967,15 +966,15 @@ void CPDF_DataAvail::SetStartOffset(FX_FILESIZE dwOffset) {
m_Pos = dwOffset;
}
-FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString& token) {
+bool CPDF_DataAvail::GetNextToken(CFX_ByteString& token) {
uint8_t ch;
if (!GetNextChar(ch))
- return FALSE;
+ return false;
while (1) {
while (PDFCharIsWhitespace(ch)) {
if (!GetNextChar(ch))
- return FALSE;
+ return false;
}
if (ch != '%')
@@ -983,7 +982,7 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString& token) {
while (1) {
if (!GetNextChar(ch))
- return FALSE;
+ return false;
if (PDFCharIsLineEnding(ch))
break;
}
@@ -996,13 +995,13 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString& token) {
if (ch == '/') {
while (1) {
if (!GetNextChar(ch))
- return FALSE;
+ return false;
if (!PDFCharIsOther(ch) && !PDFCharIsNumeric(ch)) {
m_Pos--;
CFX_ByteString ret(buffer, index);
token = ret;
- return TRUE;
+ return true;
}
if (index < sizeof(buffer))
@@ -1010,7 +1009,7 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString& token) {
}
} else if (ch == '<') {
if (!GetNextChar(ch))
- return FALSE;
+ return false;
if (ch == '<')
buffer[index++] = ch;
@@ -1018,7 +1017,7 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString& token) {
m_Pos--;
} else if (ch == '>') {
if (!GetNextChar(ch))
- return FALSE;
+ return false;
if (ch == '>')
buffer[index++] = ch;
@@ -1028,7 +1027,7 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString& token) {
CFX_ByteString ret(buffer, index);
token = ret;
- return TRUE;
+ return true;
}
while (1) {
@@ -1036,7 +1035,7 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString& token) {
buffer[index++] = ch;
if (!GetNextChar(ch))
- return FALSE;
+ return false;
if (PDFCharIsDelimiter(ch) || PDFCharIsWhitespace(ch)) {
m_Pos--;
@@ -1045,13 +1044,13 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString& token) {
}
token = CFX_ByteString(buffer, index);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::GetNextChar(uint8_t& ch) {
+bool CPDF_DataAvail::GetNextChar(uint8_t& ch) {
FX_FILESIZE pos = m_Pos;
if (pos >= m_dwFileLen)
- return FALSE;
+ return false;
if (m_bufferOffset >= pos ||
(FX_FILESIZE)(m_bufferOffset + m_bufferSize) <= pos) {
@@ -1064,35 +1063,35 @@ FX_BOOL CPDF_DataAvail::GetNextChar(uint8_t& ch) {
read_pos = m_dwFileLen - read_size;
if (!m_pFileRead->ReadBlock(m_bufferData, read_pos, read_size))
- return FALSE;
+ return false;
m_bufferOffset = read_pos;
m_bufferSize = read_size;
}
ch = m_bufferData[pos - m_bufferOffset];
m_Pos++;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckCrossRefItem(DownloadHints* pHints) {
+bool CPDF_DataAvail::CheckCrossRefItem(DownloadHints* pHints) {
int32_t iSize = 0;
CFX_ByteString token;
while (1) {
if (!GetNextToken(token)) {
iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
pHints->AddSegment(m_Pos, iSize);
- return FALSE;
+ return false;
}
if (token == "trailer") {
m_dwTrailerOffset = m_Pos;
m_docStatus = PDF_DATAAVAIL_TRAILER;
- return TRUE;
+ return true;
}
}
}
-FX_BOOL CPDF_DataAvail::CheckAllCrossRefStream(DownloadHints* pHints) {
+bool CPDF_DataAvail::CheckAllCrossRefStream(DownloadHints* pHints) {
FX_FILESIZE xref_offset = 0;
int32_t nRet = CheckCrossRefStream(pHints, xref_offset);
@@ -1103,21 +1102,21 @@ FX_BOOL CPDF_DataAvail::CheckAllCrossRefStream(DownloadHints* pHints) {
m_dwCurrentXRefSteam = xref_offset;
m_Pos = xref_offset;
}
- return TRUE;
+ return true;
}
if (nRet == -1)
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_DataAvail::CheckCrossRef(DownloadHints* pHints) {
+bool CPDF_DataAvail::CheckCrossRef(DownloadHints* pHints) {
int32_t iSize = 0;
CFX_ByteString token;
if (!GetNextToken(token)) {
iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
pHints->AddSegment(m_Pos, iSize);
- return FALSE;
+ return false;
}
if (token == "xref") {
@@ -1127,23 +1126,23 @@ FX_BOOL CPDF_DataAvail::CheckCrossRef(DownloadHints* pHints) {
(int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
pHints->AddSegment(m_Pos, iSize);
m_docStatus = PDF_DATAAVAIL_CROSSREF_ITEM;
- return FALSE;
+ return false;
}
if (token == "trailer") {
m_dwTrailerOffset = m_Pos;
m_docStatus = PDF_DATAAVAIL_TRAILER;
- return TRUE;
+ return true;
}
}
} else {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_DataAvail::CheckTrailerAppend(DownloadHints* pHints) {
+bool CPDF_DataAvail::CheckTrailerAppend(DownloadHints* pHints) {
if (m_Pos < m_dwFileLen) {
FX_FILESIZE dwAppendPos = m_Pos + m_syntaxParser.SavePos();
int32_t iSize = (int32_t)(
@@ -1151,7 +1150,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailerAppend(DownloadHints* pHints) {
if (!m_pFileAvail->IsDataAvail(dwAppendPos, iSize)) {
pHints->AddSegment(dwAppendPos, iSize);
- return FALSE;
+ return false;
}
}
@@ -1161,10 +1160,10 @@ FX_BOOL CPDF_DataAvail::CheckTrailerAppend(DownloadHints* pHints) {
} else {
m_docStatus = PDF_DATAAVAIL_LOADALLCROSSREF;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckTrailer(DownloadHints* pHints) {
+bool CPDF_DataAvail::CheckTrailer(DownloadHints* pHints) {
int32_t iTrailerSize =
(int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
if (m_pFileAvail->IsDataAvail(m_Pos, iTrailerSize)) {
@@ -1173,13 +1172,13 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(DownloadHints* pHints) {
uint8_t* pBuf = buf.GetBuffer();
if (!pBuf) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
if (!m_pFileRead->ReadBlock(pBuf, m_dwTrailerOffset, iSize))
- return FALSE;
+ return false;
- ScopedFileStream file(FX_CreateMemoryStream(pBuf, (size_t)iSize, FALSE));
+ ScopedFileStream file(FX_CreateMemoryStream(pBuf, (size_t)iSize, false));
m_syntaxParser.InitParser(file.get(), 0);
std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pTrailer(
@@ -1187,17 +1186,17 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(DownloadHints* pHints) {
if (!pTrailer) {
m_Pos += m_syntaxParser.SavePos();
pHints->AddSegment(m_Pos, iTrailerSize);
- return FALSE;
+ return false;
}
if (!pTrailer->IsDictionary())
- return FALSE;
+ return false;
CPDF_Dictionary* pTrailerDict = pTrailer->GetDict();
CPDF_Object* pEncrypt = pTrailerDict->GetObjectFor("Encrypt");
if (ToReference(pEncrypt)) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
uint32_t xrefpos = GetDirectInteger(pTrailerDict, "Prev");
@@ -1214,62 +1213,62 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(DownloadHints* pHints) {
m_docStatus = PDF_DATAAVAIL_TRAILER_APPEND;
}
}
- return TRUE;
+ return true;
}
m_dwPrevXRefOffset = 0;
m_docStatus = PDF_DATAAVAIL_TRAILER_APPEND;
- return TRUE;
+ return true;
}
pHints->AddSegment(m_Pos, iTrailerSize);
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_DataAvail::CheckPage(uint32_t dwPage, DownloadHints* pHints) {
- while (TRUE) {
+bool CPDF_DataAvail::CheckPage(uint32_t dwPage, DownloadHints* pHints) {
+ while (true) {
switch (m_docStatus) {
case PDF_DATAAVAIL_PAGETREE:
if (!LoadDocPages(pHints))
- return FALSE;
+ return false;
break;
case PDF_DATAAVAIL_PAGE:
if (!LoadDocPage(dwPage, pHints))
- return FALSE;
+ return false;
break;
case PDF_DATAAVAIL_ERROR:
return LoadAllFile(pHints);
default:
- m_bPagesTreeLoad = TRUE;
- m_bPagesLoad = TRUE;
- m_bCurPageDictLoadOK = TRUE;
+ m_bPagesTreeLoad = true;
+ m_bPagesLoad = true;
+ m_bCurPageDictLoadOK = true;
m_docStatus = PDF_DATAAVAIL_PAGE;
- return TRUE;
+ return true;
}
}
}
-FX_BOOL CPDF_DataAvail::CheckArrayPageNode(uint32_t dwPageNo,
- PageNode* pPageNode,
- DownloadHints* pHints) {
- FX_BOOL bExist = FALSE;
+bool CPDF_DataAvail::CheckArrayPageNode(uint32_t dwPageNo,
+ PageNode* pPageNode,
+ DownloadHints* pHints) {
+ bool bExist = false;
CPDF_Object* pPages = GetObject(dwPageNo, pHints, &bExist);
if (!bExist) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
if (!pPages) {
if (m_docStatus == PDF_DATAAVAIL_ERROR) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
- return FALSE;
+ return false;
}
CPDF_Array* pArray = pPages->AsArray();
if (!pArray) {
pPages->Release();
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
pPageNode->m_type = PDF_PAGENODE_PAGES;
@@ -1283,36 +1282,36 @@ FX_BOOL CPDF_DataAvail::CheckArrayPageNode(uint32_t dwPageNo,
pNode->m_dwPageNo = pKid->GetRefObjNum();
}
pPages->Release();
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(uint32_t dwPageNo,
- PageNode* pPageNode,
- DownloadHints* pHints) {
- FX_BOOL bExist = FALSE;
+bool CPDF_DataAvail::CheckUnkownPageNode(uint32_t dwPageNo,
+ PageNode* pPageNode,
+ DownloadHints* pHints) {
+ bool bExist = false;
CPDF_Object* pPage = GetObject(dwPageNo, pHints, &bExist);
if (!bExist) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
if (!pPage) {
if (m_docStatus == PDF_DATAAVAIL_ERROR)
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
if (pPage->IsArray()) {
pPageNode->m_dwPageNo = dwPageNo;
pPageNode->m_type = PDF_PAGENODE_ARRAY;
pPage->Release();
- return TRUE;
+ return true;
}
if (!pPage->IsDictionary()) {
pPage->Release();
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
pPageNode->m_dwPageNo = dwPageNo;
@@ -1323,7 +1322,7 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(uint32_t dwPageNo,
CPDF_Object* pKids = pDict->GetObjectFor("Kids");
if (!pKids) {
m_docStatus = PDF_DATAAVAIL_PAGE;
- return TRUE;
+ return true;
}
switch (pKids->GetType()) {
@@ -1353,24 +1352,24 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(uint32_t dwPageNo,
} else {
pPage->Release();
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
pPage->Release();
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_DataAvail::PageNode& pageNodes,
- int32_t iPage,
- int32_t& iCount,
- DownloadHints* pHints,
- int level) {
+bool CPDF_DataAvail::CheckPageNode(CPDF_DataAvail::PageNode& pageNodes,
+ int32_t iPage,
+ int32_t& iCount,
+ DownloadHints* pHints,
+ int level) {
if (level >= kMaxPageRecursionDepth)
- return FALSE;
+ return false;
int32_t iSize = pageNodes.m_childNode.GetSize();
if (iSize <= 0 || iPage >= iSize) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
for (int32_t i = 0; i < iSize; ++i) {
@@ -1381,7 +1380,7 @@ FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_DataAvail::PageNode& pageNodes,
switch (pNode->m_type) {
case PDF_PAGENODE_UNKNOWN:
if (!CheckUnkownPageNode(pNode->m_dwPageNo, pNode, pHints)) {
- return FALSE;
+ return false;
}
--i;
break;
@@ -1392,101 +1391,101 @@ FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_DataAvail::PageNode& pageNodes,
break;
case PDF_PAGENODE_PAGES:
if (!CheckPageNode(*pNode, iPage, iCount, pHints, level + 1))
- return FALSE;
+ return false;
break;
case PDF_PAGENODE_ARRAY:
if (!CheckArrayPageNode(pNode->m_dwPageNo, pNode, pHints))
- return FALSE;
+ return false;
--i;
break;
}
if (iPage == iCount) {
m_docStatus = PDF_DATAAVAIL_DONE;
- return TRUE;
+ return true;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::LoadDocPage(uint32_t dwPage, DownloadHints* pHints) {
+bool CPDF_DataAvail::LoadDocPage(uint32_t dwPage, DownloadHints* pHints) {
FX_SAFE_INT32 safePage = pdfium::base::checked_cast<int32_t>(dwPage);
int32_t iPage = safePage.ValueOrDie();
if (m_pDocument->GetPageCount() <= iPage ||
m_pDocument->IsPageLoaded(iPage)) {
m_docStatus = PDF_DATAAVAIL_DONE;
- return TRUE;
+ return true;
}
if (m_pageNodes.m_type == PDF_PAGENODE_PAGE) {
if (iPage == 0) {
m_docStatus = PDF_DATAAVAIL_DONE;
- return TRUE;
+ return true;
}
m_docStatus = PDF_DATAAVAIL_ERROR;
- return TRUE;
+ return true;
}
int32_t iCount = -1;
return CheckPageNode(m_pageNodes, iPage, iCount, pHints, 0);
}
-FX_BOOL CPDF_DataAvail::CheckPageCount(DownloadHints* pHints) {
- FX_BOOL bExist = FALSE;
+bool CPDF_DataAvail::CheckPageCount(DownloadHints* pHints) {
+ bool bExist = false;
CPDF_Object* pPages = GetObject(m_PagesObjNum, pHints, &bExist);
if (!bExist) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
if (!pPages)
- return FALSE;
+ return false;
CPDF_Dictionary* pPagesDict = pPages->GetDict();
if (!pPagesDict) {
pPages->Release();
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
if (!pPagesDict->KeyExist("Kids")) {
pPages->Release();
- return TRUE;
+ return true;
}
int count = pPagesDict->GetIntegerFor("Count");
if (count > 0) {
pPages->Release();
- return TRUE;
+ return true;
}
pPages->Release();
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_DataAvail::LoadDocPages(DownloadHints* pHints) {
+bool CPDF_DataAvail::LoadDocPages(DownloadHints* pHints) {
if (!CheckUnkownPageNode(m_PagesObjNum, &m_pageNodes, pHints))
- return FALSE;
+ return false;
if (CheckPageCount(pHints)) {
m_docStatus = PDF_DATAAVAIL_PAGE;
- return TRUE;
+ return true;
}
- m_bTotalLoadPageTree = TRUE;
- return FALSE;
+ m_bTotalLoadPageTree = true;
+ return false;
}
-FX_BOOL CPDF_DataAvail::LoadPages(DownloadHints* pHints) {
+bool CPDF_DataAvail::LoadPages(DownloadHints* pHints) {
while (!m_bPagesTreeLoad) {
if (!CheckPageStatus(pHints))
- return FALSE;
+ return false;
}
if (m_bPagesLoad)
- return TRUE;
+ return true;
m_pDocument->LoadPages();
- return FALSE;
+ return false;
}
CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::CheckLinearizedData(
@@ -1508,50 +1507,49 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::CheckLinearizedData(
CPDF_Parser::Error eRet =
m_pDocument->GetParser()->LoadLinearizedMainXRefTable();
- m_bMainXRefLoadTried = TRUE;
+ m_bMainXRefLoadTried = true;
if (eRet != CPDF_Parser::SUCCESS)
return DataError;
if (!PreparePageItem())
return DataNotAvailable;
- m_bMainXRefLoadedOK = TRUE;
- m_bLinearedDataOK = TRUE;
+ m_bMainXRefLoadedOK = true;
+ m_bLinearedDataOK = true;
}
return m_bLinearedDataOK ? DataAvailable : DataNotAvailable;
}
-FX_BOOL CPDF_DataAvail::CheckPageAnnots(uint32_t dwPage,
- DownloadHints* pHints) {
+bool CPDF_DataAvail::CheckPageAnnots(uint32_t dwPage, DownloadHints* pHints) {
if (m_objs_array.empty()) {
m_ObjectSet.clear();
FX_SAFE_INT32 safePage = pdfium::base::checked_cast<int32_t>(dwPage);
CPDF_Dictionary* pPageDict = m_pDocument->GetPage(safePage.ValueOrDie());
if (!pPageDict)
- return TRUE;
+ return true;
CPDF_Object* pAnnots = pPageDict->GetObjectFor("Annots");
if (!pAnnots)
- return TRUE;
+ return true;
std::vector<CPDF_Object*> obj_array;
obj_array.push_back(pAnnots);
- if (!AreObjectsAvailable(obj_array, FALSE, pHints, m_objs_array))
- return FALSE;
+ if (!AreObjectsAvailable(obj_array, false, pHints, m_objs_array))
+ return false;
m_objs_array.clear();
- return TRUE;
+ return true;
}
std::vector<CPDF_Object*> new_objs_array;
- if (!AreObjectsAvailable(m_objs_array, FALSE, pHints, new_objs_array)) {
+ if (!AreObjectsAvailable(m_objs_array, false, pHints, new_objs_array)) {
m_objs_array = new_objs_array;
- return FALSE;
+ return false;
}
m_objs_array.clear();
- return TRUE;
+ return true;
}
CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::CheckLinearizedFirstPage(
@@ -1560,32 +1558,32 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::CheckLinearizedFirstPage(
if (!m_bAnnotsLoad) {
if (!CheckPageAnnots(dwPage, pHints))
return DataNotAvailable;
- m_bAnnotsLoad = TRUE;
+ m_bAnnotsLoad = true;
}
DocAvailStatus nRet = CheckLinearizedData(pHints);
if (nRet == DataAvailable)
- m_bPageLoadedOK = FALSE;
+ m_bPageLoadedOK = false;
return nRet;
}
-FX_BOOL CPDF_DataAvail::HaveResourceAncestor(CPDF_Dictionary* pDict) {
+bool CPDF_DataAvail::HaveResourceAncestor(CPDF_Dictionary* pDict) {
CFX_AutoRestorer<int> restorer(&s_CurrentDataAvailRecursionDepth);
if (++s_CurrentDataAvailRecursionDepth > kMaxDataAvailRecursionDepth)
- return FALSE;
+ return false;
CPDF_Object* pParent = pDict->GetObjectFor("Parent");
if (!pParent)
- return FALSE;
+ return false;
CPDF_Dictionary* pParentDict = pParent->GetDict();
if (!pParentDict)
- return FALSE;
+ return false;
CPDF_Object* pRet = pParentDict->GetObjectFor("Resources");
if (pRet) {
m_pPageResource = pRet;
- return TRUE;
+ return true;
}
return HaveResourceAncestor(pParentDict);
@@ -1598,10 +1596,10 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail(
return DataError;
if (IsFirstCheck(dwPage)) {
- m_bCurPageDictLoadOK = FALSE;
- m_bPageLoadedOK = FALSE;
- m_bAnnotsLoad = FALSE;
- m_bNeedDownLoadResource = FALSE;
+ m_bCurPageDictLoadOK = false;
+ m_bPageLoadedOK = false;
+ m_bAnnotsLoad = false;
+ m_bNeedDownLoadResource = false;
m_objs_array.clear();
m_ObjectSet.clear();
}
@@ -1654,7 +1652,7 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail(
if (m_bHaveAcroForm && !m_bAcroFormLoad) {
if (!CheckAcroFormSubObject(pHints))
return DataNotAvailable;
- m_bAcroFormLoad = TRUE;
+ m_bAcroFormLoad = true;
}
if (!m_bPageLoadedOK) {
@@ -1670,25 +1668,25 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail(
std::vector<CPDF_Object*> obj_array;
obj_array.push_back(m_pPageDict);
- if (!AreObjectsAvailable(obj_array, TRUE, pHints, m_objs_array))
+ if (!AreObjectsAvailable(obj_array, true, pHints, m_objs_array))
return DataNotAvailable;
m_objs_array.clear();
} else {
std::vector<CPDF_Object*> new_objs_array;
- if (!AreObjectsAvailable(m_objs_array, FALSE, pHints, new_objs_array)) {
+ if (!AreObjectsAvailable(m_objs_array, false, pHints, new_objs_array)) {
m_objs_array = new_objs_array;
return DataNotAvailable;
}
}
m_objs_array.clear();
- m_bPageLoadedOK = TRUE;
+ m_bPageLoadedOK = true;
}
if (!m_bAnnotsLoad) {
if (!CheckPageAnnots(dwPage, pHints))
return DataNotAvailable;
- m_bAnnotsLoad = TRUE;
+ m_bAnnotsLoad = true;
}
if (m_pPageDict && !m_bNeedDownLoadResource) {
@@ -1700,35 +1698,35 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail(
if (m_bNeedDownLoadResource) {
if (!CheckResources(pHints))
return DataNotAvailable;
- m_bNeedDownLoadResource = FALSE;
+ m_bNeedDownLoadResource = false;
}
- m_bPageLoadedOK = FALSE;
- m_bAnnotsLoad = FALSE;
- m_bCurPageDictLoadOK = FALSE;
+ m_bPageLoadedOK = false;
+ m_bAnnotsLoad = false;
+ m_bCurPageDictLoadOK = false;
ResetFirstCheck(dwPage);
m_pagesLoadState.insert(dwPage);
return DataAvailable;
}
-FX_BOOL CPDF_DataAvail::CheckResources(DownloadHints* pHints) {
+bool CPDF_DataAvail::CheckResources(DownloadHints* pHints) {
if (m_objs_array.empty()) {
std::vector<CPDF_Object*> obj_array;
obj_array.push_back(m_pPageResource);
- if (!AreObjectsAvailable(obj_array, TRUE, pHints, m_objs_array))
- return FALSE;
+ if (!AreObjectsAvailable(obj_array, true, pHints, m_objs_array))
+ return false;
m_objs_array.clear();
- return TRUE;
+ return true;
}
std::vector<CPDF_Object*> new_objs_array;
- if (!AreObjectsAvailable(m_objs_array, FALSE, pHints, new_objs_array)) {
+ if (!AreObjectsAvailable(m_objs_array, false, pHints, new_objs_array)) {
m_objs_array = new_objs_array;
- return FALSE;
+ return false;
}
m_objs_array.clear();
- return TRUE;
+ return true;
}
void CPDF_DataAvail::GetLinearizedMainXRefInfo(FX_FILESIZE* pPos,
@@ -1805,11 +1803,11 @@ CPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail(
if (m_objs_array.empty())
m_objs_array.push_back(pAcroForm->GetDict());
- m_bLinearizedFormParamLoad = TRUE;
+ m_bLinearizedFormParamLoad = true;
}
std::vector<CPDF_Object*> new_objs_array;
- if (!AreObjectsAvailable(m_objs_array, FALSE, pHints, new_objs_array)) {
+ if (!AreObjectsAvailable(m_objs_array, false, pHints, new_objs_array)) {
m_objs_array = new_objs_array;
return FormNotAvailable;
}
diff --git a/core/fpdfapi/parser/cpdf_data_avail.h b/core/fpdfapi/parser/cpdf_data_avail.h
index 138fe1e3d8..0a8716a498 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.h
+++ b/core/fpdfapi/parser/cpdf_data_avail.h
@@ -83,7 +83,7 @@ class CPDF_DataAvail final {
class FileAvail {
public:
virtual ~FileAvail();
- virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, uint32_t size) = 0;
+ virtual bool IsDataAvail(FX_FILESIZE offset, uint32_t size) = 0;
};
class DownloadHints {
@@ -94,7 +94,7 @@ class CPDF_DataAvail final {
CPDF_DataAvail(FileAvail* pFileAvail,
IFX_SeekableReadStream* pFileRead,
- FX_BOOL bSupportHintTable);
+ bool bSupportHintTable);
~CPDF_DataAvail();
DocAvailStatus IsDocAvail(DownloadHints* pHints);
@@ -102,7 +102,7 @@ class CPDF_DataAvail final {
DocAvailStatus IsPageAvail(uint32_t dwPage, DownloadHints* pHints);
DocFormStatus IsFormAvail(DownloadHints* pHints);
DocLinearizationStatus IsLinearizedPDF();
- FX_BOOL IsLinearized();
+ bool IsLinearized();
void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, uint32_t* pSize);
IFX_SeekableReadStream* GetFileRead() const { return m_pFileRead; }
int GetPageCount() const;
@@ -126,71 +126,71 @@ class CPDF_DataAvail final {
static const int kMaxPageRecursionDepth = 1024;
uint32_t GetObjectSize(uint32_t objnum, FX_FILESIZE& offset);
- FX_BOOL AreObjectsAvailable(std::vector<CPDF_Object*>& obj_array,
- FX_BOOL bParsePage,
- DownloadHints* pHints,
- std::vector<CPDF_Object*>& ret_array);
- FX_BOOL CheckDocStatus(DownloadHints* pHints);
- FX_BOOL CheckHeader(DownloadHints* pHints);
- FX_BOOL CheckFirstPage(DownloadHints* pHints);
- FX_BOOL CheckHintTables(DownloadHints* pHints);
- FX_BOOL CheckEnd(DownloadHints* pHints);
- FX_BOOL CheckCrossRef(DownloadHints* pHints);
- FX_BOOL CheckCrossRefItem(DownloadHints* pHints);
- FX_BOOL CheckTrailer(DownloadHints* pHints);
- FX_BOOL CheckRoot(DownloadHints* pHints);
- FX_BOOL CheckInfo(DownloadHints* pHints);
- FX_BOOL CheckPages(DownloadHints* pHints);
- FX_BOOL CheckPage(DownloadHints* pHints);
- FX_BOOL CheckResources(DownloadHints* pHints);
- FX_BOOL CheckAnnots(DownloadHints* pHints);
- FX_BOOL CheckAcroForm(DownloadHints* pHints);
- FX_BOOL CheckAcroFormSubObject(DownloadHints* pHints);
- FX_BOOL CheckTrailerAppend(DownloadHints* pHints);
- FX_BOOL CheckPageStatus(DownloadHints* pHints);
- FX_BOOL CheckAllCrossRefStream(DownloadHints* pHints);
+ bool AreObjectsAvailable(std::vector<CPDF_Object*>& obj_array,
+ bool bParsePage,
+ DownloadHints* pHints,
+ std::vector<CPDF_Object*>& ret_array);
+ bool CheckDocStatus(DownloadHints* pHints);
+ bool CheckHeader(DownloadHints* pHints);
+ bool CheckFirstPage(DownloadHints* pHints);
+ bool CheckHintTables(DownloadHints* pHints);
+ bool CheckEnd(DownloadHints* pHints);
+ bool CheckCrossRef(DownloadHints* pHints);
+ bool CheckCrossRefItem(DownloadHints* pHints);
+ bool CheckTrailer(DownloadHints* pHints);
+ bool CheckRoot(DownloadHints* pHints);
+ bool CheckInfo(DownloadHints* pHints);
+ bool CheckPages(DownloadHints* pHints);
+ bool CheckPage(DownloadHints* pHints);
+ bool CheckResources(DownloadHints* pHints);
+ bool CheckAnnots(DownloadHints* pHints);
+ bool CheckAcroForm(DownloadHints* pHints);
+ bool CheckAcroFormSubObject(DownloadHints* pHints);
+ bool CheckTrailerAppend(DownloadHints* pHints);
+ bool CheckPageStatus(DownloadHints* pHints);
+ bool CheckAllCrossRefStream(DownloadHints* pHints);
int32_t CheckCrossRefStream(DownloadHints* pHints, FX_FILESIZE& xref_offset);
- FX_BOOL IsLinearizedFile(uint8_t* pData, uint32_t dwLen);
+ bool IsLinearizedFile(uint8_t* pData, uint32_t dwLen);
void SetStartOffset(FX_FILESIZE dwOffset);
- FX_BOOL GetNextToken(CFX_ByteString& token);
- FX_BOOL GetNextChar(uint8_t& ch);
+ bool GetNextToken(CFX_ByteString& token);
+ bool GetNextChar(uint8_t& ch);
CPDF_Object* ParseIndirectObjectAt(
FX_FILESIZE pos,
uint32_t objnum,
CPDF_IndirectObjectHolder* pObjList = nullptr);
CPDF_Object* GetObject(uint32_t objnum,
DownloadHints* pHints,
- FX_BOOL* pExistInFile);
- FX_BOOL GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages);
- FX_BOOL PreparePageItem();
- FX_BOOL LoadPages(DownloadHints* pHints);
- FX_BOOL LoadAllXref(DownloadHints* pHints);
- FX_BOOL LoadAllFile(DownloadHints* pHints);
+ bool* pExistInFile);
+ bool GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages);
+ bool PreparePageItem();
+ bool LoadPages(DownloadHints* pHints);
+ bool LoadAllXref(DownloadHints* pHints);
+ bool LoadAllFile(DownloadHints* pHints);
DocAvailStatus CheckLinearizedData(DownloadHints* pHints);
- FX_BOOL CheckPageAnnots(uint32_t dwPage, DownloadHints* pHints);
+ bool CheckPageAnnots(uint32_t dwPage, DownloadHints* pHints);
DocAvailStatus CheckLinearizedFirstPage(uint32_t dwPage,
DownloadHints* pHints);
- FX_BOOL HaveResourceAncestor(CPDF_Dictionary* pDict);
- FX_BOOL CheckPage(uint32_t dwPage, DownloadHints* pHints);
- FX_BOOL LoadDocPages(DownloadHints* pHints);
- FX_BOOL LoadDocPage(uint32_t dwPage, DownloadHints* pHints);
- FX_BOOL CheckPageNode(PageNode& pageNodes,
- int32_t iPage,
- int32_t& iCount,
- DownloadHints* pHints,
- int level);
- FX_BOOL CheckUnkownPageNode(uint32_t dwPageNo,
- PageNode* pPageNode,
- DownloadHints* pHints);
- FX_BOOL CheckArrayPageNode(uint32_t dwPageNo,
- PageNode* pPageNode,
- DownloadHints* pHints);
- FX_BOOL CheckPageCount(DownloadHints* pHints);
+ bool HaveResourceAncestor(CPDF_Dictionary* pDict);
+ bool CheckPage(uint32_t dwPage, DownloadHints* pHints);
+ bool LoadDocPages(DownloadHints* pHints);
+ bool LoadDocPage(uint32_t dwPage, DownloadHints* pHints);
+ bool CheckPageNode(PageNode& pageNodes,
+ int32_t iPage,
+ int32_t& iCount,
+ DownloadHints* pHints,
+ int level);
+ bool CheckUnkownPageNode(uint32_t dwPageNo,
+ PageNode* pPageNode,
+ DownloadHints* pHints);
+ bool CheckArrayPageNode(uint32_t dwPageNo,
+ PageNode* pPageNode,
+ DownloadHints* pHints);
+ bool CheckPageCount(DownloadHints* pHints);
bool IsFirstCheck(uint32_t dwPage);
void ResetFirstCheck(uint32_t dwPage);
- FX_BOOL IsDataAvail(FX_FILESIZE offset, uint32_t size, DownloadHints* pHints);
+ bool IsDataAvail(FX_FILESIZE offset, uint32_t size, DownloadHints* pHints);
FileAvail* const m_pFileAvail;
IFX_SeekableReadStream* const m_pFileRead;
@@ -201,7 +201,7 @@ class CPDF_DataAvail final {
uint32_t m_dwInfoObjNum;
CPDF_Object* m_pLinearized;
CPDF_Object* m_pTrailer;
- FX_BOOL m_bDocAvail;
+ bool m_bDocAvail;
FX_FILESIZE m_dwHeaderOffset;
FX_FILESIZE m_dwLastXRefOffset;
FX_FILESIZE m_dwXRefOffset;
@@ -220,36 +220,36 @@ class CPDF_DataAvail final {
CFX_ArrayTemplate<uint32_t> m_XRefStreamList;
CFX_ArrayTemplate<uint32_t> m_PageObjList;
uint32_t m_PagesObjNum;
- FX_BOOL m_bLinearized;
+ bool m_bLinearized;
uint32_t m_dwFirstPageNo;
- FX_BOOL m_bLinearedDataOK;
- FX_BOOL m_bMainXRefLoadTried;
- FX_BOOL m_bMainXRefLoadedOK;
- FX_BOOL m_bPagesTreeLoad;
- FX_BOOL m_bPagesLoad;
+ bool m_bLinearedDataOK;
+ bool m_bMainXRefLoadTried;
+ bool m_bMainXRefLoadedOK;
+ bool m_bPagesTreeLoad;
+ bool m_bPagesLoad;
CPDF_Parser* m_pCurrentParser;
FX_FILESIZE m_dwCurrentXRefSteam;
- FX_BOOL m_bAnnotsLoad;
- FX_BOOL m_bHaveAcroForm;
+ bool m_bAnnotsLoad;
+ bool m_bHaveAcroForm;
uint32_t m_dwAcroFormObjNum;
- FX_BOOL m_bAcroFormLoad;
+ bool m_bAcroFormLoad;
CPDF_Object* m_pAcroForm;
std::vector<CPDF_Object*> m_arrayAcroforms;
CPDF_Dictionary* m_pPageDict;
CPDF_Object* m_pPageResource;
- FX_BOOL m_bNeedDownLoadResource;
- FX_BOOL m_bPageLoadedOK;
- FX_BOOL m_bLinearizedFormParamLoad;
+ bool m_bNeedDownLoadResource;
+ bool m_bPageLoadedOK;
+ bool m_bLinearizedFormParamLoad;
std::vector<CPDF_Object*> m_PagesArray;
uint32_t m_dwEncryptObjNum;
FX_FILESIZE m_dwPrevXRefOffset;
- FX_BOOL m_bTotalLoadPageTree;
- FX_BOOL m_bCurPageDictLoadOK;
+ bool m_bTotalLoadPageTree;
+ bool m_bCurPageDictLoadOK;
PageNode m_pageNodes;
std::set<uint32_t> m_pageMapCheckState;
std::set<uint32_t> m_pagesLoadState;
std::unique_ptr<CPDF_HintTables> m_pHintTables;
- FX_BOOL m_bSupportHintTable;
+ bool m_bSupportHintTable;
};
#endif // CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_
diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp
index aab7422b3c..75cb1e859c 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/parser/cpdf_dictionary.cpp
@@ -242,7 +242,7 @@ void CPDF_Dictionary::SetNameFor(const CFX_ByteString& key,
void CPDF_Dictionary::SetStringFor(const CFX_ByteString& key,
const CFX_ByteString& str) {
- SetFor(key, new CPDF_String(MaybeIntern(str), FALSE));
+ SetFor(key, new CPDF_String(MaybeIntern(str), false));
}
void CPDF_Dictionary::SetReferenceFor(const CFX_ByteString& key,
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index c5f64a790c..1794288e62 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -244,7 +244,7 @@ int InsertDeletePDFPage(CPDF_Document* pDoc,
CPDF_Dictionary* pPages,
int nPagesToGo,
CPDF_Dictionary* pPage,
- FX_BOOL bInsert,
+ bool bInsert,
std::set<CPDF_Dictionary*>* pVisited) {
CPDF_Array* pKidList = pPages->GetArrayFor("Kids");
if (!pKidList)
@@ -310,7 +310,7 @@ int InsertNewPage(CPDF_Document* pDoc,
pPageDict->SetReferenceFor("Parent", pDoc, pPages->GetObjNum());
} else {
std::set<CPDF_Dictionary*> stack = {pPages};
- if (InsertDeletePDFPage(pDoc, pPages, iPage, pPageDict, TRUE, &stack) < 0)
+ if (InsertDeletePDFPage(pDoc, pPages, iPage, pPageDict, true, &stack) < 0)
return -1;
}
pageList.InsertAt(iPage, pPageDict->GetObjNum());
@@ -727,7 +727,7 @@ void CPDF_Document::DeletePage(int iPage) {
return;
std::set<CPDF_Dictionary*> stack = {pPages};
- if (InsertDeletePDFPage(this, pPages, iPage, nullptr, FALSE, &stack) < 0)
+ if (InsertDeletePDFPage(this, pPages, iPage, nullptr, false, &stack) < 0)
return;
m_PageList.RemoveAt(iPage);
@@ -769,7 +769,7 @@ size_t CPDF_Document::CalculateEncodingDict(int charset,
CPDF_Dictionary* CPDF_Document::ProcessbCJK(
CPDF_Dictionary* pBaseDict,
int charset,
- FX_BOOL bVert,
+ bool bVert,
CFX_ByteString basefont,
std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert) {
CPDF_Dictionary* pFontDict = new CPDF_Dictionary(m_pByteStringPool);
@@ -833,7 +833,7 @@ CPDF_Dictionary* CPDF_Document::ProcessbCJK(
return pFontDict;
}
-CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) {
+CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert) {
if (!pFont)
return nullptr;
@@ -923,8 +923,8 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTW* pLogFont,
- FX_BOOL bVert,
- FX_BOOL bTranslateName) {
+ bool bVert,
+ bool bTranslateName) {
LOGFONTA lfa;
FXSYS_memcpy(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa);
CFX_ByteString face = CFX_ByteString::FromUnicode(pLogFont->lfFaceName);
@@ -936,8 +936,8 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTW* pLogFont,
}
CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont,
- FX_BOOL bVert,
- FX_BOOL bTranslateName) {
+ bool bVert,
+ bool bTranslateName) {
pLogFont->lfHeight = -1000;
pLogFont->lfWidth = 0;
HGDIOBJ hFont = CreateFontIndirectA(pLogFont);
diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h
index ea7bd328aa..d8e5cb977e 100644
--- a/core/fpdfapi/parser/cpdf_document.h
+++ b/core/fpdfapi/parser/cpdf_document.h
@@ -92,14 +92,14 @@ class CPDF_Document : public CPDF_IndirectObjectHolder {
CPDF_Dictionary* CreateNewPage(int iPage);
CPDF_Font* AddStandardFont(const FX_CHAR* font, CPDF_FontEncoding* pEncoding);
- CPDF_Font* AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert);
+ CPDF_Font* AddFont(CFX_Font* pFont, int charset, bool bVert);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont,
- FX_BOOL bVert,
- FX_BOOL bTranslateName = FALSE);
+ bool bVert,
+ bool bTranslateName = false);
CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont,
- FX_BOOL bVert,
- FX_BOOL bTranslateName = FALSE);
+ bool bVert,
+ bool bTranslateName = false);
#endif
protected:
@@ -121,7 +121,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder {
CPDF_Dictionary* ProcessbCJK(
CPDF_Dictionary* pBaseDict,
int charset,
- FX_BOOL bVert,
+ bool bVert,
CFX_ByteString basefont,
std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert);
diff --git a/core/fpdfapi/parser/cpdf_object.cpp b/core/fpdfapi/parser/cpdf_object.cpp
index 5c407336e2..cc410d10c8 100644
--- a/core/fpdfapi/parser/cpdf_object.cpp
+++ b/core/fpdfapi/parser/cpdf_object.cpp
@@ -63,7 +63,7 @@ CPDF_Dictionary* CPDF_Object::GetDict() const {
}
void CPDF_Object::SetString(const CFX_ByteString& str) {
- ASSERT(FALSE);
+ ASSERT(false);
}
bool CPDF_Object::IsArray() const {
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index c2748882cf..cff0f77b32 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -144,7 +144,7 @@ CPDF_Parser::Error CPDF_Parser::StartParse(IFX_SeekableReadStream* pFileAccess,
ASSERT(!m_bHasParsed);
m_bHasParsed = true;
- m_bXRefStream = FALSE;
+ m_bXRefStream = false;
m_LastXRefOffset = 0;
m_bOwnFileRead = true;
@@ -173,8 +173,8 @@ CPDF_Parser::Error CPDF_Parser::StartParse(IFX_SeekableReadStream* pFileAccess,
m_pSyntax->RestorePos(m_pSyntax->m_FileLen - m_pSyntax->m_HeaderOffset - 9);
m_pDocument = pDocument;
- FX_BOOL bXRefRebuilt = FALSE;
- if (m_pSyntax->SearchWord("startxref", TRUE, FALSE, 4096)) {
+ bool bXRefRebuilt = false;
+ if (m_pSyntax->SearchWord("startxref", true, false, 4096)) {
m_SortedOffset.insert(m_pSyntax->SavePos());
m_pSyntax->GetKeyword();
@@ -189,14 +189,14 @@ CPDF_Parser::Error CPDF_Parser::StartParse(IFX_SeekableReadStream* pFileAccess,
if (!RebuildCrossRef())
return FORMAT_ERROR;
- bXRefRebuilt = TRUE;
+ bXRefRebuilt = true;
m_LastXRefOffset = 0;
}
} else {
if (!RebuildCrossRef())
return FORMAT_ERROR;
- bXRefRebuilt = TRUE;
+ bXRefRebuilt = true;
}
Error eRet = SetEncryptHandler();
if (eRet != SUCCESS)
@@ -323,13 +323,13 @@ bool CPDF_Parser::VerifyCrossRefV4() {
return true;
}
-FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) {
- if (!LoadCrossRefV4(xrefpos, 0, TRUE))
- return FALSE;
+bool CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) {
+ if (!LoadCrossRefV4(xrefpos, 0, true))
+ return false;
m_pTrailer = LoadTrailerV4();
if (!m_pTrailer)
- return FALSE;
+ return false;
int32_t xrefsize = GetDirectInteger(m_pTrailer, "Size");
if (xrefsize > 0 && xrefsize <= kMaxXRefSize)
@@ -349,18 +349,18 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) {
while (xrefpos) {
// Check for circular references.
if (pdfium::ContainsKey(seen_xrefpos, xrefpos))
- return FALSE;
+ return false;
seen_xrefpos.insert(xrefpos);
// SLOW ...
CrossRefList.insert(CrossRefList.begin(), xrefpos);
- LoadCrossRefV4(xrefpos, 0, TRUE);
+ LoadCrossRefV4(xrefpos, 0, true);
std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict(
LoadTrailerV4());
if (!pDict)
- return FALSE;
+ return false;
xrefpos = GetDirectInteger(pDict.get(), "Prev");
@@ -371,26 +371,26 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) {
}
for (size_t i = 0; i < CrossRefList.size(); ++i) {
- if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], FALSE))
- return FALSE;
+ if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], false))
+ return false;
if (i == 0 && !VerifyCrossRefV4())
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos,
- uint32_t dwObjCount) {
+bool CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos,
+ uint32_t dwObjCount) {
if (!LoadLinearizedCrossRefV4(xrefpos, dwObjCount))
- return FALSE;
+ return false;
m_pTrailer = LoadTrailerV4();
if (!m_pTrailer)
- return FALSE;
+ return false;
int32_t xrefsize = GetDirectInteger(m_pTrailer, "Size");
if (xrefsize == 0)
- return FALSE;
+ return false;
std::vector<FX_FILESIZE> CrossRefList;
std::vector<FX_FILESIZE> XRefStreamList;
@@ -404,18 +404,18 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos,
while (xrefpos) {
// Check for circular references.
if (pdfium::ContainsKey(seen_xrefpos, xrefpos))
- return FALSE;
+ return false;
seen_xrefpos.insert(xrefpos);
// SLOW ...
CrossRefList.insert(CrossRefList.begin(), xrefpos);
- LoadCrossRefV4(xrefpos, 0, TRUE);
+ LoadCrossRefV4(xrefpos, 0, true);
std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict(
LoadTrailerV4());
if (!pDict)
- return FALSE;
+ return false;
xrefpos = GetDirectInteger(pDict.get(), "Prev");
@@ -426,14 +426,14 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos,
}
for (size_t i = 1; i < CrossRefList.size(); ++i) {
- if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], FALSE))
- return FALSE;
+ if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], false))
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos,
- uint32_t dwObjCount) {
+bool CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos,
+ uint32_t dwObjCount) {
FX_FILESIZE dwStartPos = pos - m_pSyntax->m_HeaderOffset;
m_pSyntax->RestorePos(dwStartPos);
@@ -452,11 +452,11 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos,
int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024;
uint32_t dwReadSize = block_size * recordsize;
if ((FX_FILESIZE)(dwStartPos + dwReadSize) > m_pSyntax->m_FileLen)
- return FALSE;
+ return false;
if (!m_pSyntax->ReadBlock(reinterpret_cast<uint8_t*>(buf.data()),
dwReadSize)) {
- return FALSE;
+ return false;
}
for (int32_t i = 0; i < block_size; i++) {
@@ -470,7 +470,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos,
if (offset == 0) {
for (int32_t c = 0; c < 10; c++) {
if (!std::isdigit(pEntry[c]))
- return FALSE;
+ return false;
}
}
@@ -488,12 +488,12 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos,
}
}
m_pSyntax->RestorePos(SavedPos + count * recordsize);
- return TRUE;
+ return true;
}
bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos,
FX_FILESIZE streampos,
- FX_BOOL bSkip) {
+ bool bSkip) {
m_pSyntax->RestorePos(pos);
if (m_pSyntax->GetKeyword() != "xref")
return false;
@@ -565,29 +565,29 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos,
}
m_pSyntax->RestorePos(SavedPos + count * recordsize);
}
- return !streampos || LoadCrossRefV5(&streampos, FALSE);
+ return !streampos || LoadCrossRefV5(&streampos, false);
}
-FX_BOOL CPDF_Parser::LoadAllCrossRefV5(FX_FILESIZE xrefpos) {
- if (!LoadCrossRefV5(&xrefpos, TRUE))
- return FALSE;
+bool CPDF_Parser::LoadAllCrossRefV5(FX_FILESIZE xrefpos) {
+ if (!LoadCrossRefV5(&xrefpos, true))
+ return false;
std::set<FX_FILESIZE> seen_xrefpos;
while (xrefpos) {
seen_xrefpos.insert(xrefpos);
- if (!LoadCrossRefV5(&xrefpos, FALSE))
- return FALSE;
+ if (!LoadCrossRefV5(&xrefpos, false))
+ return false;
// Check for circular references.
if (pdfium::ContainsKey(seen_xrefpos, xrefpos))
- return FALSE;
+ return false;
}
m_ObjectStreamMap.clear();
- m_bXRefStream = TRUE;
- return TRUE;
+ m_bXRefStream = true;
+ return true;
}
-FX_BOOL CPDF_Parser::RebuildCrossRef() {
+bool CPDF_Parser::RebuildCrossRef() {
m_ObjectInfo.clear();
m_SortedOffset.clear();
if (m_pTrailer) {
@@ -954,35 +954,35 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
return m_pTrailer && !m_ObjectInfo.empty();
}
-FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
+bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, bool bMainXRef) {
std::unique_ptr<CPDF_Object> pObject(
ParseIndirectObjectAt(m_pDocument, *pos, 0));
if (!pObject)
- return FALSE;
+ return false;
CPDF_Object* pUnownedObject = pObject.get();
if (m_pDocument) {
CPDF_Dictionary* pRootDict = m_pDocument->GetRoot();
if (pRootDict && pRootDict->GetObjNum() == pObject->m_ObjNum)
- return FALSE;
+ return false;
// Takes ownership of object (std::move someday).
uint32_t objnum = pObject->m_ObjNum;
if (!m_pDocument->ReplaceIndirectObjectIfHigherGeneration(
objnum, pObject.release())) {
- return FALSE;
+ return false;
}
}
CPDF_Stream* pStream = pUnownedObject->AsStream();
if (!pStream)
- return FALSE;
+ return false;
CPDF_Dictionary* pDict = pStream->GetDict();
*pos = pDict->GetIntegerFor("Prev");
int32_t size = pDict->GetIntegerFor("Size");
if (size < 0)
- return FALSE;
+ return false;
CPDF_Dictionary* pNewTrailer = ToDictionary(pDict->Clone());
if (bMainXRef) {
@@ -1015,7 +1015,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
pArray = pDict->GetArrayFor("W");
if (!pArray)
- return FALSE;
+ return false;
CFX_ArrayTemplate<uint32_t> WidthArray;
FX_SAFE_UINT32 dwAccWidth = 0;
@@ -1025,7 +1025,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
}
if (!dwAccWidth.IsValid() || WidthArray.GetSize() < 3)
- return FALSE;
+ return false;
uint32_t totalWidth = dwAccWidth.ValueOrDie();
CPDF_StreamAcc acc;
@@ -1086,14 +1086,14 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
m_SortedOffset.insert(offset);
} else {
if (offset < 0 || !IsValidObjectNumber(offset))
- return FALSE;
+ return false;
m_ObjectInfo[offset].type = 255;
}
}
}
segindex += count;
}
- return TRUE;
+ return true;
}
CPDF_Array* CPDF_Parser::GetIDArray() {
@@ -1145,7 +1145,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(
return nullptr;
ScopedFileStream file(FX_CreateMemoryStream(
- (uint8_t*)pObjStream->GetData(), (size_t)pObjStream->GetSize(), FALSE));
+ (uint8_t*)pObjStream->GetData(), (size_t)pObjStream->GetSize(), false));
CPDF_SyntaxParser syntax;
syntax.InitParser(file.get(), 0);
const int32_t offset = GetStreamFirst(pObjStream);
@@ -1224,7 +1224,7 @@ void CPDF_Parser::GetIndirectBinary(uint32_t objnum,
const uint8_t* pData = pObjStream->GetData();
uint32_t totalsize = pObjStream->GetSize();
ScopedFileStream file(
- FX_CreateMemoryStream((uint8_t*)pData, (size_t)totalsize, FALSE));
+ FX_CreateMemoryStream((uint8_t*)pData, (size_t)totalsize, false));
CPDF_SyntaxParser syntax;
syntax.InitParser(file.get(), 0);
@@ -1290,16 +1290,16 @@ void CPDF_Parser::GetIndirectBinary(uint32_t objnum,
}
FX_FILESIZE nextoff = *it;
- FX_BOOL bNextOffValid = FALSE;
+ bool bNextOffValid = false;
if (nextoff != pos) {
m_pSyntax->RestorePos(nextoff);
word = m_pSyntax->GetNextWord(&bIsNumber);
if (word == "xref") {
- bNextOffValid = TRUE;
+ bNextOffValid = true;
} else if (bIsNumber) {
word = m_pSyntax->GetNextWord(&bIsNumber);
if (bIsNumber && m_pSyntax->GetKeyword() == "obj") {
- bNextOffValid = TRUE;
+ bNextOffValid = true;
}
}
}
@@ -1438,8 +1438,8 @@ uint32_t CPDF_Parser::GetPermissions() const {
return dwPermission;
}
-FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_SeekableReadStream* pFileAccess,
- uint32_t offset) {
+bool CPDF_Parser::IsLinearizedFile(IFX_SeekableReadStream* pFileAccess,
+ uint32_t offset) {
m_pSyntax->InitParser(pFileAccess, offset);
m_pSyntax->RestorePos(m_pSyntax->m_HeaderOffset + 9);
@@ -1447,22 +1447,22 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_SeekableReadStream* pFileAccess,
bool bIsNumber;
CFX_ByteString word = m_pSyntax->GetNextWord(&bIsNumber);
if (!bIsNumber)
- return FALSE;
+ return false;
uint32_t objnum = FXSYS_atoui(word.c_str());
word = m_pSyntax->GetNextWord(&bIsNumber);
if (!bIsNumber)
- return FALSE;
+ return false;
uint32_t gennum = FXSYS_atoui(word.c_str());
if (m_pSyntax->GetKeyword() != "obj") {
m_pSyntax->RestorePos(SavedPos);
- return FALSE;
+ return false;
}
m_pLinearized = m_pSyntax->GetObject(nullptr, objnum, gennum, true);
if (!m_pLinearized)
- return FALSE;
+ return false;
CPDF_Dictionary* pDict = m_pLinearized->GetDict();
if (pDict && pDict->GetObjectFor("Linearized")) {
@@ -1472,11 +1472,11 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_SeekableReadStream* pFileAccess,
if (!pLen) {
m_pLinearized->Release();
m_pLinearized = nullptr;
- return FALSE;
+ return false;
}
if (pLen->GetInteger() != (int)pFileAccess->GetSize())
- return FALSE;
+ return false;
if (CPDF_Number* pNo = ToNumber(pDict->GetObjectFor("P")))
m_dwFirstPageNo = pNo->GetInteger();
@@ -1484,11 +1484,11 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_SeekableReadStream* pFileAccess,
if (CPDF_Number* pTable = ToNumber(pDict->GetObjectFor("T")))
m_LastXRefOffset = pTable->GetInteger();
- return TRUE;
+ return true;
}
m_pLinearized->Release();
m_pLinearized = nullptr;
- return FALSE;
+ return false;
}
CPDF_Parser::Error CPDF_Parser::StartLinearizedParse(
@@ -1496,7 +1496,7 @@ CPDF_Parser::Error CPDF_Parser::StartLinearizedParse(
CPDF_Document* pDocument) {
ASSERT(!m_bHasParsed);
- m_bXRefStream = FALSE;
+ m_bXRefStream = false;
m_LastXRefOffset = 0;
m_bOwnFileRead = true;
@@ -1513,13 +1513,13 @@ CPDF_Parser::Error CPDF_Parser::StartLinearizedParse(
FX_FILESIZE dwFirstXRefOffset = m_pSyntax->SavePos();
- FX_BOOL bXRefRebuilt = FALSE;
- FX_BOOL bLoadV4 = LoadCrossRefV4(dwFirstXRefOffset, 0, FALSE);
- if (!bLoadV4 && !LoadCrossRefV5(&dwFirstXRefOffset, TRUE)) {
+ bool bXRefRebuilt = false;
+ bool bLoadV4 = LoadCrossRefV4(dwFirstXRefOffset, 0, false);
+ if (!bLoadV4 && !LoadCrossRefV5(&dwFirstXRefOffset, true)) {
if (!RebuildCrossRef())
return FORMAT_ERROR;
- bXRefRebuilt = TRUE;
+ bXRefRebuilt = true;
m_LastXRefOffset = 0;
}
@@ -1573,23 +1573,23 @@ CPDF_Parser::Error CPDF_Parser::StartLinearizedParse(
return SUCCESS;
}
-FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV5(FX_FILESIZE xrefpos) {
- if (!LoadCrossRefV5(&xrefpos, FALSE))
- return FALSE;
+bool CPDF_Parser::LoadLinearizedAllCrossRefV5(FX_FILESIZE xrefpos) {
+ if (!LoadCrossRefV5(&xrefpos, false))
+ return false;
std::set<FX_FILESIZE> seen_xrefpos;
while (xrefpos) {
seen_xrefpos.insert(xrefpos);
- if (!LoadCrossRefV5(&xrefpos, FALSE))
- return FALSE;
+ if (!LoadCrossRefV5(&xrefpos, false))
+ return false;
// Check for circular references.
if (pdfium::ContainsKey(seen_xrefpos, xrefpos))
- return FALSE;
+ return false;
}
m_ObjectStreamMap.clear();
- m_bXRefStream = TRUE;
- return TRUE;
+ m_bXRefStream = true;
+ return true;
}
CPDF_Parser::Error CPDF_Parser::LoadLinearizedMainXRefTable() {
diff --git a/core/fpdfapi/parser/cpdf_parser.h b/core/fpdfapi/parser/cpdf_parser.h
index 887857628a..3be157a1a2 100644
--- a/core/fpdfapi/parser/cpdf_parser.h
+++ b/core/fpdfapi/parser/cpdf_parser.h
@@ -76,7 +76,7 @@ class CPDF_Parser {
void GetIndirectBinary(uint32_t objnum, uint8_t*& pBuffer, uint32_t& size);
int GetFileVersion() const { return m_FileVersion; }
- FX_BOOL IsXRefStream() const { return m_bXRefStream; }
+ bool IsXRefStream() const { return m_bXRefStream; }
CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjectHolder* pObjList,
FX_FILESIZE pos,
@@ -102,8 +102,8 @@ class CPDF_Parser {
std::unique_ptr<CPDF_SyntaxParser> m_pSyntax;
std::map<uint32_t, ObjectInfo> m_ObjectInfo;
- bool LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_BOOL bSkip);
- FX_BOOL RebuildCrossRef();
+ bool LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, bool bSkip);
+ bool RebuildCrossRef();
private:
friend class CPDF_DataAvail;
@@ -126,19 +126,18 @@ class CPDF_Parser {
};
CPDF_Object* ParseDirect(CPDF_Object* pObj);
- FX_BOOL LoadAllCrossRefV4(FX_FILESIZE pos);
- FX_BOOL LoadAllCrossRefV5(FX_FILESIZE pos);
- FX_BOOL LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef);
+ bool LoadAllCrossRefV4(FX_FILESIZE pos);
+ bool LoadAllCrossRefV5(FX_FILESIZE pos);
+ bool LoadCrossRefV5(FX_FILESIZE* pos, bool bMainXRef);
CPDF_Dictionary* LoadTrailerV4();
Error SetEncryptHandler();
void ReleaseEncryptHandler();
- FX_BOOL LoadLinearizedAllCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount);
- FX_BOOL LoadLinearizedCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount);
- FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos);
+ bool LoadLinearizedAllCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount);
+ bool LoadLinearizedCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount);
+ bool LoadLinearizedAllCrossRefV5(FX_FILESIZE pos);
Error LoadLinearizedMainXRefTable();
CPDF_StreamAcc* GetObjectStream(uint32_t number);
- FX_BOOL IsLinearizedFile(IFX_SeekableReadStream* pFileAccess,
- uint32_t offset);
+ bool IsLinearizedFile(IFX_SeekableReadStream* pFileAccess, uint32_t offset);
void SetEncryptDictionary(CPDF_Dictionary* pDict);
void ShrinkObjectMap(uint32_t size);
// A simple check whether the cross reference table matches with
@@ -152,7 +151,7 @@ class CPDF_Parser {
CPDF_Dictionary* m_pTrailer;
CPDF_Dictionary* m_pEncryptDict;
FX_FILESIZE m_LastXRefOffset;
- FX_BOOL m_bXRefStream;
+ bool m_bXRefStream;
std::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler;
CFX_ByteString m_Password;
std::set<FX_FILESIZE> m_SortedOffset;
diff --git a/core/fpdfapi/parser/cpdf_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_parser_unittest.cpp
index 239332784e..7148c54f30 100644
--- a/core/fpdfapi/parser/cpdf_parser_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_parser_unittest.cpp
@@ -115,7 +115,7 @@ TEST(cpdf_parser, LoadCrossRefV4) {
ASSERT_TRUE(
parser.InitTestFromBuffer(xref_table, FX_ArraySize(xref_table)));
- ASSERT_TRUE(parser.LoadCrossRefV4(0, 0, FALSE));
+ ASSERT_TRUE(parser.LoadCrossRefV4(0, 0, false));
const FX_FILESIZE offsets[] = {0, 17, 81, 0, 331, 409};
const uint8_t types[] = {0, 1, 1, 0, 1, 1};
for (size_t i = 0; i < FX_ArraySize(offsets); ++i) {
@@ -140,7 +140,7 @@ TEST(cpdf_parser, LoadCrossRefV4) {
ASSERT_TRUE(
parser.InitTestFromBuffer(xref_table, FX_ArraySize(xref_table)));
- ASSERT_TRUE(parser.LoadCrossRefV4(0, 0, FALSE));
+ ASSERT_TRUE(parser.LoadCrossRefV4(0, 0, false));
const FX_FILESIZE offsets[] = {0, 0, 0, 25325, 0, 0, 0,
0, 25518, 25635, 0, 0, 25777};
const uint8_t types[] = {0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1};
@@ -166,7 +166,7 @@ TEST(cpdf_parser, LoadCrossRefV4) {
ASSERT_TRUE(
parser.InitTestFromBuffer(xref_table, FX_ArraySize(xref_table)));
- ASSERT_TRUE(parser.LoadCrossRefV4(0, 0, FALSE));
+ ASSERT_TRUE(parser.LoadCrossRefV4(0, 0, false));
const FX_FILESIZE offsets[] = {0, 0, 0, 25325, 0, 0, 0,
0, 0, 25635, 0, 0, 25777};
const uint8_t types[] = {0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1};
@@ -191,7 +191,7 @@ TEST(cpdf_parser, LoadCrossRefV4) {
ASSERT_TRUE(
parser.InitTestFromBuffer(xref_table, FX_ArraySize(xref_table)));
- ASSERT_TRUE(parser.LoadCrossRefV4(0, 0, FALSE));
+ ASSERT_TRUE(parser.LoadCrossRefV4(0, 0, false));
const FX_FILESIZE offsets[] = {0, 23, 0, 0, 0, 45, 179};
const uint8_t types[] = {0, 1, 0, 0, 0, 1, 1};
for (size_t i = 0; i < FX_ArraySize(offsets); ++i) {
diff --git a/core/fpdfapi/parser/cpdf_security_handler.cpp b/core/fpdfapi/parser/cpdf_security_handler.cpp
index 80a1f08f94..bebda4ded8 100644
--- a/core/fpdfapi/parser/cpdf_security_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_security_handler.cpp
@@ -27,7 +27,7 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
uint32_t pass_size,
uint8_t* key,
int keylen,
- FX_BOOL bIgnoreMeta,
+ bool bIgnoreMeta,
CPDF_Array* pIdArray) {
int revision = pEncrypt->GetIntegerFor("R");
uint8_t passcode[32];
@@ -83,27 +83,27 @@ CPDF_CryptoHandler* CPDF_SecurityHandler::CreateCryptoHandler() {
return new CPDF_CryptoHandler;
}
-FX_BOOL CPDF_SecurityHandler::OnInit(CPDF_Parser* pParser,
- CPDF_Dictionary* pEncryptDict) {
+bool CPDF_SecurityHandler::OnInit(CPDF_Parser* pParser,
+ CPDF_Dictionary* pEncryptDict) {
m_pParser = pParser;
if (!LoadDict(pEncryptDict)) {
- return FALSE;
+ return false;
}
if (m_Cipher == FXCIPHER_NONE) {
- return TRUE;
+ return true;
}
return CheckSecurity(m_KeyLen);
}
-FX_BOOL CPDF_SecurityHandler::CheckSecurity(int32_t key_len) {
+bool CPDF_SecurityHandler::CheckSecurity(int32_t key_len) {
CFX_ByteString password = m_pParser->GetPassword();
if (!password.IsEmpty() &&
- CheckPassword(password.raw_str(), password.GetLength(), TRUE,
+ CheckPassword(password.raw_str(), password.GetLength(), true,
m_EncryptKey, key_len)) {
m_bOwnerUnlocked = true;
- return TRUE;
+ return true;
}
- return CheckPassword(password.raw_str(), password.GetLength(), FALSE,
+ return CheckPassword(password.raw_str(), password.GetLength(), false,
m_EncryptKey, key_len);
}
@@ -111,24 +111,24 @@ uint32_t CPDF_SecurityHandler::GetPermissions() {
return m_bOwnerUnlocked ? 0xFFFFFFFF : m_Permissions;
}
-static FX_BOOL LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
- const CFX_ByteString& name,
- int& cipher,
- int& keylen) {
+static bool LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
+ const CFX_ByteString& name,
+ int& cipher,
+ int& keylen) {
int Version = pEncryptDict->GetIntegerFor("V");
cipher = FXCIPHER_RC4;
keylen = 0;
if (Version >= 4) {
CPDF_Dictionary* pCryptFilters = pEncryptDict->GetDictFor("CF");
if (!pCryptFilters) {
- return FALSE;
+ return false;
}
if (name == "Identity") {
cipher = FXCIPHER_NONE;
} else {
CPDF_Dictionary* pDefFilter = pCryptFilters->GetDictFor(name);
if (!pDefFilter) {
- return FALSE;
+ return false;
}
int nKeyBits = 0;
if (Version == 4) {
@@ -152,12 +152,12 @@ static FX_BOOL LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
keylen = Version > 1 ? pEncryptDict->GetIntegerFor("Length", 40) / 8 : 5;
}
if (keylen > 32 || keylen < 0) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) {
+bool CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) {
m_pEncryptDict = pEncryptDict;
m_Version = pEncryptDict->GetIntegerFor("V");
m_Revision = pEncryptDict->GetIntegerFor("R");
@@ -168,15 +168,15 @@ FX_BOOL CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) {
CFX_ByteString stmf_name = pEncryptDict->GetStringFor("StmF");
CFX_ByteString strf_name = pEncryptDict->GetStringFor("StrF");
if (stmf_name != strf_name)
- return FALSE;
+ return false;
return LoadCryptInfo(pEncryptDict, strf_name, m_Cipher, m_KeyLen);
}
-FX_BOOL CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict,
- uint32_t type,
- int& cipher,
- int& key_len) {
+bool CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict,
+ uint32_t type,
+ int& cipher,
+ int& key_len) {
m_pEncryptDict = pEncryptDict;
m_Version = pEncryptDict->GetIntegerFor("V");
m_Revision = pEncryptDict->GetIntegerFor("R");
@@ -188,23 +188,23 @@ FX_BOOL CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict,
stmf_name = pEncryptDict->GetStringFor("StmF");
strf_name = pEncryptDict->GetStringFor("StrF");
if (stmf_name != strf_name)
- return FALSE;
+ return false;
}
if (!LoadCryptInfo(pEncryptDict, strf_name, cipher, key_len))
- return FALSE;
+ return false;
m_Cipher = cipher;
m_KeyLen = key_len;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_SecurityHandler::GetCryptInfo(int& cipher,
- const uint8_t*& buffer,
- int& keylen) {
+bool CPDF_SecurityHandler::GetCryptInfo(int& cipher,
+ const uint8_t*& buffer,
+ int& keylen) {
cipher = m_Cipher;
buffer = m_EncryptKey;
keylen = m_KeyLen;
- return TRUE;
+ return true;
}
#define FX_GET_32WORD(n, b, i) \
{ \
@@ -263,7 +263,7 @@ void Revision6_Hash(const uint8_t* password,
content.AppendBlock(vector, 48);
}
}
- CRYPT_AESSetKey(aes, 16, key, 16, TRUE);
+ CRYPT_AESSetKey(aes, 16, key, 16, true);
CRYPT_AESSetIV(aes, iv);
CRYPT_AESEncrypt(aes, E, content.GetBuffer(), iBufLen);
int iHash = 0;
@@ -299,19 +299,19 @@ void Revision6_Hash(const uint8_t* password,
FXSYS_memcpy(hash, input, 32);
}
}
-FX_BOOL CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
- uint32_t size,
- FX_BOOL bOwner,
- uint8_t* key) {
+bool CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
+ uint32_t size,
+ bool bOwner,
+ uint8_t* key) {
CFX_ByteString okey =
m_pEncryptDict ? m_pEncryptDict->GetStringFor("O") : CFX_ByteString();
if (okey.GetLength() < 48) {
- return FALSE;
+ return false;
}
CFX_ByteString ukey =
m_pEncryptDict ? m_pEncryptDict->GetStringFor("U") : CFX_ByteString();
if (ukey.GetLength() < 48) {
- return FALSE;
+ return false;
}
const uint8_t* pkey = (bOwner ? okey : ukey).raw_str();
uint8_t sha[128];
@@ -329,10 +329,10 @@ FX_BOOL CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
CRYPT_SHA256Finish(sha, digest);
}
if (FXSYS_memcmp(digest, pkey, 32) != 0) {
- return FALSE;
+ return false;
}
if (!key) {
- return TRUE;
+ return true;
}
if (m_Revision >= 6) {
Revision6_Hash(password, size, (const uint8_t*)pkey + 40,
@@ -350,19 +350,19 @@ FX_BOOL CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
? m_pEncryptDict->GetStringFor(bOwner ? "OE" : "UE")
: CFX_ByteString();
if (ekey.GetLength() < 32)
- return FALSE;
+ return false;
std::vector<uint8_t> aes(2048);
- CRYPT_AESSetKey(aes.data(), 16, digest, 32, FALSE);
+ CRYPT_AESSetKey(aes.data(), 16, digest, 32, false);
uint8_t iv[16];
FXSYS_memset(iv, 0, 16);
CRYPT_AESSetIV(aes.data(), iv);
CRYPT_AESDecrypt(aes.data(), key, ekey.raw_str(), 32);
- CRYPT_AESSetKey(aes.data(), 16, key, 32, FALSE);
+ CRYPT_AESSetKey(aes.data(), 16, key, 32, false);
CRYPT_AESSetIV(aes.data(), iv);
CFX_ByteString perms = m_pEncryptDict->GetStringFor("Perms");
if (perms.IsEmpty())
- return FALSE;
+ return false;
uint8_t perms_buf[16];
FXSYS_memset(perms_buf, 0, sizeof(perms_buf));
@@ -372,22 +372,22 @@ FX_BOOL CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
uint8_t buf[16];
CRYPT_AESDecrypt(aes.data(), buf, perms_buf, 16);
if (buf[9] != 'a' || buf[10] != 'd' || buf[11] != 'b')
- return FALSE;
+ return false;
if (FXDWORD_GET_LSBFIRST(buf) != m_Permissions)
- return FALSE;
+ return false;
bool encrypted = IsMetadataEncrypted();
if ((buf[8] == 'T' && !encrypted) || (buf[8] == 'F' && encrypted))
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
-FX_BOOL CPDF_SecurityHandler::CheckPassword(const uint8_t* password,
- uint32_t size,
- FX_BOOL bOwner,
- uint8_t* key,
- int32_t key_len) {
+bool CPDF_SecurityHandler::CheckPassword(const uint8_t* password,
+ uint32_t size,
+ bool bOwner,
+ uint8_t* key,
+ int32_t key_len) {
if (m_Revision >= 5)
return AES256_CheckPassword(password, size, bOwner, key);
@@ -398,20 +398,20 @@ FX_BOOL CPDF_SecurityHandler::CheckPassword(const uint8_t* password,
if (bOwner)
return CheckOwnerPassword(password, size, key, key_len);
- return CheckUserPassword(password, size, FALSE, key, key_len) ||
- CheckUserPassword(password, size, TRUE, key, key_len);
+ return CheckUserPassword(password, size, false, key, key_len) ||
+ CheckUserPassword(password, size, true, key, key_len);
}
-FX_BOOL CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password,
- uint32_t pass_size,
- FX_BOOL bIgnoreEncryptMeta,
- uint8_t* key,
- int32_t key_len) {
+bool CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password,
+ uint32_t pass_size,
+ bool bIgnoreEncryptMeta,
+ uint8_t* key,
+ int32_t key_len) {
CalcEncryptKey(m_pEncryptDict, password, pass_size, key, key_len,
bIgnoreEncryptMeta, m_pParser->GetIDArray());
CFX_ByteString ukey =
m_pEncryptDict ? m_pEncryptDict->GetStringFor("U") : CFX_ByteString();
if (ukey.GetLength() < 16) {
- return FALSE;
+ return false;
}
uint8_t ukeybuf[32];
if (m_Revision == 2) {
@@ -443,9 +443,9 @@ FX_BOOL CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password,
return FXSYS_memcmp(test, ukeybuf, 16) == 0;
}
if (FXSYS_memcmp((void*)ukey.c_str(), ukeybuf, 16) == 0) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
CFX_ByteString CPDF_SecurityHandler::GetUserPassword(const uint8_t* owner_pass,
uint32_t pass_size,
@@ -493,16 +493,16 @@ CFX_ByteString CPDF_SecurityHandler::GetUserPassword(const uint8_t* owner_pass,
}
return CFX_ByteString(okeybuf, len);
}
-FX_BOOL CPDF_SecurityHandler::CheckOwnerPassword(const uint8_t* password,
- uint32_t pass_size,
- uint8_t* key,
- int32_t key_len) {
+bool CPDF_SecurityHandler::CheckOwnerPassword(const uint8_t* password,
+ uint32_t pass_size,
+ uint8_t* key,
+ int32_t key_len) {
CFX_ByteString user_pass = GetUserPassword(password, pass_size, key_len);
- if (CheckUserPassword(user_pass.raw_str(), user_pass.GetLength(), FALSE, key,
+ if (CheckUserPassword(user_pass.raw_str(), user_pass.GetLength(), false, key,
key_len)) {
- return TRUE;
+ return true;
}
- return CheckUserPassword(user_pass.raw_str(), user_pass.GetLength(), TRUE,
+ return CheckUserPassword(user_pass.raw_str(), user_pass.GetLength(), true,
key, key_len);
}
@@ -516,7 +516,7 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
uint32_t user_size,
const uint8_t* owner_pass,
uint32_t owner_size,
- FX_BOOL bDefault,
+ bool bDefault,
uint32_t type) {
int cipher = 0, key_len = 0;
if (!LoadDict(pEncryptDict, type, cipher, key_len)) {
@@ -534,9 +534,9 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CRYPT_SHA256Update(sha, m_EncryptKey, 32);
CRYPT_SHA256Update(sha, (uint8_t*)"there", 5);
CRYPT_SHA256Finish(sha, m_EncryptKey);
- AES256_SetPassword(pEncryptDict, user_pass, user_size, FALSE, m_EncryptKey);
+ AES256_SetPassword(pEncryptDict, user_pass, user_size, false, m_EncryptKey);
if (bDefault) {
- AES256_SetPassword(pEncryptDict, owner_pass, owner_size, TRUE,
+ AES256_SetPassword(pEncryptDict, owner_pass, owner_size, true,
m_EncryptKey);
AES256_SetPerms(pEncryptDict, m_Permissions,
pEncryptDict->GetBooleanFor("EncryptMetadata", true),
@@ -573,7 +573,7 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
pEncryptDict->SetStringFor("O", CFX_ByteString(passcode, 32));
}
CalcEncryptKey(m_pEncryptDict, (uint8_t*)user_pass, user_size, m_EncryptKey,
- key_len, FALSE, pIdArray);
+ key_len, false, pIdArray);
if (m_Revision < 3) {
uint8_t tempbuf[32];
FXSYS_memcpy(tempbuf, defpasscode, 32);
@@ -609,20 +609,20 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
uint32_t owner_size,
uint32_t type) {
OnCreate(pEncryptDict, pIdArray, user_pass, user_size, owner_pass, owner_size,
- TRUE, type);
+ true, type);
}
void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CPDF_Array* pIdArray,
const uint8_t* user_pass,
uint32_t user_size,
uint32_t type) {
- OnCreate(pEncryptDict, pIdArray, user_pass, user_size, nullptr, 0, FALSE,
+ OnCreate(pEncryptDict, pIdArray, user_pass, user_size, nullptr, 0, false,
type);
}
void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
const uint8_t* password,
uint32_t size,
- FX_BOOL bOwner,
+ bool bOwner,
const uint8_t* key) {
uint8_t sha[128];
CRYPT_SHA1Start(sha);
@@ -659,7 +659,7 @@ void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
CRYPT_SHA256Finish(sha, digest1);
}
uint8_t* aes = FX_Alloc(uint8_t, 2048);
- CRYPT_AESSetKey(aes, 16, digest1, 32, TRUE);
+ CRYPT_AESSetKey(aes, 16, digest1, 32, true);
uint8_t iv[16];
FXSYS_memset(iv, 0, 16);
CRYPT_AESSetIV(aes, iv);
@@ -669,7 +669,7 @@ void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
}
void CPDF_SecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict,
uint32_t permissions,
- FX_BOOL bEncryptMetadata,
+ bool bEncryptMetadata,
const uint8_t* key) {
uint8_t buf[16];
buf[0] = (uint8_t)permissions;
@@ -685,7 +685,7 @@ void CPDF_SecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict,
buf[10] = 'd';
buf[11] = 'b';
uint8_t* aes = FX_Alloc(uint8_t, 2048);
- CRYPT_AESSetKey(aes, 16, key, 32, TRUE);
+ CRYPT_AESSetKey(aes, 16, key, 32, true);
uint8_t iv[16], buf1[16];
FXSYS_memset(iv, 0, 16);
CRYPT_AESSetIV(aes, iv);
diff --git a/core/fpdfapi/parser/cpdf_security_handler.h b/core/fpdfapi/parser/cpdf_security_handler.h
index 9132fd9a46..1a41b67195 100644
--- a/core/fpdfapi/parser/cpdf_security_handler.h
+++ b/core/fpdfapi/parser/cpdf_security_handler.h
@@ -27,9 +27,9 @@ class CPDF_SecurityHandler {
CPDF_SecurityHandler();
~CPDF_SecurityHandler();
- FX_BOOL OnInit(CPDF_Parser* pParser, CPDF_Dictionary* pEncryptDict);
+ bool OnInit(CPDF_Parser* pParser, CPDF_Dictionary* pEncryptDict);
uint32_t GetPermissions();
- FX_BOOL GetCryptInfo(int& cipher, const uint8_t*& buffer, int& keylen);
+ bool GetCryptInfo(int& cipher, const uint8_t*& buffer, int& keylen);
bool IsMetadataEncrypted() const;
CPDF_CryptoHandler* CreateCryptoHandler();
@@ -50,41 +50,41 @@ class CPDF_SecurityHandler {
CFX_ByteString GetUserPassword(const uint8_t* owner_pass,
uint32_t pass_size,
int32_t key_len);
- FX_BOOL CheckPassword(const uint8_t* password,
- uint32_t pass_size,
- FX_BOOL bOwner,
- uint8_t* key,
- int key_len);
+ bool CheckPassword(const uint8_t* password,
+ uint32_t pass_size,
+ bool bOwner,
+ uint8_t* key,
+ int key_len);
private:
- FX_BOOL LoadDict(CPDF_Dictionary* pEncryptDict);
- FX_BOOL LoadDict(CPDF_Dictionary* pEncryptDict,
- uint32_t type,
- int& cipher,
- int& key_len);
-
- FX_BOOL CheckUserPassword(const uint8_t* password,
- uint32_t pass_size,
- FX_BOOL bIgnoreEncryptMeta,
- uint8_t* key,
- int32_t key_len);
-
- FX_BOOL CheckOwnerPassword(const uint8_t* password,
- uint32_t pass_size,
- uint8_t* key,
- int32_t key_len);
- FX_BOOL AES256_CheckPassword(const uint8_t* password,
- uint32_t size,
- FX_BOOL bOwner,
- uint8_t* key);
+ bool LoadDict(CPDF_Dictionary* pEncryptDict);
+ bool LoadDict(CPDF_Dictionary* pEncryptDict,
+ uint32_t type,
+ int& cipher,
+ int& key_len);
+
+ bool CheckUserPassword(const uint8_t* password,
+ uint32_t pass_size,
+ bool bIgnoreEncryptMeta,
+ uint8_t* key,
+ int32_t key_len);
+
+ bool CheckOwnerPassword(const uint8_t* password,
+ uint32_t pass_size,
+ uint8_t* key,
+ int32_t key_len);
+ bool AES256_CheckPassword(const uint8_t* password,
+ uint32_t size,
+ bool bOwner,
+ uint8_t* key);
void AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
const uint8_t* password,
uint32_t size,
- FX_BOOL bOwner,
+ bool bOwner,
const uint8_t* key);
void AES256_SetPerms(CPDF_Dictionary* pEncryptDict,
uint32_t permission,
- FX_BOOL bEncryptMetadata,
+ bool bEncryptMetadata,
const uint8_t* key);
void OnCreate(CPDF_Dictionary* pEncryptDict,
CPDF_Array* pIdArray,
@@ -92,9 +92,9 @@ class CPDF_SecurityHandler {
uint32_t user_size,
const uint8_t* owner_pass,
uint32_t owner_size,
- FX_BOOL bDefault,
+ bool bDefault,
uint32_t type);
- FX_BOOL CheckSecurity(int32_t key_len);
+ bool CheckSecurity(int32_t key_len);
int m_Version;
int m_Revision;
diff --git a/core/fpdfapi/parser/cpdf_stream.cpp b/core/fpdfapi/parser/cpdf_stream.cpp
index 93899db24e..c6e99c84b5 100644
--- a/core/fpdfapi/parser/cpdf_stream.cpp
+++ b/core/fpdfapi/parser/cpdf_stream.cpp
@@ -77,7 +77,7 @@ CPDF_Object* CPDF_Stream::CloneNonCyclic(
std::set<const CPDF_Object*>* pVisited) const {
pVisited->insert(this);
CPDF_StreamAcc acc;
- acc.LoadAllData(this, TRUE);
+ acc.LoadAllData(this, true);
uint32_t streamSize = acc.GetSize();
CPDF_Dictionary* pDict = GetDict();
if (pDict && !pdfium::ContainsKey(*pVisited, pDict)) {
@@ -101,20 +101,20 @@ void CPDF_Stream::SetData(const uint8_t* pData, uint32_t size) {
m_pDict->RemoveFor("DecodeParms");
}
-FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset,
- uint8_t* buf,
- uint32_t size) const {
+bool CPDF_Stream::ReadRawData(FX_FILESIZE offset,
+ uint8_t* buf,
+ uint32_t size) const {
if (m_bMemoryBased && m_pFile)
return m_pFile->ReadBlock(buf, offset, size);
if (m_pDataBuf)
FXSYS_memcpy(buf, m_pDataBuf.get() + offset, size);
- return TRUE;
+ return true;
}
CFX_WideString CPDF_Stream::GetUnicodeText() const {
CPDF_StreamAcc stream;
- stream.LoadAllData(this, FALSE);
+ stream.LoadAllData(this, false);
return PDF_DecodeText(stream.GetData(), stream.GetSize());
}
diff --git a/core/fpdfapi/parser/cpdf_stream.h b/core/fpdfapi/parser/cpdf_stream.h
index 588714eadc..73484d8335 100644
--- a/core/fpdfapi/parser/cpdf_stream.h
+++ b/core/fpdfapi/parser/cpdf_stream.h
@@ -40,9 +40,9 @@ class CPDF_Stream : public CPDF_Object {
void InitStreamFromFile(IFX_SeekableReadStream* pFile,
CPDF_Dictionary* pDict);
- FX_BOOL ReadRawData(FX_FILESIZE start_pos,
- uint8_t* pBuf,
- uint32_t buf_size) const;
+ bool ReadRawData(FX_FILESIZE start_pos,
+ uint8_t* pBuf,
+ uint32_t buf_size) const;
bool IsMemoryBased() const { return m_bMemoryBased; }
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.cpp b/core/fpdfapi/parser/cpdf_stream_acc.cpp
index e8bf6d7e15..81439bc677 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.cpp
+++ b/core/fpdfapi/parser/cpdf_stream_acc.cpp
@@ -11,15 +11,15 @@
CPDF_StreamAcc::CPDF_StreamAcc()
: m_pData(nullptr),
m_dwSize(0),
- m_bNewBuf(FALSE),
+ m_bNewBuf(false),
m_pImageParam(nullptr),
m_pStream(nullptr),
m_pSrcData(nullptr) {}
void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream,
- FX_BOOL bRawAccess,
+ bool bRawAccess,
uint32_t estimated_size,
- FX_BOOL bImageAcc) {
+ bool bImageAcc) {
if (!pStream)
return;
@@ -46,9 +46,9 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream,
m_pData = pSrcData;
m_dwSize = dwSrcSize;
} else {
- FX_BOOL bRet = PDF_DataDecode(pSrcData, dwSrcSize, m_pStream->GetDict(),
- m_pData, m_dwSize, m_ImageDecoder,
- m_pImageParam, estimated_size, bImageAcc);
+ bool bRet = PDF_DataDecode(pSrcData, dwSrcSize, m_pStream->GetDict(),
+ m_pData, m_dwSize, m_ImageDecoder, m_pImageParam,
+ estimated_size, bImageAcc);
if (!bRet) {
m_pData = pSrcData;
m_dwSize = dwSrcSize;
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h
index c4f312a113..654055f96b 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.h
+++ b/core/fpdfapi/parser/cpdf_stream_acc.h
@@ -18,9 +18,9 @@ class CPDF_StreamAcc {
~CPDF_StreamAcc();
void LoadAllData(const CPDF_Stream* pStream,
- FX_BOOL bRawAccess = FALSE,
+ bool bRawAccess = false,
uint32_t estimated_size = 0,
- FX_BOOL bImageAcc = FALSE);
+ bool bImageAcc = false);
const CPDF_Stream* GetStream() const { return m_pStream; }
CPDF_Dictionary* GetDict() const {
@@ -36,7 +36,7 @@ class CPDF_StreamAcc {
protected:
uint8_t* m_pData;
uint32_t m_dwSize;
- FX_BOOL m_bNewBuf;
+ bool m_bNewBuf;
CFX_ByteString m_ImageDecoder;
CPDF_Dictionary* m_pImageParam;
const CPDF_Stream* m_pStream;
diff --git a/core/fpdfapi/parser/cpdf_string.cpp b/core/fpdfapi/parser/cpdf_string.cpp
index 73c7d4cf69..f4fa956280 100644
--- a/core/fpdfapi/parser/cpdf_string.cpp
+++ b/core/fpdfapi/parser/cpdf_string.cpp
@@ -8,12 +8,12 @@
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
-CPDF_String::CPDF_String() : m_bHex(FALSE) {}
+CPDF_String::CPDF_String() : m_bHex(false) {}
-CPDF_String::CPDF_String(const CFX_ByteString& str, FX_BOOL bHex)
+CPDF_String::CPDF_String(const CFX_ByteString& str, bool bHex)
: m_String(str), m_bHex(bHex) {}
-CPDF_String::CPDF_String(const CFX_WideString& str) : m_bHex(FALSE) {
+CPDF_String::CPDF_String(const CFX_WideString& str) : m_bHex(false) {
m_String = PDF_EncodeText(str);
}
diff --git a/core/fpdfapi/parser/cpdf_string.h b/core/fpdfapi/parser/cpdf_string.h
index 01ea8224d4..efc6d076c7 100644
--- a/core/fpdfapi/parser/cpdf_string.h
+++ b/core/fpdfapi/parser/cpdf_string.h
@@ -14,7 +14,7 @@
class CPDF_String : public CPDF_Object {
public:
CPDF_String();
- CPDF_String(const CFX_ByteString& str, FX_BOOL bHex);
+ CPDF_String(const CFX_ByteString& str, bool bHex);
explicit CPDF_String(const CFX_WideString& str);
// CPDF_Object.
@@ -27,13 +27,13 @@ class CPDF_String : public CPDF_Object {
CPDF_String* AsString() override;
const CPDF_String* AsString() const override;
- FX_BOOL IsHex() const { return m_bHex; }
+ bool IsHex() const { return m_bHex; }
protected:
~CPDF_String() override;
CFX_ByteString m_String;
- FX_BOOL m_bHex;
+ bool m_bHex;
};
inline CPDF_String* ToString(CPDF_Object* obj) {
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index 3b1df94503..c1ab1cf768 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -51,16 +51,16 @@ CPDF_SyntaxParser::~CPDF_SyntaxParser() {
FX_Free(m_pFileBuf);
}
-FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch) {
+bool CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch) {
CFX_AutoRestorer<FX_FILESIZE> save_pos(&m_Pos);
m_Pos = pos;
return GetNextChar(ch);
}
-FX_BOOL CPDF_SyntaxParser::GetNextChar(uint8_t& ch) {
+bool CPDF_SyntaxParser::GetNextChar(uint8_t& ch) {
FX_FILESIZE pos = m_Pos + m_HeaderOffset;
if (pos >= m_FileLen)
- return FALSE;
+ return false;
if (m_BufOffset >= pos || (FX_FILESIZE)(m_BufOffset + m_BufSize) <= pos) {
FX_FILESIZE read_pos = pos;
@@ -78,19 +78,19 @@ FX_BOOL CPDF_SyntaxParser::GetNextChar(uint8_t& ch) {
}
if (!m_pFileAccess->ReadBlock(m_pFileBuf, read_pos, read_size))
- return FALSE;
+ return false;
m_BufOffset = read_pos;
}
ch = m_pFileBuf[pos - m_BufOffset];
m_Pos++;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) {
+bool CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) {
pos += m_HeaderOffset;
if (pos >= m_FileLen)
- return FALSE;
+ return false;
if (m_BufOffset >= pos || (FX_FILESIZE)(m_BufOffset + m_BufSize) <= pos) {
FX_FILESIZE read_pos;
@@ -110,19 +110,19 @@ FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) {
}
if (!m_pFileAccess->ReadBlock(m_pFileBuf, read_pos, read_size))
- return FALSE;
+ return false;
m_BufOffset = read_pos;
}
ch = m_pFileBuf[pos - m_BufOffset];
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_SyntaxParser::ReadBlock(uint8_t* pBuf, uint32_t size) {
+bool CPDF_SyntaxParser::ReadBlock(uint8_t* pBuf, uint32_t size) {
if (!m_pFileAccess->ReadBlock(pBuf, m_Pos + m_HeaderOffset, size))
- return FALSE;
+ return false;
m_Pos += size;
- return TRUE;
+ return true;
}
void CPDF_SyntaxParser::GetNextWordInternal(bool* bIsNumber) {
@@ -381,7 +381,7 @@ CFX_ByteString CPDF_SyntaxParser::GetKeyword() {
CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
uint32_t objnum,
uint32_t gennum,
- FX_BOOL bDecrypt) {
+ bool bDecrypt) {
CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth);
if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth)
return nullptr;
@@ -414,14 +414,14 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
CFX_ByteString str = ReadString();
if (m_pCryptoHandler && bDecrypt)
m_pCryptoHandler->Decrypt(objnum, gennum, str);
- return new CPDF_String(MaybeIntern(str), FALSE);
+ return new CPDF_String(MaybeIntern(str), false);
}
if (word == "<") {
CFX_ByteString str = ReadHexString();
if (m_pCryptoHandler && bDecrypt)
m_pCryptoHandler->Decrypt(objnum, gennum, str);
- return new CPDF_String(MaybeIntern(str), TRUE);
+ return new CPDF_String(MaybeIntern(str), true);
}
if (word == "[") {
@@ -535,14 +535,14 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectForStrict(
CFX_ByteString str = ReadString();
if (m_pCryptoHandler)
m_pCryptoHandler->Decrypt(objnum, gennum, str);
- return new CPDF_String(MaybeIntern(str), FALSE);
+ return new CPDF_String(MaybeIntern(str), false);
}
if (word == "<") {
CFX_ByteString str = ReadHexString();
if (m_pCryptoHandler)
m_pCryptoHandler->Decrypt(objnum, gennum, str);
- return new CPDF_String(MaybeIntern(str), TRUE);
+ return new CPDF_String(MaybeIntern(str), true);
}
if (word == "[") {
@@ -650,7 +650,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
CPDF_CryptoHandler* pCryptoHandler =
objnum == (uint32_t)m_MetadataObjnum ? nullptr : m_pCryptoHandler.get();
if (!pCryptoHandler) {
- FX_BOOL bSearchForKeyword = TRUE;
+ bool bSearchForKeyword = true;
if (len >= 0) {
pdfium::base::CheckedNumeric<FX_FILESIZE> pos = m_Pos;
pos += len;
@@ -665,7 +665,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
// specified length, it signals the end of stream.
if (FXSYS_memcmp(m_WordBuffer, kEndStreamStr.raw_str(),
kEndStreamStr.GetLength()) == 0) {
- bSearchForKeyword = FALSE;
+ bSearchForKeyword = false;
}
}
@@ -683,7 +683,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
// Stop searching when "endstream" is found.
if (IsWholeWord(m_Pos - kEndStreamStr.GetLength(), m_FileLen,
- kEndStreamStr, TRUE)) {
+ kEndStreamStr, true)) {
endStreamOffset = m_Pos - streamStartPos - kEndStreamStr.GetLength();
break;
}
@@ -700,7 +700,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
// Stop searching when "endobj" is found.
if (IsWholeWord(m_Pos - kEndObjStr.GetLength(), m_FileLen, kEndObjStr,
- TRUE)) {
+ true)) {
endObjOffset = m_Pos - streamStartPos - kEndObjStr.GetLength();
break;
}
@@ -810,7 +810,7 @@ uint32_t CPDF_SyntaxParser::GetDirectNum() {
bool CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos,
FX_FILESIZE limit,
const CFX_ByteStringC& tag,
- FX_BOOL checkKeyword) {
+ bool checkKeyword) {
const uint32_t taglen = tag.GetLength();
bool bCheckLeft = !PDFCharIsDelimiter(tag[0]) && !PDFCharIsWhitespace(tag[0]);
@@ -837,13 +837,13 @@ bool CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos,
// TODO(dsinclair): Split into a SearchWordForward and SearchWordBackwards
// and drop the bool.
-FX_BOOL CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag,
- FX_BOOL bWholeWord,
- FX_BOOL bForward,
- FX_FILESIZE limit) {
+bool CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag,
+ bool bWholeWord,
+ bool bForward,
+ FX_FILESIZE limit) {
int32_t taglen = tag.GetLength();
if (taglen == 0)
- return FALSE;
+ return false;
FX_FILESIZE pos = m_Pos;
int32_t offset = 0;
@@ -855,17 +855,17 @@ FX_BOOL CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag,
while (1) {
if (bForward) {
if (limit && pos >= m_Pos + limit)
- return FALSE;
+ return false;
if (!GetCharAt(pos, byte))
- return FALSE;
+ return false;
} else {
if (limit && pos <= m_Pos - limit)
- return FALSE;
+ return false;
if (!GetCharAtBackward(pos, byte))
- return FALSE;
+ return false;
}
if (byte == tag_data[offset]) {
@@ -884,9 +884,9 @@ FX_BOOL CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag,
}
FX_FILESIZE startpos = bForward ? pos - taglen + 1 : pos;
- if (!bWholeWord || IsWholeWord(startpos, limit, tag, FALSE)) {
+ if (!bWholeWord || IsWholeWord(startpos, limit, tag, false)) {
m_Pos = startpos;
- return TRUE;
+ return true;
}
}
@@ -899,14 +899,14 @@ FX_BOOL CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag,
}
if (pos < 0)
- return FALSE;
+ return false;
}
- return FALSE;
+ return false;
}
int32_t CPDF_SyntaxParser::SearchMultiWord(const CFX_ByteStringC& tags,
- FX_BOOL bWholeWord,
+ bool bWholeWord,
FX_FILESIZE limit) {
int32_t ntags = 1;
for (int i = 0; i < tags.GetLength(); ++i) {
@@ -951,7 +951,7 @@ int32_t CPDF_SyntaxParser::SearchMultiWord(const CFX_ByteStringC& tags,
continue;
if (!bWholeWord || IsWholeWord(pos - pat.m_bsTag.GetLength(), limit,
- pat.m_bsTag, FALSE)) {
+ pat.m_bsTag, false)) {
return i;
}
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.h b/core/fpdfapi/parser/cpdf_syntax_parser.h
index 5694d233e1..eae5a00a41 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.h
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.h
@@ -34,7 +34,7 @@ class CPDF_SyntaxParser {
CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList,
uint32_t objnum,
uint32_t gennum,
- FX_BOOL bDecrypt);
+ bool bDecrypt);
CPDF_Object* GetObjectForStrict(CPDF_IndirectObjectHolder* pObjList,
uint32_t objnum,
uint32_t gennum);
@@ -43,19 +43,19 @@ class CPDF_SyntaxParser {
void ToNextLine();
void ToNextWord();
- FX_BOOL SearchWord(const CFX_ByteStringC& word,
- FX_BOOL bWholeWord,
- FX_BOOL bForward,
- FX_FILESIZE limit);
+ bool SearchWord(const CFX_ByteStringC& word,
+ bool bWholeWord,
+ bool bForward,
+ FX_FILESIZE limit);
int SearchMultiWord(const CFX_ByteStringC& words,
- FX_BOOL bWholeWord,
+ bool bWholeWord,
FX_FILESIZE limit);
FX_FILESIZE FindTag(const CFX_ByteStringC& tag, FX_FILESIZE limit);
void SetEncrypt(std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler);
- FX_BOOL ReadBlock(uint8_t* pBuf, uint32_t size);
- FX_BOOL GetCharAt(FX_FILESIZE pos, uint8_t& ch);
+ bool ReadBlock(uint8_t* pBuf, uint32_t size);
+ bool GetCharAt(FX_FILESIZE pos, uint8_t& ch);
CFX_ByteString GetNextWord(bool* bIsNumber);
private:
@@ -67,13 +67,13 @@ class CPDF_SyntaxParser {
static int s_CurrentRecursionDepth;
uint32_t GetDirectNum();
- FX_BOOL GetNextChar(uint8_t& ch);
- FX_BOOL GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch);
+ bool GetNextChar(uint8_t& ch);
+ bool GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch);
void GetNextWordInternal(bool* bIsNumber);
bool IsWholeWord(FX_FILESIZE startpos,
FX_FILESIZE limit,
const CFX_ByteStringC& tag,
- FX_BOOL checkKeyword);
+ bool checkKeyword);
CFX_ByteString ReadString();
CFX_ByteString ReadHexString();
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp
index 45a0698078..a23c0ed64e 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp
@@ -16,7 +16,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Empty string.
uint8_t data[] = "";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 0, FALSE));
+ ScopedFileStream stream(FX_CreateMemoryStream(data, 0, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -27,7 +27,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Blank string.
uint8_t data[] = " ";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 2, FALSE));
+ ScopedFileStream stream(FX_CreateMemoryStream(data, 2, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -38,7 +38,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Skips unknown characters.
uint8_t data[] = "z12b";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 4, FALSE));
+ ScopedFileStream stream(FX_CreateMemoryStream(data, 4, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -49,7 +49,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Skips unknown characters.
uint8_t data[] = "*<&*#$^&@1";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 10, FALSE));
+ ScopedFileStream stream(FX_CreateMemoryStream(data, 10, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -60,7 +60,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Skips unknown characters.
uint8_t data[] = "\x80zab";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 4, FALSE));
+ ScopedFileStream stream(FX_CreateMemoryStream(data, 4, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -71,7 +71,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Skips unknown characters.
uint8_t data[] = "\xffzab";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 4, FALSE));
+ ScopedFileStream stream(FX_CreateMemoryStream(data, 4, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -82,7 +82,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Regular conversion.
uint8_t data[] = "1A2b>abcd";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 9, FALSE));
+ ScopedFileStream stream(FX_CreateMemoryStream(data, 9, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -93,7 +93,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Position out of bounds.
uint8_t data[] = "12ab>";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 5, FALSE));
+ ScopedFileStream stream(FX_CreateMemoryStream(data, 5, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -117,7 +117,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Missing ending >.
uint8_t data[] = "1A2b";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 4, FALSE));
+ ScopedFileStream stream(FX_CreateMemoryStream(data, 4, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -128,7 +128,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Missing ending >.
uint8_t data[] = "12abz";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 5, FALSE));
+ ScopedFileStream stream(FX_CreateMemoryStream(data, 5, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -139,7 +139,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Uneven number of bytes.
uint8_t data[] = "1A2>asdf";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 8, FALSE));
+ ScopedFileStream stream(FX_CreateMemoryStream(data, 8, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -150,7 +150,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Uneven number of bytes.
uint8_t data[] = "1A2zasdf";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 8, FALSE));
+ ScopedFileStream stream(FX_CreateMemoryStream(data, 8, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -161,7 +161,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Just ending character.
uint8_t data[] = ">";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 1, FALSE));
+ ScopedFileStream stream(FX_CreateMemoryStream(data, 1, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp
index ed379c7028..6398c71835 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp
@@ -297,7 +297,7 @@ CCodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
BitsPerComponent, Columns);
}
-uint32_t FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
+uint32_t FPDFAPI_FlateOrLZWDecode(bool bLZW,
const uint8_t* src_buf,
uint32_t src_size,
CPDF_Dictionary* pParams,
@@ -308,7 +308,7 @@ uint32_t FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
int Colors = 0;
int BitsPerComponent = 0;
int Columns = 0;
- FX_BOOL bEarlyChange = TRUE;
+ bool bEarlyChange = true;
if (pParams) {
predictor = pParams->GetIntegerFor("Predictor");
bEarlyChange = !!pParams->GetIntegerFor("EarlyChange", 1);
@@ -323,18 +323,18 @@ uint32_t FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
BitsPerComponent, Columns, estimated_size, dest_buf, dest_size);
}
-FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
- uint32_t src_size,
- const CPDF_Dictionary* pDict,
- uint8_t*& dest_buf,
- uint32_t& dest_size,
- CFX_ByteString& ImageEncoding,
- CPDF_Dictionary*& pImageParms,
- uint32_t last_estimated_size,
- FX_BOOL bImageAcc) {
+bool PDF_DataDecode(const uint8_t* src_buf,
+ uint32_t src_size,
+ const CPDF_Dictionary* pDict,
+ uint8_t*& dest_buf,
+ uint32_t& dest_size,
+ CFX_ByteString& ImageEncoding,
+ CPDF_Dictionary*& pImageParms,
+ uint32_t last_estimated_size,
+ bool bImageAcc) {
CPDF_Object* pDecoder = pDict ? pDict->GetDirectObjectFor("Filter") : nullptr;
if (!pDecoder || (!pDecoder->IsArray() && !pDecoder->IsName()))
- return FALSE;
+ return false;
CPDF_Object* pParams =
pDict ? pDict->GetDirectObjectFor("DecodeParms") : nullptr;
@@ -367,12 +367,12 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
dest_buf = (uint8_t*)last_buf;
dest_size = last_size;
pImageParms = pParam;
- return TRUE;
+ return true;
}
- offset = FPDFAPI_FlateOrLZWDecode(FALSE, last_buf, last_size, pParam,
+ offset = FPDFAPI_FlateOrLZWDecode(false, last_buf, last_size, pParam,
estimated_size, new_buf, new_size);
} else if (decoder == "LZWDecode" || decoder == "LZW") {
- offset = FPDFAPI_FlateOrLZWDecode(TRUE, last_buf, last_size, pParam,
+ offset = FPDFAPI_FlateOrLZWDecode(true, last_buf, last_size, pParam,
estimated_size, new_buf, new_size);
} else if (decoder == "ASCII85Decode" || decoder == "A85") {
offset = A85Decode(last_buf, last_size, new_buf, new_size);
@@ -384,7 +384,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
dest_buf = (uint8_t*)last_buf;
dest_size = last_size;
pImageParms = pParam;
- return TRUE;
+ return true;
}
offset = RunLengthDecode(last_buf, last_size, new_buf, new_size);
} else if (decoder == "Crypt") {
@@ -402,14 +402,14 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
dest_size = last_size;
if (CPDF_Array* pDecoders = pDecoder->AsArray())
pDecoders->RemoveAt(i + 1, pDecoders->GetCount() - i - 1);
- return TRUE;
+ return true;
}
if (last_buf != src_buf) {
FX_Free(last_buf);
}
if (offset == -1) {
FX_Free(new_buf);
- return FALSE;
+ return false;
}
last_buf = new_buf;
last_size = new_size;
@@ -418,7 +418,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
pImageParms = nullptr;
dest_buf = last_buf;
dest_size = last_size;
- return TRUE;
+ return true;
}
CFX_WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
@@ -512,7 +512,7 @@ CFX_ByteString PDF_EncodeText(const CFX_WideString& str) {
return PDF_EncodeText(str.c_str(), str.GetLength());
}
-CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex) {
+CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, bool bHex) {
CFX_ByteTextBuf result;
int srclen = src.GetLength();
if (bHex) {
@@ -570,7 +570,7 @@ uint32_t FlateDecode(const uint8_t* src_buf,
CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
if (pEncoders) {
return pEncoders->GetFlateModule()->FlateOrLZWDecode(
- FALSE, src_buf, src_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size);
+ false, src_buf, src_size, false, 0, 0, 0, 0, 0, dest_buf, dest_size);
}
return 0;
}
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.h b/core/fpdfapi/parser/fpdf_parser_decode.h
index 3a5d532831..4d99f1559d 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.h
+++ b/core/fpdfapi/parser/fpdf_parser_decode.h
@@ -17,8 +17,7 @@ extern const uint16_t PDFDocEncoding[256];
CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& orig);
CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig);
CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig);
-CFX_ByteString PDF_EncodeString(const CFX_ByteString& src,
- FX_BOOL bHex = FALSE);
+CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, bool bHex = false);
CFX_WideString PDF_DecodeText(const uint8_t* pData, uint32_t size);
CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr);
CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len = -1);
@@ -57,21 +56,21 @@ uint32_t HexDecode(const uint8_t* src_buf,
uint8_t*& dest_buf,
uint32_t& dest_size);
// Public for testing.
-uint32_t FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
+uint32_t FPDFAPI_FlateOrLZWDecode(bool bLZW,
const uint8_t* src_buf,
uint32_t src_size,
CPDF_Dictionary* pParams,
uint32_t estimated_size,
uint8_t*& dest_buf,
uint32_t& dest_size);
-FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
- uint32_t src_size,
- const CPDF_Dictionary* pDict,
- uint8_t*& dest_buf,
- uint32_t& dest_size,
- CFX_ByteString& ImageEncoding,
- CPDF_Dictionary*& pImageParms,
- uint32_t estimated_size,
- FX_BOOL bImageAcc);
+bool PDF_DataDecode(const uint8_t* src_buf,
+ uint32_t src_size,
+ const CPDF_Dictionary* pDict,
+ uint8_t*& dest_buf,
+ uint32_t& dest_size,
+ CFX_ByteString& ImageEncoding,
+ CPDF_Dictionary*& pImageParms,
+ uint32_t estimated_size,
+ bool bImageAcc);
#endif // CORE_FPDFAPI_PARSER_FPDF_PARSER_DECODE_H_
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp
index 8fdef1eb11..630754a23b 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp
@@ -208,13 +208,13 @@ CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj) {
const CPDF_Stream* p = pObj->AsStream();
buf << p->GetDict() << "stream\r\n";
CPDF_StreamAcc acc;
- acc.LoadAllData(p, TRUE);
+ acc.LoadAllData(p, true);
buf.AppendBlock(acc.GetData(), acc.GetSize());
buf << "\r\nendstream";
break;
}
default:
- ASSERT(FALSE);
+ ASSERT(false);
break;
}
return buf;
diff --git a/core/fpdfapi/render/cpdf_pagerendercache.h b/core/fpdfapi/render/cpdf_pagerendercache.h
index 37d092062d..0156416d47 100644
--- a/core/fpdfapi/render/cpdf_pagerendercache.h
+++ b/core/fpdfapi/render/cpdf_pagerendercache.h
@@ -33,9 +33,9 @@ class CPDF_PageRenderCache {
CFX_DIBSource*& pBitmap,
CFX_DIBSource*& pMask,
uint32_t& MatteColor,
- FX_BOOL bStdCS = FALSE,
+ bool bStdCS = false,
uint32_t GroupFamily = 0,
- FX_BOOL bLoadMask = FALSE,
+ bool bLoadMask = false,
CPDF_RenderStatus* pRenderStatus = nullptr,
int32_t downsampleWidth = 0,
int32_t downsampleHeight = 0);
@@ -47,15 +47,15 @@ class CPDF_PageRenderCache {
return m_pCurImageCacheEntry;
}
- FX_BOOL StartGetCachedBitmap(CPDF_Stream* pStream,
- FX_BOOL bStdCS = FALSE,
- uint32_t GroupFamily = 0,
- FX_BOOL bLoadMask = FALSE,
- CPDF_RenderStatus* pRenderStatus = nullptr,
- int32_t downsampleWidth = 0,
- int32_t downsampleHeight = 0);
+ bool StartGetCachedBitmap(CPDF_Stream* pStream,
+ bool bStdCS = false,
+ uint32_t GroupFamily = 0,
+ bool bLoadMask = false,
+ CPDF_RenderStatus* pRenderStatus = nullptr,
+ int32_t downsampleWidth = 0,
+ int32_t downsampleHeight = 0);
- FX_BOOL Continue(IFX_Pause* pPause);
+ bool Continue(IFX_Pause* pPause);
protected:
friend class CPDF_Page;
@@ -65,7 +65,7 @@ class CPDF_PageRenderCache {
std::map<CPDF_Stream*, CPDF_ImageCacheEntry*> m_ImageCache;
uint32_t m_nTimeCount;
uint32_t m_nCacheSize;
- FX_BOOL m_bCurFindCache;
+ bool m_bCurFindCache;
};
#endif // CORE_FPDFAPI_RENDER_CPDF_PAGERENDERCACHE_H_
diff --git a/core/fpdfapi/render/cpdf_textrenderer.h b/core/fpdfapi/render/cpdf_textrenderer.h
index a179fd7c8c..82cc2cf8e6 100644
--- a/core/fpdfapi/render/cpdf_textrenderer.h
+++ b/core/fpdfapi/render/cpdf_textrenderer.h
@@ -32,29 +32,29 @@ class CPDF_TextRenderer {
const CFX_GraphStateData* pGraphState,
const CPDF_RenderOptions* pOptions);
- static FX_BOOL DrawTextPath(CFX_RenderDevice* pDevice,
- int nChars,
- uint32_t* pCharCodes,
- FX_FLOAT* pCharPos,
- CPDF_Font* pFont,
- FX_FLOAT font_size,
- const CFX_Matrix* pText2User,
- const CFX_Matrix* pUser2Device,
- const CFX_GraphStateData* pGraphState,
- FX_ARGB fill_argb,
- FX_ARGB stroke_argb,
- CFX_PathData* pClippingPath,
- int nFlag);
-
- static FX_BOOL DrawNormalText(CFX_RenderDevice* pDevice,
- int nChars,
- uint32_t* pCharCodes,
- FX_FLOAT* pCharPos,
- CPDF_Font* pFont,
- FX_FLOAT font_size,
- const CFX_Matrix* pText2Device,
- FX_ARGB fill_argb,
- const CPDF_RenderOptions* pOptions);
+ static bool DrawTextPath(CFX_RenderDevice* pDevice,
+ int nChars,
+ uint32_t* pCharCodes,
+ FX_FLOAT* pCharPos,
+ CPDF_Font* pFont,
+ FX_FLOAT font_size,
+ const CFX_Matrix* pText2User,
+ const CFX_Matrix* pUser2Device,
+ const CFX_GraphStateData* pGraphState,
+ FX_ARGB fill_argb,
+ FX_ARGB stroke_argb,
+ CFX_PathData* pClippingPath,
+ int nFlag);
+
+ static bool DrawNormalText(CFX_RenderDevice* pDevice,
+ int nChars,
+ uint32_t* pCharCodes,
+ FX_FLOAT* pCharPos,
+ CPDF_Font* pFont,
+ FX_FLOAT font_size,
+ const CFX_Matrix* pText2Device,
+ FX_ARGB fill_argb,
+ const CPDF_RenderOptions* pOptions);
};
#endif // CORE_FPDFAPI_RENDER_CPDF_TEXTRENDERER_H_
diff --git a/core/fpdfapi/render/cpdf_type3cache.cpp b/core/fpdfapi/render/cpdf_type3cache.cpp
index 7fe552108d..ba92142dbf 100644
--- a/core/fpdfapi/render/cpdf_type3cache.cpp
+++ b/core/fpdfapi/render/cpdf_type3cache.cpp
@@ -34,24 +34,24 @@ void CPDF_UniqueKeyGen::Generate(int count, ...) {
m_KeyLen = count * sizeof(uint32_t);
}
-FX_BOOL IsScanLine1bpp(uint8_t* pBuf, int width) {
+bool IsScanLine1bpp(uint8_t* pBuf, int width) {
int size = width / 8;
for (int i = 0; i < size; i++) {
if (pBuf[i])
- return TRUE;
+ return true;
}
return (width % 8) && (pBuf[width / 8] & (0xff << (8 - width % 8)));
}
-FX_BOOL IsScanLine8bpp(uint8_t* pBuf, int width) {
+bool IsScanLine8bpp(uint8_t* pBuf, int width) {
for (int i = 0; i < width; i++) {
if (pBuf[i] > 0x40)
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-int DetectFirstLastScan(const CFX_DIBitmap* pBitmap, FX_BOOL bFirst) {
+int DetectFirstLastScan(const CFX_DIBitmap* pBitmap, bool bFirst) {
int height = pBitmap->GetHeight();
int pitch = pBitmap->GetPitch();
int width = pBitmap->GetWidth();
@@ -131,12 +131,12 @@ CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize,
int top = 0;
if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 &&
FXSYS_fabs(image_matrix.c) < FXSYS_fabs(image_matrix.d) / 100) {
- int top_line = DetectFirstLastScan(pBitmap, TRUE);
- int bottom_line = DetectFirstLastScan(pBitmap, FALSE);
+ int top_line = DetectFirstLastScan(pBitmap, true);
+ int bottom_line = DetectFirstLastScan(pBitmap, false);
if (top_line == 0 && bottom_line == pBitmap->GetHeight() - 1) {
FX_FLOAT top_y = image_matrix.d + image_matrix.f;
FX_FLOAT bottom_y = image_matrix.f;
- FX_BOOL bFlipped = top_y > bottom_y;
+ bool bFlipped = top_y > bottom_y;
if (bFlipped) {
FX_FLOAT temp = top_y;
top_y = bottom_y;
diff --git a/core/fpdfapi/render/fpdf_render.cpp b/core/fpdfapi/render/fpdf_render.cpp
index 4dcad15949..a431aa9486 100644
--- a/core/fpdfapi/render/fpdf_render.cpp
+++ b/core/fpdfapi/render/fpdf_render.cpp
@@ -40,10 +40,10 @@ CPDF_DocRenderData::CPDF_DocRenderData(CPDF_Document* pPDFDoc)
: m_pPDFDoc(pPDFDoc) {}
CPDF_DocRenderData::~CPDF_DocRenderData() {
- Clear(TRUE);
+ Clear(true);
}
-void CPDF_DocRenderData::Clear(FX_BOOL bRelease) {
+void CPDF_DocRenderData::Clear(bool bRelease) {
for (auto it = m_Type3FaceMap.begin(); it != m_Type3FaceMap.end();) {
auto curr_it = it++;
CPDF_CountedObject<CPDF_Type3Cache>* cache = curr_it->second;
@@ -146,38 +146,38 @@ CPDF_RenderStatus::CPDF_RenderStatus()
: m_pFormResource(nullptr),
m_pPageResource(nullptr),
m_pContext(nullptr),
- m_bStopped(FALSE),
+ m_bStopped(false),
m_pDevice(nullptr),
m_pCurObj(nullptr),
m_pStopObj(nullptr),
m_HalftoneLimit(0),
- m_bPrint(FALSE),
+ m_bPrint(false),
m_Transparency(0),
- m_bDropObjects(FALSE),
- m_bStdCS(FALSE),
+ m_bDropObjects(false),
+ m_bStdCS(false),
m_GroupFamily(0),
- m_bLoadMask(FALSE),
+ m_bLoadMask(false),
m_pType3Char(nullptr),
m_T3FillColor(0),
m_curBlend(FXDIB_BLEND_NORMAL) {}
CPDF_RenderStatus::~CPDF_RenderStatus() {}
-FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext,
- CFX_RenderDevice* pDevice,
- const CFX_Matrix* pDeviceMatrix,
- const CPDF_PageObject* pStopObj,
- const CPDF_RenderStatus* pParentState,
- const CPDF_GraphicStates* pInitialStates,
- const CPDF_RenderOptions* pOptions,
- int transparency,
- FX_BOOL bDropObjects,
- CPDF_Dictionary* pFormResource,
- FX_BOOL bStdCS,
- CPDF_Type3Char* pType3Char,
- FX_ARGB fill_color,
- uint32_t GroupFamily,
- FX_BOOL bLoadMask) {
+bool CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext,
+ CFX_RenderDevice* pDevice,
+ const CFX_Matrix* pDeviceMatrix,
+ const CPDF_PageObject* pStopObj,
+ const CPDF_RenderStatus* pParentState,
+ const CPDF_GraphicStates* pInitialStates,
+ const CPDF_RenderOptions* pOptions,
+ int transparency,
+ bool bDropObjects,
+ CPDF_Dictionary* pFormResource,
+ bool bStdCS,
+ CPDF_Type3Char* pType3Char,
+ FX_ARGB fill_color,
+ uint32_t GroupFamily,
+ bool bLoadMask) {
m_pContext = pContext;
m_pDevice = pDevice;
m_bPrint = m_pDevice->GetDeviceClass() != FXDC_DISPLAY;
@@ -217,7 +217,7 @@ FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext,
}
m_pImageRenderer.reset();
m_Transparency = transparency;
- return TRUE;
+ return true;
}
void CPDF_RenderStatus::RenderObjectList(
const CPDF_PageObjectHolder* pObjectHolder,
@@ -232,7 +232,7 @@ void CPDF_RenderStatus::RenderObjectList(
for (const auto& pCurObj : *pObjectHolder->GetPageObjectList()) {
if (pCurObj.get() == m_pStopObj) {
- m_bStopped = TRUE;
+ m_bStopped = true;
return;
}
if (!pCurObj)
@@ -278,48 +278,48 @@ void CPDF_RenderStatus::RenderSingleObject(CPDF_PageObject* pObj,
#endif
}
-FX_BOOL CPDF_RenderStatus::ContinueSingleObject(CPDF_PageObject* pObj,
- const CFX_Matrix* pObj2Device,
- IFX_Pause* pPause) {
+bool CPDF_RenderStatus::ContinueSingleObject(CPDF_PageObject* pObj,
+ const CFX_Matrix* pObj2Device,
+ IFX_Pause* pPause) {
if (m_pImageRenderer) {
if (m_pImageRenderer->Continue(pPause))
- return TRUE;
+ return true;
if (!m_pImageRenderer->m_Result)
DrawObjWithBackground(pObj, pObj2Device);
m_pImageRenderer.reset();
- return FALSE;
+ return false;
}
m_pCurObj = pObj;
if (m_Options.m_pOCContext && pObj->m_ContentMark &&
!m_Options.m_pOCContext->CheckObjectVisible(pObj)) {
- return FALSE;
+ return false;
}
ProcessClipPath(pObj->m_ClipPath, pObj2Device);
if (ProcessTransparency(pObj, pObj2Device))
- return FALSE;
+ return false;
if (pObj->IsImage()) {
m_pImageRenderer.reset(new CPDF_ImageRenderer);
- if (!m_pImageRenderer->Start(this, pObj, pObj2Device, FALSE)) {
+ if (!m_pImageRenderer->Start(this, pObj, pObj2Device, false)) {
if (!m_pImageRenderer->m_Result)
DrawObjWithBackground(pObj, pObj2Device);
m_pImageRenderer.reset();
- return FALSE;
+ return false;
}
return ContinueSingleObject(pObj, pObj2Device, pPause);
}
ProcessObjectNoClip(pObj, pObj2Device);
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj,
- const CFX_Matrix* pObj2Device,
- FX_BOOL bLogical,
- FX_RECT& rect) const {
+bool CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj,
+ const CFX_Matrix* pObj2Device,
+ bool bLogical,
+ FX_RECT& rect) const {
rect = pObj->GetBBox(pObj2Device);
FX_RECT rtClip = m_pDevice->GetClipBox();
if (!bLogical) {
@@ -344,7 +344,7 @@ void CPDF_RenderStatus::ProcessObjectNoClip(CPDF_PageObject* pObj,
#if defined _SKIA_SUPPORT_
DebugVerifyDeviceIsPreMultiplied();
#endif
- FX_BOOL bRet = FALSE;
+ bool bRet = false;
switch (pObj->GetType()) {
case CPDF_PageObject::TEXT:
bRet = ProcessText(pObj->AsText(), pObj2Device, nullptr);
@@ -369,9 +369,9 @@ void CPDF_RenderStatus::ProcessObjectNoClip(CPDF_PageObject* pObj,
#endif
}
-FX_BOOL CPDF_RenderStatus::DrawObjWithBlend(CPDF_PageObject* pObj,
- const CFX_Matrix* pObj2Device) {
- FX_BOOL bRet = FALSE;
+bool CPDF_RenderStatus::DrawObjWithBlend(CPDF_PageObject* pObj,
+ const CFX_Matrix* pObj2Device) {
+ bool bRet = false;
switch (pObj->GetType()) {
case CPDF_PageObject::PATH:
bRet = ProcessPath(pObj->AsPath(), pObj2Device);
@@ -396,7 +396,7 @@ void CPDF_RenderStatus::GetScaledMatrix(CFX_Matrix& matrix) const {
void CPDF_RenderStatus::DrawObjWithBackground(CPDF_PageObject* pObj,
const CFX_Matrix* pObj2Device) {
FX_RECT rect;
- if (GetObjectClippedRect(pObj, pObj2Device, FALSE, rect)) {
+ if (GetObjectClippedRect(pObj, pObj2Device, false, rect)) {
return;
}
int res = 300;
@@ -426,15 +426,15 @@ void CPDF_RenderStatus::DrawObjWithBackground(CPDF_PageObject* pObj,
buffer.OutputToDevice();
}
-FX_BOOL CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj,
- const CFX_Matrix* pObj2Device) {
+bool CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj,
+ const CFX_Matrix* pObj2Device) {
#if defined _SKIA_SUPPORT_
DebugVerifyDeviceIsPreMultiplied();
#endif
CPDF_Dictionary* pOC = pFormObj->m_pForm->m_pFormDict->GetDictFor("OC");
if (pOC && m_Options.m_pOCContext &&
!m_Options.m_pOCContext->CheckOCGVisible(pOC)) {
- return TRUE;
+ return true;
}
CFX_Matrix matrix = pFormObj->m_FormMatrix;
matrix.Concat(*pObj2Device);
@@ -445,7 +445,7 @@ FX_BOOL CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj,
CPDF_RenderStatus status;
status.Initialize(m_pContext, m_pDevice, nullptr, m_pStopObj, this, pFormObj,
&m_Options, m_Transparency, m_bDropObjects, pResources,
- FALSE);
+ false);
status.m_curBlend = m_curBlend;
m_pDevice->SaveState();
status.RenderObjectList(pFormObj->m_pForm.get(), &matrix);
@@ -454,33 +454,33 @@ FX_BOOL CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj,
#if defined _SKIA_SUPPORT_
DebugVerifyDeviceIsPreMultiplied();
#endif
- return TRUE;
+ return true;
}
-FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix) {
+bool IsAvailableMatrix(const CFX_Matrix& matrix) {
if (matrix.a == 0 || matrix.d == 0) {
return matrix.b != 0 && matrix.c != 0;
}
if (matrix.b == 0 || matrix.c == 0) {
return matrix.a != 0 && matrix.d != 0;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj,
- const CFX_Matrix* pObj2Device) {
+bool CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj,
+ const CFX_Matrix* pObj2Device) {
int FillType = pPathObj->m_FillType;
- FX_BOOL bStroke = pPathObj->m_bStroke;
+ bool bStroke = pPathObj->m_bStroke;
ProcessPathPattern(pPathObj, pObj2Device, FillType, bStroke);
if (FillType == 0 && !bStroke)
- return TRUE;
+ return true;
uint32_t fill_argb = FillType ? GetFillArgb(pPathObj) : 0;
uint32_t stroke_argb = bStroke ? GetStrokeArgb(pPathObj) : 0;
CFX_Matrix path_matrix = pPathObj->m_Matrix;
path_matrix.Concat(*pObj2Device);
if (!IsAvailableMatrix(path_matrix))
- return TRUE;
+ return true;
if (FillType && (m_Options.m_Flags & RENDER_RECT_AA))
FillType |= FXFILL_RECT_AA;
@@ -513,7 +513,7 @@ CPDF_TransferFunc* CPDF_RenderStatus::GetTransferFunc(CPDF_Object* pObj) const {
}
FX_ARGB CPDF_RenderStatus::GetFillArgb(CPDF_PageObject* pObj,
- FX_BOOL bType3) const {
+ bool bType3) const {
const CPDF_ColorState* pColorState = &pObj->m_ColorState;
if (m_pType3Char && !bType3 &&
(!m_pType3Char->m_bColored ||
@@ -652,9 +652,9 @@ void CPDF_RenderStatus::DrawClipPath(CPDF_ClipPath ClipPath,
fill_mode);
}
}
-FX_BOOL CPDF_RenderStatus::SelectClipPath(const CPDF_PathObject* pPathObj,
- const CFX_Matrix* pObj2Device,
- FX_BOOL bStroke) {
+bool CPDF_RenderStatus::SelectClipPath(const CPDF_PathObject* pPathObj,
+ const CFX_Matrix* pObj2Device,
+ bool bStroke) {
CFX_Matrix path_matrix = pPathObj->m_Matrix;
path_matrix.Concat(*pObj2Device);
if (bStroke) {
@@ -671,14 +671,14 @@ FX_BOOL CPDF_RenderStatus::SelectClipPath(const CPDF_PathObject* pPathObj,
return m_pDevice->SetClip_PathFill(pPathObj->m_Path.GetObject(), &path_matrix,
fill_mode);
}
-FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
- const CFX_Matrix* pObj2Device) {
+bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
+ const CFX_Matrix* pObj2Device) {
#if defined _SKIA_SUPPORT_
DebugVerifyDeviceIsPreMultiplied();
#endif
int blend_type = pPageObj->m_GeneralState.GetBlendType();
if (blend_type == FXDIB_BLEND_UNSUPPORTED)
- return TRUE;
+ return true;
CPDF_Dictionary* pSMaskDict =
ToDictionary(pPageObj->m_GeneralState.GetSoftMask());
@@ -691,7 +691,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
CPDF_Dictionary* pFormResource = nullptr;
FX_FLOAT group_alpha = 1.0f;
int Transparency = m_Transparency;
- FX_BOOL bGroupTransparent = FALSE;
+ bool bGroupTransparent = false;
if (pPageObj->IsForm()) {
const CPDF_FormObject* pFormObj = pPageObj->AsForm();
group_alpha = pFormObj->m_GeneralState.GetFillAlpha();
@@ -735,11 +735,11 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
}
if (!pSMaskDict && group_alpha == 1.0f && blend_type == FXDIB_BLEND_NORMAL &&
!bTextClip && !bGroupTransparent) {
- return FALSE;
+ return false;
}
bool isolated = !!(Transparency & PDFTRANS_ISOLATED);
if (m_bPrint) {
- FX_BOOL bRet = FALSE;
+ bool bRet = false;
int rendCaps = m_pDevice->GetRenderCaps();
if (!((Transparency & PDFTRANS_ISOLATED) || pSMaskDict || bTextClip) &&
(rendCaps & FXRC_BLEND_MODE)) {
@@ -751,12 +751,12 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
if (!bRet) {
DrawObjWithBackground(pPageObj, pObj2Device);
}
- return TRUE;
+ return true;
}
FX_RECT rect = pPageObj->GetBBox(pObj2Device);
rect.Intersect(m_pDevice->GetClipBox());
if (rect.IsEmpty()) {
- return TRUE;
+ return true;
}
CFX_Matrix deviceCTM = m_pDevice->GetCTM();
FX_FLOAT scaleX = FXSYS_fabs(deviceCTM.a);
@@ -768,11 +768,11 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
if (!isolated && (m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) {
oriDevice.reset(new CFX_DIBitmap);
if (!m_pDevice->CreateCompatibleBitmap(oriDevice.get(), width, height))
- return TRUE;
+ return true;
m_pDevice->GetDIBits(oriDevice.get(), rect.left, rect.top);
}
if (!bitmap_device.Create(width, height, FXDIB_Argb, oriDevice.get()))
- return TRUE;
+ return true;
CFX_DIBitmap* bitmap = bitmap_device.GetBitmap();
bitmap->Clear(0);
CFX_Matrix new_matrix = *pObj2Device;
@@ -782,7 +782,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
if (bTextClip) {
pTextMask.reset(new CFX_DIBitmap);
if (!pTextMask->Create(width, height, FXDIB_8bppMask))
- return TRUE;
+ return true;
pTextMask->Clear(0);
CFX_FxgeDevice text_device;
@@ -804,7 +804,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
CPDF_RenderStatus bitmap_render;
bitmap_render.Initialize(m_pContext, &bitmap_device, nullptr, m_pStopObj,
nullptr, nullptr, &m_Options, 0, m_bDropObjects,
- pFormResource, TRUE);
+ pFormResource, true);
bitmap_render.ProcessObjectNoClip(pPageObj, &new_matrix);
m_bStopped = bitmap_render.m_bStopped;
if (pSMaskDict) {
@@ -836,14 +836,14 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
#if defined _SKIA_SUPPORT_
DebugVerifyDeviceIsPreMultiplied();
#endif
- return TRUE;
+ return true;
}
CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj,
const FX_RECT& rect,
int& left,
int& top,
- FX_BOOL bBackAlphaRequired) {
+ bool bBackAlphaRequired) {
FX_RECT bbox = rect;
bbox.Intersect(m_pDevice->GetClipBox());
left = bbox.left;
@@ -862,7 +862,7 @@ CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj,
if (!pBackdrop->GetBuffer())
return nullptr;
- FX_BOOL bNeedDraw;
+ bool bNeedDraw;
if (pBackdrop->HasAlpha())
bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT);
else
@@ -896,7 +896,7 @@ void CPDF_RenderContext::GetBackground(CFX_DIBitmap* pBuffer,
}
CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates(
const CPDF_GraphicStates* pSrcStates,
- FX_BOOL bStroke) {
+ bool bStroke) {
if (!pSrcStates)
return nullptr;
@@ -954,7 +954,7 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice,
CPDF_RenderStatus status;
status.Initialize(this, pDevice, pLastMatrix, pStopObj, nullptr, nullptr,
pOptions, pLayer->m_pObjectHolder->m_Transparency,
- FALSE, nullptr);
+ false, nullptr);
status.RenderObjectList(pLayer->m_pObjectHolder, &FinalMatrix);
if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) {
m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize);
@@ -967,7 +967,7 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice,
CPDF_RenderStatus status;
status.Initialize(this, pDevice, nullptr, pStopObj, nullptr, nullptr,
pOptions, pLayer->m_pObjectHolder->m_Transparency,
- FALSE, nullptr);
+ false, nullptr);
status.RenderObjectList(pLayer->m_pObjectHolder, &pLayer->m_Matrix);
if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) {
m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize);
@@ -1019,7 +1019,7 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) {
m_pRenderStatus.reset(new CPDF_RenderStatus());
m_pRenderStatus->Initialize(
m_pContext, m_pDevice, nullptr, nullptr, nullptr, nullptr, m_pOptions,
- m_pCurrentLayer->m_pObjectHolder->m_Transparency, FALSE, nullptr);
+ m_pCurrentLayer->m_pObjectHolder->m_Transparency, false, nullptr);
m_pDevice->SaveState();
m_ClipRect = CFX_FloatRect(m_pDevice->GetClipBox());
CFX_Matrix device2object;
@@ -1092,10 +1092,10 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) {
}
std::unique_ptr<CPDF_Function> pFuncs[3];
- FX_BOOL bUniTransfer = TRUE;
- FX_BOOL bIdentity = TRUE;
+ bool bUniTransfer = true;
+ bool bIdentity = true;
if (CPDF_Array* pArray = pObj->AsArray()) {
- bUniTransfer = FALSE;
+ bUniTransfer = false;
if (pArray->GetCount() < 3)
return nullptr;
@@ -1125,7 +1125,7 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) {
pFuncs[0]->Call(&input, 1, output, noutput);
int o = FXSYS_round(output[0] * 255);
if (o != v)
- bIdentity = FALSE;
+ bIdentity = false;
for (int i = 0; i < 3; ++i) {
pTransfer->m_Samples[i * 256 + v] = o;
}
@@ -1135,7 +1135,7 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) {
pFuncs[i]->Call(&input, 1, output, noutput);
int o = FXSYS_round(output[0] * 255);
if (o != v)
- bIdentity = FALSE;
+ bIdentity = false;
pTransfer->m_Samples[i * 256 + v] = o;
} else {
pTransfer->m_Samples[i * 256 + v] = v;
@@ -1159,11 +1159,11 @@ CPDF_DeviceBuffer::CPDF_DeviceBuffer()
CPDF_DeviceBuffer::~CPDF_DeviceBuffer() {}
-FX_BOOL CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext,
- CFX_RenderDevice* pDevice,
- FX_RECT* pRect,
- const CPDF_PageObject* pObj,
- int max_dpi) {
+bool CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext,
+ CFX_RenderDevice* pDevice,
+ FX_RECT* pRect,
+ const CPDF_PageObject* pObj,
+ int max_dpi) {
m_pDevice = pDevice;
m_pContext = pContext;
m_Rect = *pRect;
@@ -1194,7 +1194,7 @@ FX_BOOL CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext,
FX_RECT bitmap_rect = rect.GetOuterRect();
m_pBitmap.reset(new CFX_DIBitmap);
m_pBitmap->Create(bitmap_rect.Width(), bitmap_rect.Height(), FXDIB_Argb);
- return TRUE;
+ return true;
}
void CPDF_DeviceBuffer::OutputToDevice() {
if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) {
@@ -1221,15 +1221,15 @@ CPDF_ScaledRenderBuffer::CPDF_ScaledRenderBuffer() {}
CPDF_ScaledRenderBuffer::~CPDF_ScaledRenderBuffer() {}
#define _FPDFAPI_IMAGESIZE_LIMIT_ (30 * 1024 * 1024)
-FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext,
- CFX_RenderDevice* pDevice,
- const FX_RECT& pRect,
- const CPDF_PageObject* pObj,
- const CPDF_RenderOptions* pOptions,
- int max_dpi) {
+bool CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext,
+ CFX_RenderDevice* pDevice,
+ const FX_RECT& pRect,
+ const CPDF_PageObject* pObj,
+ const CPDF_RenderOptions* pOptions,
+ int max_dpi) {
m_pDevice = pDevice;
if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) {
- return TRUE;
+ return true;
}
m_pContext = pContext;
m_Rect = pRect;
@@ -1264,7 +1264,7 @@ FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext,
int32_t iHeight = bitmap_rect.Height();
int32_t iPitch = (iWidth * bpp + 31) / 32 * 4;
if (iWidth * iHeight < 1)
- return FALSE;
+ return false;
if (iPitch * iHeight <= _FPDFAPI_IMAGESIZE_LIMIT_ &&
m_pBitmapDevice->Create(iWidth, iHeight, dibFormat, nullptr)) {
@@ -1274,7 +1274,7 @@ FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext,
}
m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject, pOptions,
&m_Matrix);
- return TRUE;
+ return true;
}
void CPDF_ScaledRenderBuffer::OutputToDevice() {
if (m_pBitmapDevice) {
diff --git a/core/fpdfapi/render/fpdf_render_cache.cpp b/core/fpdfapi/render/fpdf_render_cache.cpp
index 67dd953752..2f342f0689 100644
--- a/core/fpdfapi/render/fpdf_render_cache.cpp
+++ b/core/fpdfapi/render/fpdf_render_cache.cpp
@@ -28,7 +28,7 @@ CPDF_PageRenderCache::CPDF_PageRenderCache(CPDF_Page* pPage)
m_pCurImageCacheEntry(nullptr),
m_nTimeCount(0),
m_nCacheSize(0),
- m_bCurFindCache(FALSE) {}
+ m_bCurFindCache(false) {}
CPDF_PageRenderCache::~CPDF_PageRenderCache() {
for (const auto& it : m_ImageCache)
@@ -86,22 +86,22 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream,
CFX_DIBSource*& pBitmap,
CFX_DIBSource*& pMask,
uint32_t& MatteColor,
- FX_BOOL bStdCS,
+ bool bStdCS,
uint32_t GroupFamily,
- FX_BOOL bLoadMask,
+ bool bLoadMask,
CPDF_RenderStatus* pRenderStatus,
int32_t downsampleWidth,
int32_t downsampleHeight) {
CPDF_ImageCacheEntry* pEntry;
const auto it = m_ImageCache.find(pStream);
- FX_BOOL bFound = it != m_ImageCache.end();
+ bool bFound = it != m_ImageCache.end();
if (bFound)
pEntry = it->second;
else
pEntry = new CPDF_ImageCacheEntry(m_pPage->m_pDocument, pStream);
m_nTimeCount++;
- FX_BOOL bAlreadyCached = pEntry->GetCachedBitmap(
+ bool bAlreadyCached = pEntry->GetCachedBitmap(
pBitmap, pMask, MatteColor, m_pPage->m_pPageResources, bStdCS,
GroupFamily, bLoadMask, pRenderStatus, downsampleWidth, downsampleHeight);
@@ -111,11 +111,11 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream,
if (!bAlreadyCached)
m_nCacheSize += pEntry->EstimateSize();
}
-FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap(
+bool CPDF_PageRenderCache::StartGetCachedBitmap(
CPDF_Stream* pStream,
- FX_BOOL bStdCS,
+ bool bStdCS,
uint32_t GroupFamily,
- FX_BOOL bLoadMask,
+ bool bLoadMask,
CPDF_RenderStatus* pRenderStatus,
int32_t downsampleWidth,
int32_t downsampleHeight) {
@@ -131,7 +131,7 @@ FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap(
pRenderStatus->m_pFormResource, m_pPage->m_pPageResources, bStdCS,
GroupFamily, bLoadMask, pRenderStatus, downsampleWidth, downsampleHeight);
if (ret == 2)
- return TRUE;
+ return true;
m_nTimeCount++;
if (!m_bCurFindCache)
@@ -140,18 +140,18 @@ FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap(
if (!ret)
m_nCacheSize += m_pCurImageCacheEntry->EstimateSize();
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_PageRenderCache::Continue(IFX_Pause* pPause) {
+bool CPDF_PageRenderCache::Continue(IFX_Pause* pPause) {
int ret = m_pCurImageCacheEntry->Continue(pPause);
if (ret == 2)
- return TRUE;
+ return true;
m_nTimeCount++;
if (!m_bCurFindCache)
m_ImageCache[m_pCurImageCacheEntry->GetStream()] = m_pCurImageCacheEntry;
if (!ret)
m_nCacheSize += m_pCurImageCacheEntry->EstimateSize();
- return FALSE;
+ return false;
}
void CPDF_PageRenderCache::ResetBitmap(CPDF_Stream* pStream,
const CFX_DIBitmap* pBitmap) {
@@ -200,24 +200,24 @@ static uint32_t FPDF_ImageCache_EstimateImageSize(const CFX_DIBSource* pDIB) {
(uint32_t)pDIB->GetPaletteSize() * 4
: 0;
}
-FX_BOOL CPDF_ImageCacheEntry::GetCachedBitmap(CFX_DIBSource*& pBitmap,
- CFX_DIBSource*& pMask,
- uint32_t& MatteColor,
- CPDF_Dictionary* pPageResources,
- FX_BOOL bStdCS,
- uint32_t GroupFamily,
- FX_BOOL bLoadMask,
- CPDF_RenderStatus* pRenderStatus,
- int32_t downsampleWidth,
- int32_t downsampleHeight) {
+bool CPDF_ImageCacheEntry::GetCachedBitmap(CFX_DIBSource*& pBitmap,
+ CFX_DIBSource*& pMask,
+ uint32_t& MatteColor,
+ CPDF_Dictionary* pPageResources,
+ bool bStdCS,
+ uint32_t GroupFamily,
+ bool bLoadMask,
+ CPDF_RenderStatus* pRenderStatus,
+ int32_t downsampleWidth,
+ int32_t downsampleHeight) {
if (m_pCachedBitmap) {
pBitmap = m_pCachedBitmap;
pMask = m_pCachedMask;
MatteColor = m_MatteColor;
- return TRUE;
+ return true;
}
if (!pRenderStatus) {
- return FALSE;
+ return false;
}
CPDF_RenderContext* pContext = pRenderStatus->GetContext();
CPDF_PageRenderCache* pPageRenderCache = pContext->GetPageCache();
@@ -229,7 +229,7 @@ FX_BOOL CPDF_ImageCacheEntry::GetCachedBitmap(CFX_DIBSource*& pBitmap,
GroupFamily, bLoadMask)) {
delete pSrc;
pBitmap = nullptr;
- return FALSE;
+ return false;
}
m_MatteColor = MatteColor;
if (pSrc->GetPitch() * pSrc->GetHeight() < FPDF_HUGE_IMAGE_SIZE) {
@@ -246,7 +246,7 @@ FX_BOOL CPDF_ImageCacheEntry::GetCachedBitmap(CFX_DIBSource*& pBitmap,
pBitmap = m_pCachedBitmap;
pMask = m_pCachedMask;
CalcSize();
- return FALSE;
+ return false;
}
CFX_DIBSource* CPDF_ImageCacheEntry::DetachBitmap() {
CFX_DIBSource* pDIBSource = m_pCurBitmap;
@@ -260,9 +260,9 @@ CFX_DIBSource* CPDF_ImageCacheEntry::DetachMask() {
}
int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources,
CPDF_Dictionary* pPageResources,
- FX_BOOL bStdCS,
+ bool bStdCS,
uint32_t GroupFamily,
- FX_BOOL bLoadMask,
+ bool bLoadMask,
CPDF_RenderStatus* pRenderStatus,
int32_t downsampleWidth,
int32_t downsampleHeight) {
@@ -278,7 +278,7 @@ int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources,
m_pCurBitmap = new CPDF_DIBSource;
int ret =
((CPDF_DIBSource*)m_pCurBitmap)
- ->StartLoadDIBSource(m_pDocument, m_pStream, TRUE, pFormResources,
+ ->StartLoadDIBSource(m_pDocument, m_pStream, true, pFormResources,
pPageResources, bStdCS, GroupFamily, bLoadMask);
if (ret == 2) {
return ret;
diff --git a/core/fpdfapi/render/fpdf_render_image.cpp b/core/fpdfapi/render/fpdf_render_image.cpp
index 049eff30c0..1133f67a9a 100644
--- a/core/fpdfapi/render/fpdf_render_image.cpp
+++ b/core/fpdfapi/render/fpdf_render_image.cpp
@@ -34,8 +34,8 @@
#include "core/fxge/skia/fx_skia_device.h"
#endif
-FX_BOOL CPDF_RenderStatus::ProcessImage(CPDF_ImageObject* pImageObj,
- const CFX_Matrix* pObj2Device) {
+bool CPDF_RenderStatus::ProcessImage(CPDF_ImageObject* pImageObj,
+ const CFX_Matrix* pObj2Device) {
CPDF_ImageRenderer render;
if (render.Start(this, pImageObj, pObj2Device, m_bStdCS, m_curBlend)) {
render.Continue(nullptr);
@@ -100,9 +100,9 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
top + pDIBitmap->GetHeight());
rect.Intersect(m_pDevice->GetClipBox());
CFX_DIBitmap* pClone = nullptr;
- FX_BOOL bClone = FALSE;
+ bool bClone = false;
if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) {
- bClone = TRUE;
+ bClone = true;
pClone = m_pDevice->GetBackDrop()->Clone(&rect);
CFX_DIBitmap* pForeBitmap = m_pDevice->GetBitmap();
pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(),
@@ -171,7 +171,7 @@ FX_COLORREF CPDF_TransferFunc::TranslateColor(FX_COLORREF rgb) const {
}
CFX_DIBSource* CPDF_TransferFunc::TranslateImage(const CFX_DIBSource* pSrc,
- FX_BOOL bAutoDropSrc) {
+ bool bAutoDropSrc) {
CPDF_DIBTransferFunc* pDest = new CPDF_DIBTransferFunc(this);
pDest->LoadSrc(pSrc, bAutoDropSrc);
return pDest;
@@ -204,7 +204,7 @@ CPDF_DIBTransferFunc::CPDF_DIBTransferFunc(
void CPDF_DIBTransferFunc::TranslateScanline(
const uint8_t* src_buf,
std::vector<uint8_t>* dest_buf) const {
- FX_BOOL bSkip = FALSE;
+ bool bSkip = false;
switch (m_pSrc->GetFormat()) {
case FXDIB_1bppRgb: {
int r0 = m_RampR[0];
@@ -284,7 +284,7 @@ void CPDF_DIBTransferFunc::TranslateScanline(
break;
}
case FXDIB_Rgb32:
- bSkip = TRUE;
+ bSkip = true;
case FXDIB_Argb: {
int index = 0;
for (int i = 0; i < m_Width; i++) {
@@ -348,11 +348,11 @@ void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf,
CPDF_ImageRenderer::CPDF_ImageRenderer() {
m_pRenderStatus = nullptr;
m_pImageObject = nullptr;
- m_Result = TRUE;
+ m_Result = true;
m_Status = 0;
m_DeviceHandle = nullptr;
- m_bStdCS = FALSE;
- m_bPatternColor = FALSE;
+ m_bStdCS = false;
+ m_bPatternColor = false;
m_BlendType = FXDIB_BLEND_NORMAL;
m_pPattern = nullptr;
m_pObj2Device = nullptr;
@@ -364,11 +364,11 @@ CPDF_ImageRenderer::~CPDF_ImageRenderer() {
}
}
-FX_BOOL CPDF_ImageRenderer::StartLoadDIBSource() {
+bool CPDF_ImageRenderer::StartLoadDIBSource() {
CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
FX_RECT image_rect = image_rect_f.GetOuterRect();
if (!image_rect.Valid())
- return FALSE;
+ return false;
int dest_width = image_rect.Width();
int dest_height = image_rect.Height();
@@ -385,15 +385,15 @@ FX_BOOL CPDF_ImageRenderer::StartLoadDIBSource() {
dest_height)) {
if (m_LoadHandle) {
m_Status = 4;
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() {
+bool CPDF_ImageRenderer::StartRenderDIBSource() {
if (!m_Loader.m_pBitmap)
- return FALSE;
+ return false;
m_BitmapAlpha =
FXSYS_round(255 * m_pImageObject->m_GeneralState.GetFillAlpha());
@@ -416,18 +416,18 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() {
if (m_Loader.m_bCached && m_Loader.m_pMask) {
m_Loader.m_pMask = m_Loader.m_pMask->Clone();
}
- m_Loader.m_bCached = FALSE;
+ m_Loader.m_bCached = false;
}
}
m_FillArgb = 0;
- m_bPatternColor = FALSE;
+ m_bPatternColor = false;
m_pPattern = nullptr;
if (m_pDIBSource->IsAlphaMask()) {
const CPDF_Color* pColor = m_pImageObject->m_ColorState.GetFillColor();
if (pColor && pColor->IsPattern()) {
m_pPattern = pColor->GetPattern();
if (m_pPattern) {
- m_bPatternColor = TRUE;
+ m_bPatternColor = true;
}
}
m_FillArgb = m_pRenderStatus->GetFillArgb(m_pImageObject);
@@ -507,11 +507,11 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() {
return StartDIBSource();
}
-FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus,
- CPDF_PageObject* pObj,
- const CFX_Matrix* pObj2Device,
- FX_BOOL bStdCS,
- int blendType) {
+bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus,
+ CPDF_PageObject* pObj,
+ const CFX_Matrix* pObj2Device,
+ bool bStdCS,
+ int blendType) {
m_pRenderStatus = pStatus;
m_bStdCS = bStdCS;
m_pImageObject = pObj->AsImage();
@@ -520,24 +520,24 @@ FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus,
CPDF_Dictionary* pOC = m_pImageObject->GetImage()->GetOC();
if (pOC && m_pRenderStatus->m_Options.m_pOCContext &&
!m_pRenderStatus->m_Options.m_pOCContext->CheckOCGVisible(pOC)) {
- return FALSE;
+ return false;
}
m_ImageMatrix = m_pImageObject->m_Matrix;
m_ImageMatrix.Concat(*pObj2Device);
if (StartLoadDIBSource()) {
- return TRUE;
+ return true;
}
return StartRenderDIBSource();
}
-FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus,
- const CFX_DIBSource* pDIBSource,
- FX_ARGB bitmap_argb,
- int bitmap_alpha,
- const CFX_Matrix* pImage2Device,
- uint32_t flags,
- FX_BOOL bStdCS,
- int blendType) {
+bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus,
+ const CFX_DIBSource* pDIBSource,
+ FX_ARGB bitmap_argb,
+ int bitmap_alpha,
+ const CFX_Matrix* pImage2Device,
+ uint32_t flags,
+ bool bStdCS,
+ int blendType) {
m_pRenderStatus = pStatus;
m_pDIBSource = pDIBSource;
m_FillArgb = bitmap_argb;
@@ -549,16 +549,16 @@ FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus,
return StartDIBSource();
}
-FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) {
+bool CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) {
if (m_pRenderStatus->m_bPrint &&
!(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) {
- m_Result = FALSE;
- return FALSE;
+ m_Result = false;
+ return false;
}
FX_RECT rect = m_ImageMatrix.GetUnitRect().GetOuterRect();
rect.Intersect(m_pRenderStatus->m_pDevice->GetClipBox());
if (rect.IsEmpty()) {
- return FALSE;
+ return false;
}
CFX_Matrix new_matrix = m_ImageMatrix;
new_matrix.TranslateI(-rect.left, -rect.top);
@@ -566,7 +566,7 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) {
int height = rect.Height();
CFX_FxgeDevice bitmap_device1;
if (!bitmap_device1.Create(rect.Width(), rect.Height(), FXDIB_Rgb32, nullptr))
- return TRUE;
+ return true;
bitmap_device1.GetBitmap()->Clear(0xffffff);
{
@@ -574,32 +574,32 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) {
bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1,
nullptr, nullptr, nullptr, nullptr,
&m_pRenderStatus->m_Options, 0,
- m_pRenderStatus->m_bDropObjects, nullptr, TRUE);
+ m_pRenderStatus->m_bDropObjects, nullptr, true);
CFX_Matrix patternDevice = *pObj2Device;
patternDevice.Translate((FX_FLOAT)-rect.left, (FX_FLOAT)-rect.top);
if (CPDF_TilingPattern* pTilingPattern = m_pPattern->AsTilingPattern()) {
bitmap_render.DrawTilingPattern(pTilingPattern, m_pImageObject,
- &patternDevice, FALSE);
+ &patternDevice, false);
} else if (CPDF_ShadingPattern* pShadingPattern =
m_pPattern->AsShadingPattern()) {
bitmap_render.DrawShadingPattern(pShadingPattern, m_pImageObject,
- &patternDevice, FALSE);
+ &patternDevice, false);
}
}
{
CFX_FxgeDevice bitmap_device2;
if (!bitmap_device2.Create(rect.Width(), rect.Height(), FXDIB_8bppRgb,
nullptr)) {
- return TRUE;
+ return true;
}
bitmap_device2.GetBitmap()->Clear(0);
CPDF_RenderStatus bitmap_render;
bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2,
nullptr, nullptr, nullptr, nullptr, nullptr, 0,
- m_pRenderStatus->m_bDropObjects, nullptr, TRUE);
+ m_pRenderStatus->m_bDropObjects, nullptr, true);
CPDF_ImageRenderer image_render;
if (image_render.Start(&bitmap_render, m_pDIBSource, 0xffffffff, 255,
- &new_matrix, m_Flags, TRUE)) {
+ &new_matrix, m_Flags, true)) {
image_render.Continue(nullptr);
}
if (m_Loader.m_MatteColor != 0xffffffff) {
@@ -647,19 +647,19 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) {
}
m_pRenderStatus->m_pDevice->SetDIBitsWithBlend(
bitmap_device1.GetBitmap(), rect.left, rect.top, m_BlendType);
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() {
+bool CPDF_ImageRenderer::DrawMaskedImage() {
if (m_pRenderStatus->m_bPrint &&
!(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) {
- m_Result = FALSE;
- return FALSE;
+ m_Result = false;
+ return false;
}
FX_RECT rect = m_ImageMatrix.GetUnitRect().GetOuterRect();
rect.Intersect(m_pRenderStatus->m_pDevice->GetClipBox());
if (rect.IsEmpty()) {
- return FALSE;
+ return false;
}
CFX_Matrix new_matrix = m_ImageMatrix;
new_matrix.TranslateI(-rect.left, -rect.top);
@@ -667,7 +667,7 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() {
int height = rect.Height();
CFX_FxgeDevice bitmap_device1;
if (!bitmap_device1.Create(width, height, FXDIB_Rgb32, nullptr))
- return TRUE;
+ return true;
#if defined _SKIA_SUPPORT_
bitmap_device1.Clear(0xffffff);
@@ -678,17 +678,17 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() {
CPDF_RenderStatus bitmap_render;
bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1,
nullptr, nullptr, nullptr, nullptr, nullptr, 0,
- m_pRenderStatus->m_bDropObjects, nullptr, TRUE);
+ m_pRenderStatus->m_bDropObjects, nullptr, true);
CPDF_ImageRenderer image_render;
if (image_render.Start(&bitmap_render, m_pDIBSource, 0, 255, &new_matrix,
- m_Flags, TRUE)) {
+ m_Flags, true)) {
image_render.Continue(nullptr);
}
}
{
CFX_FxgeDevice bitmap_device2;
if (!bitmap_device2.Create(width, height, FXDIB_8bppRgb, nullptr))
- return TRUE;
+ return true;
#if defined _SKIA_SUPPORT_
bitmap_device2.Clear(0);
@@ -698,10 +698,10 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() {
CPDF_RenderStatus bitmap_render;
bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2,
nullptr, nullptr, nullptr, nullptr, nullptr, 0,
- m_pRenderStatus->m_bDropObjects, nullptr, TRUE);
+ m_pRenderStatus->m_bDropObjects, nullptr, true);
CPDF_ImageRenderer image_render;
if (image_render.Start(&bitmap_render, m_Loader.m_pMask, 0xffffffff, 255,
- &new_matrix, m_Flags, TRUE)) {
+ &new_matrix, m_Flags, true)) {
image_render.Continue(nullptr);
}
if (m_Loader.m_MatteColor != 0xffffffff) {
@@ -758,17 +758,17 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() {
m_pRenderStatus->m_pDevice->SetDIBitsWithBlend(
bitmap_device1.GetBitmap(), rect.left, rect.top, m_BlendType);
#endif // _SKIA_SUPPORT_
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_ImageRenderer::StartDIBSource() {
+bool CPDF_ImageRenderer::StartDIBSource() {
if (!(m_Flags & RENDER_FORCE_DOWNSAMPLE) && m_pDIBSource->GetBPP() > 1) {
FX_SAFE_SIZE_T image_size = m_pDIBSource->GetBPP();
image_size /= 8;
image_size *= m_pDIBSource->GetWidth();
image_size *= m_pDIBSource->GetHeight();
if (!image_size.IsValid()) {
- return FALSE;
+ return false;
}
if (image_size.ValueOrDie() > FPDF_HUGE_IMAGE_SIZE &&
@@ -785,9 +785,9 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() {
m_DeviceHandle, m_BlendType)) {
if (m_DeviceHandle) {
m_Status = 3;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
#else
if (m_pRenderStatus->m_pDevice->StartDIBitsWithBlend(
@@ -795,9 +795,9 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() {
m_DeviceHandle, m_BlendType)) {
if (m_DeviceHandle) {
m_Status = 3;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
#endif
CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
@@ -808,8 +808,8 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() {
(FXSYS_fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0)) {
if (m_pRenderStatus->m_bPrint &&
!(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) {
- m_Result = FALSE;
- return FALSE;
+ m_Result = false;
+ return false;
}
FX_RECT clip_box = m_pRenderStatus->m_pDevice->GetClipBox();
clip_box.Intersect(image_rect);
@@ -817,7 +817,7 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() {
m_pTransformer.reset(new CFX_ImageTransformer(m_pDIBSource, &m_ImageMatrix,
m_Flags, &clip_box));
m_pTransformer->Start();
- return TRUE;
+ return true;
}
if (m_ImageMatrix.a < 0)
dest_width = -dest_width;
@@ -831,7 +831,7 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() {
if (m_pRenderStatus->m_pDevice->StretchDIBitsWithFlagsAndBlend(
m_pDIBSource, dest_left, dest_top, dest_width, dest_height, m_Flags,
m_BlendType)) {
- return FALSE;
+ return false;
}
}
if (m_pDIBSource->IsAlphaMask()) {
@@ -840,13 +840,13 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() {
if (m_pRenderStatus->m_pDevice->StretchBitMaskWithFlags(
m_pDIBSource, dest_left, dest_top, dest_width, dest_height,
m_FillArgb, m_Flags)) {
- return FALSE;
+ return false;
}
}
if (m_pRenderStatus->m_bPrint &&
!(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) {
- m_Result = FALSE;
- return TRUE;
+ m_Result = false;
+ return true;
}
FX_RECT clip_box = m_pRenderStatus->m_pDevice->GetClipBox();
@@ -860,12 +860,12 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() {
if (pStretched) {
m_pRenderStatus->CompositeDIBitmap(pStretched.get(), dest_rect.left,
dest_rect.top, m_FillArgb, m_BitmapAlpha,
- m_BlendType, FALSE);
+ m_BlendType, false);
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha() {
+bool CPDF_ImageRenderer::StartBitmapAlpha() {
if (m_pDIBSource->IsOpaqueImage()) {
CFX_PathData path;
path.AppendRect(0, 0, 1, 1);
@@ -884,7 +884,7 @@ FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha() {
std::unique_ptr<CFX_DIBitmap> pTransformed(
pAlphaMask->TransformTo(&m_ImageMatrix, left, top));
if (!pTransformed)
- return TRUE;
+ return true;
m_pRenderStatus->m_pDevice->SetBitMask(
pTransformed.get(), left, top,
@@ -906,17 +906,17 @@ FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha() {
delete pAlphaMask;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause) {
+bool CPDF_ImageRenderer::Continue(IFX_Pause* pPause) {
if (m_Status == 2) {
if (m_pTransformer->Continue(pPause))
- return TRUE;
+ return true;
std::unique_ptr<CFX_DIBitmap> pBitmap(m_pTransformer->DetachBitmap());
if (!pBitmap)
- return FALSE;
+ return false;
if (pBitmap->IsAlphaMask()) {
if (m_BitmapAlpha != 255)
@@ -931,19 +931,19 @@ FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause) {
pBitmap.get(), m_pTransformer->result().left,
m_pTransformer->result().top, m_BlendType);
}
- return FALSE;
+ return false;
}
if (m_Status == 3)
return m_pRenderStatus->m_pDevice->ContinueDIBits(m_DeviceHandle, pPause);
if (m_Status == 4) {
if (m_Loader.Continue(m_LoadHandle.get(), pPause))
- return TRUE;
+ return true;
if (StartRenderDIBSource())
return Continue(pPause);
}
- return FALSE;
+ return false;
}
CCodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
@@ -978,7 +978,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict,
form.ParseContent(nullptr, nullptr, nullptr);
CFX_FxgeDevice bitmap_device;
- FX_BOOL bLuminosity = pSMaskDict->GetStringFor("S") != "Alpha";
+ bool bLuminosity = pSMaskDict->GetStringFor("S") != "Alpha";
int width = pClipRect->right - pClipRect->left;
int height = pClipRect->bottom - pClipRect->top;
FXDIB_Format format;
@@ -1042,7 +1042,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict,
options.m_ColorMode = bLuminosity ? RENDER_COLOR_NORMAL : RENDER_COLOR_ALPHA;
CPDF_RenderStatus status;
status.Initialize(m_pContext, &bitmap_device, nullptr, nullptr, nullptr,
- nullptr, &options, 0, m_bDropObjects, pFormResource, TRUE,
+ nullptr, &options, 0, m_bDropObjects, pFormResource, true,
nullptr, 0, color_space_family, bLuminosity);
status.RenderObjectList(&form, &matrix);
std::unique_ptr<CFX_DIBitmap> pMask(new CFX_DIBitmap);
diff --git a/core/fpdfapi/render/fpdf_render_loadimage.cpp b/core/fpdfapi/render/fpdf_render_loadimage.cpp
index 553481db60..c3fe99018c 100644
--- a/core/fpdfapi/render/fpdf_render_loadimage.cpp
+++ b/core/fpdfapi/render/fpdf_render_loadimage.cpp
@@ -102,13 +102,13 @@ CPDF_DIBSource::CPDF_DIBSource()
m_nComponents(0),
m_GroupFamily(0),
m_MatteColor(0),
- m_bLoadMask(FALSE),
- m_bDefaultDecode(TRUE),
- m_bImageMask(FALSE),
- m_bDoBpcCheck(TRUE),
- m_bColorKey(FALSE),
- m_bHasMask(FALSE),
- m_bStdCS(FALSE),
+ m_bLoadMask(false),
+ m_bDefaultDecode(true),
+ m_bImageMask(false),
+ m_bDoBpcCheck(true),
+ m_bColorKey(false),
+ m_bHasMask(false),
+ m_bStdCS(false),
m_pCompData(nullptr),
m_pLineBuf(nullptr),
m_pMaskedLine(nullptr),
@@ -137,51 +137,51 @@ void CPDF_DIBSource::ReleaseBitmap(CFX_DIBitmap* pBitmap) const {
}
}
-FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc,
- const CPDF_Stream* pStream,
- CPDF_DIBSource** ppMask,
- uint32_t* pMatteColor,
- CPDF_Dictionary* pFormResources,
- CPDF_Dictionary* pPageResources,
- FX_BOOL bStdCS,
- uint32_t GroupFamily,
- FX_BOOL bLoadMask) {
+bool CPDF_DIBSource::Load(CPDF_Document* pDoc,
+ const CPDF_Stream* pStream,
+ CPDF_DIBSource** ppMask,
+ uint32_t* pMatteColor,
+ CPDF_Dictionary* pFormResources,
+ CPDF_Dictionary* pPageResources,
+ bool bStdCS,
+ uint32_t GroupFamily,
+ bool bLoadMask) {
if (!pStream) {
- return FALSE;
+ return false;
}
m_pDocument = pDoc;
m_pDict = pStream->GetDict();
if (!m_pDict) {
- return FALSE;
+ return false;
}
m_pStream = pStream;
m_Width = m_pDict->GetIntegerFor("Width");
m_Height = m_pDict->GetIntegerFor("Height");
if (m_Width <= 0 || m_Height <= 0 || m_Width > kMaxImageDimension ||
m_Height > kMaxImageDimension) {
- return FALSE;
+ return false;
}
m_GroupFamily = GroupFamily;
m_bLoadMask = bLoadMask;
if (!LoadColorInfo(m_pStream->IsInline() ? pFormResources : nullptr,
pPageResources)) {
- return FALSE;
+ return false;
}
if (m_bDoBpcCheck && (m_bpc == 0 || m_nComponents == 0)) {
- return FALSE;
+ return false;
}
FX_SAFE_UINT32 src_size =
CalculatePitch8(m_bpc, m_nComponents, m_Width) * m_Height;
if (!src_size.IsValid()) {
- return FALSE;
+ return false;
}
m_pStreamAcc.reset(new CPDF_StreamAcc);
- m_pStreamAcc->LoadAllData(pStream, FALSE, src_size.ValueOrDie(), TRUE);
+ m_pStreamAcc->LoadAllData(pStream, false, src_size.ValueOrDie(), true);
if (m_pStreamAcc->GetSize() == 0 || !m_pStreamAcc->GetData()) {
- return FALSE;
+ return false;
}
if (!CreateDecoder()) {
- return FALSE;
+ return false;
}
if (m_bImageMask) {
m_bpp = 1;
@@ -197,11 +197,11 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc,
}
FX_SAFE_UINT32 pitch = CalculatePitch32(m_bpp, m_Width);
if (!pitch.IsValid()) {
- return FALSE;
+ return false;
}
m_pLineBuf = FX_Alloc(uint8_t, pitch.ValueOrDie());
if (m_pColorSpace && bStdCS) {
- m_pColorSpace->EnableStdConversion(TRUE);
+ m_pColorSpace->EnableStdConversion(true);
}
LoadPalette();
if (m_bColorKey) {
@@ -209,7 +209,7 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc,
m_AlphaFlag = 2;
pitch = CalculatePitch32(m_bpp, m_Width);
if (!pitch.IsValid()) {
- return FALSE;
+ return false;
}
m_pMaskedLine = FX_Alloc(uint8_t, pitch.ValueOrDie());
}
@@ -218,9 +218,9 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc,
*ppMask = LoadMask(*pMatteColor);
}
if (m_pColorSpace && bStdCS) {
- m_pColorSpace->EnableStdConversion(FALSE);
+ m_pColorSpace->EnableStdConversion(false);
}
- return TRUE;
+ return true;
}
int CPDF_DIBSource::ContinueToLoadMask() {
@@ -245,7 +245,7 @@ int CPDF_DIBSource::ContinueToLoadMask() {
}
m_pLineBuf = FX_Alloc(uint8_t, pitch.ValueOrDie());
if (m_pColorSpace && m_bStdCS) {
- m_pColorSpace->EnableStdConversion(TRUE);
+ m_pColorSpace->EnableStdConversion(true);
}
LoadPalette();
if (m_bColorKey) {
@@ -263,12 +263,12 @@ int CPDF_DIBSource::ContinueToLoadMask() {
int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc,
const CPDF_Stream* pStream,
- FX_BOOL bHasMask,
+ bool bHasMask,
CPDF_Dictionary* pFormResources,
CPDF_Dictionary* pPageResources,
- FX_BOOL bStdCS,
+ bool bStdCS,
uint32_t GroupFamily,
- FX_BOOL bLoadMask) {
+ bool bLoadMask) {
if (!pStream) {
return 0;
}
@@ -298,7 +298,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc,
return 0;
}
m_pStreamAcc.reset(new CPDF_StreamAcc);
- m_pStreamAcc->LoadAllData(pStream, FALSE, src_size.ValueOrDie(), TRUE);
+ m_pStreamAcc->LoadAllData(pStream, false, src_size.ValueOrDie(), true);
if (m_pStreamAcc->GetSize() == 0 || !m_pStreamAcc->GetData()) {
return 0;
}
@@ -325,7 +325,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc,
return ret;
}
if (m_pColorSpace && m_bStdCS) {
- m_pColorSpace->EnableStdConversion(FALSE);
+ m_pColorSpace->EnableStdConversion(false);
}
return ret;
}
@@ -345,7 +345,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) {
m_pStreamAcc->GetImageParam()->GetStreamFor("JBIG2Globals");
if (pGlobals) {
m_pGlobalStream.reset(new CPDF_StreamAcc);
- m_pGlobalStream->LoadAllData(pGlobals, FALSE);
+ m_pGlobalStream->LoadAllData(pGlobals, false);
}
}
ret = pJbig2Module->StartDecode(
@@ -370,7 +370,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) {
return ret1;
}
if (m_pColorSpace && m_bStdCS) {
- m_pColorSpace->EnableStdConversion(FALSE);
+ m_pColorSpace->EnableStdConversion(false);
}
return ret1;
}
@@ -393,7 +393,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) {
return ret1;
}
if (m_pColorSpace && m_bStdCS) {
- m_pColorSpace->EnableStdConversion(FALSE);
+ m_pColorSpace->EnableStdConversion(false);
}
return ret1;
}
@@ -407,7 +407,7 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources,
const CPDF_Dictionary* pPageResources) {
m_bpc_orig = m_pDict->GetIntegerFor("BitsPerComponent");
if (m_pDict->GetIntegerFor("ImageMask"))
- m_bImageMask = TRUE;
+ m_bImageMask = true;
if (m_bImageMask || !m_pDict->KeyExist("ColorSpace")) {
if (!m_bImageMask) {
@@ -421,12 +421,12 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources,
}
if (filter == "JPXDecode") {
- m_bDoBpcCheck = FALSE;
+ m_bDoBpcCheck = false;
return true;
}
}
}
- m_bImageMask = TRUE;
+ m_bImageMask = true;
m_bpc = m_nComponents = 1;
CPDF_Array* pDecode = m_pDict->GetArrayFor("Decode");
m_bDefaultDecode = !pDecode || !pDecode->GetIntegerAt(0);
@@ -462,8 +462,8 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources,
return !!m_pCompData;
}
-DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode,
- FX_BOOL& bColorKey) {
+DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(bool& bDefaultDecode,
+ bool& bColorKey) {
if (!m_pColorSpace) {
return nullptr;
}
@@ -483,7 +483,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode,
def_max = max_data;
}
if (def_min != pCompData[i].m_DecodeMin || def_max != max) {
- bDefaultDecode = FALSE;
+ bDefaultDecode = false;
}
}
} else {
@@ -512,7 +512,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode,
pCompData[i].m_ColorKeyMax = std::min(max_num, max_data);
}
}
- bColorKey = TRUE;
+ bColorKey = true;
}
}
return pCompData;
@@ -635,18 +635,18 @@ void CPDF_DIBSource::LoadJpxBitmap() {
if (static_cast<int>(width) < m_Width || static_cast<int>(height) < m_Height)
return;
- FX_BOOL bSwapRGB = FALSE;
+ bool bSwapRGB = false;
if (m_pColorSpace) {
if (components != m_pColorSpace->CountComponents())
return;
if (m_pColorSpace == CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB)) {
- bSwapRGB = TRUE;
+ bSwapRGB = true;
m_pColorSpace = nullptr;
}
} else {
if (components == 3) {
- bSwapRGB = TRUE;
+ bSwapRGB = true;
} else if (components == 4) {
m_pColorSpace = CPDF_ColorSpace::GetStockCS(PDFCS_DEVICECMYK);
}
@@ -755,7 +755,7 @@ int CPDF_DIBSource::ContinueLoadMaskDIB(IFX_Pause* pPause) {
return ret;
}
if (m_pColorSpace && m_bStdCS) {
- m_pColorSpace->EnableStdConversion(FALSE);
+ m_pColorSpace->EnableStdConversion(false);
}
if (!ret) {
delete m_pMask;
@@ -774,7 +774,7 @@ CPDF_DIBSource* CPDF_DIBSource::DetachMask() {
CPDF_DIBSource* CPDF_DIBSource::LoadMaskDIB(CPDF_Stream* pMask) {
CPDF_DIBSource* pMaskSource = new CPDF_DIBSource;
if (!pMaskSource->Load(m_pDocument, pMask, nullptr, nullptr, nullptr, nullptr,
- TRUE)) {
+ true)) {
delete pMaskSource;
return nullptr;
}
@@ -783,8 +783,8 @@ CPDF_DIBSource* CPDF_DIBSource::LoadMaskDIB(CPDF_Stream* pMask) {
int CPDF_DIBSource::StartLoadMaskDIB() {
m_pMask = new CPDF_DIBSource;
- int ret = m_pMask->StartLoadDIBSource(m_pDocument, m_pMaskStream, FALSE,
- nullptr, nullptr, TRUE);
+ int ret = m_pMask->StartLoadDIBSource(m_pDocument, m_pMaskStream, false,
+ nullptr, nullptr, true);
if (ret == 2) {
if (m_Status == 0)
m_Status = 2;
@@ -1152,7 +1152,7 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const {
return pSrcLine;
}
-FX_BOOL CPDF_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const {
+bool CPDF_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const {
return m_pDecoder && m_pDecoder->SkipToScanline(line, pPause);
}
@@ -1160,7 +1160,7 @@ void CPDF_DIBSource::DownSampleScanline(int line,
uint8_t* dest_scan,
int dest_bpp,
int dest_width,
- FX_BOOL bFlipX,
+ bool bFlipX,
int clip_left,
int clip_width) const {
if (line < 0 || !dest_scan || dest_bpp <= 0 || dest_width <= 0 ||
@@ -1221,7 +1221,7 @@ void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp,
const uint8_t* pSrcLine,
uint8_t* dest_scan,
int dest_width,
- FX_BOOL bFlipX,
+ bool bFlipX,
int clip_left,
int clip_width) const {
uint32_t set_argb = (uint32_t)-1;
@@ -1300,7 +1300,7 @@ void CPDF_DIBSource::DownSampleScanline8Bit(int orig_Bpp,
const uint8_t* pSrcLine,
uint8_t* dest_scan,
int dest_width,
- FX_BOOL bFlipX,
+ bool bFlipX,
int clip_left,
int clip_width) const {
if (m_bpc < 8) {
@@ -1366,7 +1366,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp,
const uint8_t* pSrcLine,
uint8_t* dest_scan,
int dest_width,
- FX_BOOL bFlipX,
+ bool bFlipX,
int clip_left,
int clip_width) const {
// last_src_x used to store the last seen src_x position which should be
@@ -1411,7 +1411,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp,
if (m_pColorSpace) {
uint8_t color[4];
- const FX_BOOL bTransMask = TransMask();
+ const bool bTransMask = TransMask();
if (m_bDefaultDecode) {
m_pColorSpace->TranslateImageLine(color, pSrcPixel, 1, 0, 0,
bTransMask);
@@ -1462,7 +1462,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp,
}
}
-FX_BOOL CPDF_DIBSource::TransMask() const {
+bool CPDF_DIBSource::TransMask() const {
return m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK &&
m_Family == PDFCS_DEVICECMYK;
}
@@ -1475,21 +1475,21 @@ CPDF_ImageLoaderHandle::CPDF_ImageLoaderHandle() {
CPDF_ImageLoaderHandle::~CPDF_ImageLoaderHandle() {}
-FX_BOOL CPDF_ImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader,
- const CPDF_ImageObject* pImage,
- CPDF_PageRenderCache* pCache,
- FX_BOOL bStdCS,
- uint32_t GroupFamily,
- FX_BOOL bLoadMask,
- CPDF_RenderStatus* pRenderStatus,
- int32_t nDownsampleWidth,
- int32_t nDownsampleHeight) {
+bool CPDF_ImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader,
+ const CPDF_ImageObject* pImage,
+ CPDF_PageRenderCache* pCache,
+ bool bStdCS,
+ uint32_t GroupFamily,
+ bool bLoadMask,
+ CPDF_RenderStatus* pRenderStatus,
+ int32_t nDownsampleWidth,
+ int32_t nDownsampleHeight) {
m_pImageLoader = pImageLoader;
m_pCache = pCache;
m_pImage = const_cast<CPDF_ImageObject*>(pImage);
m_nDownsampleWidth = nDownsampleWidth;
m_nDownsampleHeight = nDownsampleHeight;
- FX_BOOL ret;
+ bool ret;
if (pCache) {
ret = pCache->StartGetCachedBitmap(
m_pImage->GetImage()->GetStream(), bStdCS, GroupFamily, bLoadMask,
@@ -1504,9 +1504,9 @@ FX_BOOL CPDF_ImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader,
return ret;
}
-FX_BOOL CPDF_ImageLoaderHandle::Continue(IFX_Pause* pPause) {
- FX_BOOL ret = m_pCache ? m_pCache->Continue(pPause)
- : m_pImage->GetImage()->Continue(pPause);
+bool CPDF_ImageLoaderHandle::Continue(IFX_Pause* pPause) {
+ bool ret = m_pCache ? m_pCache->Continue(pPause)
+ : m_pImage->GetImage()->Continue(pPause);
if (!ret)
HandleFailure();
return ret;
@@ -1515,26 +1515,26 @@ FX_BOOL CPDF_ImageLoaderHandle::Continue(IFX_Pause* pPause) {
void CPDF_ImageLoaderHandle::HandleFailure() {
if (m_pCache) {
CPDF_ImageCacheEntry* entry = m_pCache->GetCurImageCacheEntry();
- m_pImageLoader->m_bCached = TRUE;
+ m_pImageLoader->m_bCached = true;
m_pImageLoader->m_pBitmap = entry->DetachBitmap();
m_pImageLoader->m_pMask = entry->DetachMask();
m_pImageLoader->m_MatteColor = entry->m_MatteColor;
} else {
CPDF_Image* pImage = m_pImage->GetImage();
- m_pImageLoader->m_bCached = FALSE;
+ m_pImageLoader->m_bCached = false;
m_pImageLoader->m_pBitmap = pImage->DetachBitmap();
m_pImageLoader->m_pMask = pImage->DetachMask();
m_pImageLoader->m_MatteColor = pImage->m_MatteColor;
}
}
-FX_BOOL CPDF_ImageLoader::Start(
+bool CPDF_ImageLoader::Start(
const CPDF_ImageObject* pImage,
CPDF_PageRenderCache* pCache,
std::unique_ptr<CPDF_ImageLoaderHandle>* pLoadHandle,
- FX_BOOL bStdCS,
+ bool bStdCS,
uint32_t GroupFamily,
- FX_BOOL bLoadMask,
+ bool bLoadMask,
CPDF_RenderStatus* pRenderStatus,
int32_t nDownsampleWidth,
int32_t nDownsampleHeight) {
@@ -1546,8 +1546,8 @@ FX_BOOL CPDF_ImageLoader::Start(
pRenderStatus, m_nDownsampleWidth, m_nDownsampleHeight);
}
-FX_BOOL CPDF_ImageLoader::Continue(CPDF_ImageLoaderHandle* LoadHandle,
- IFX_Pause* pPause) {
+bool CPDF_ImageLoader::Continue(CPDF_ImageLoaderHandle* LoadHandle,
+ IFX_Pause* pPause) {
return LoadHandle->Continue(pPause);
}
diff --git a/core/fpdfapi/render/fpdf_render_pattern.cpp b/core/fpdfapi/render/fpdf_render_pattern.cpp
index 5238550bf5..695c4d91d9 100644
--- a/core/fpdfapi/render/fpdf_render_pattern.cpp
+++ b/core/fpdfapi/render/fpdf_render_pattern.cpp
@@ -61,8 +61,8 @@ void DrawAxialShading(CFX_DIBitmap* pBitmap,
t_min = pArray->GetNumberAt(0);
t_max = pArray->GetNumberAt(1);
}
- FX_BOOL bStartExtend = FALSE;
- FX_BOOL bEndExtend = FALSE;
+ bool bStartExtend = false;
+ bool bEndExtend = false;
pArray = pDict->GetArrayFor("Extend");
if (pArray) {
bStartExtend = !!pArray->GetIntegerAt(0);
@@ -148,8 +148,8 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap,
t_min = pArray->GetNumberAt(0);
t_max = pArray->GetNumberAt(1);
}
- FX_BOOL bStartExtend = FALSE;
- FX_BOOL bEndExtend = FALSE;
+ bool bStartExtend = false;
+ bool bEndExtend = false;
pArray = pDict->GetArrayFor("Extend");
if (pArray) {
bStartExtend = !!pArray->GetIntegerAt(0);
@@ -183,12 +183,12 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap,
int width = pBitmap->GetWidth();
int height = pBitmap->GetHeight();
int pitch = pBitmap->GetPitch();
- FX_BOOL bDecreasing = FALSE;
+ bool bDecreasing = false;
if (start_r > end_r) {
int length = (int)FXSYS_sqrt((((start_x - end_x) * (start_x - end_x)) +
((start_y - end_y) * (start_y - end_y))));
if (length < start_r - end_r) {
- bDecreasing = TRUE;
+ bDecreasing = true;
}
}
for (int row = 0; row < height; row++) {
@@ -315,17 +315,17 @@ bool GetScanlineIntersect(int y,
FX_FLOAT y2,
FX_FLOAT* x) {
if (y1 == y2)
- return FALSE;
+ return false;
if (y1 < y2) {
if (y < y1 || y > y2)
- return FALSE;
+ return false;
} else {
if (y < y2 || y > y1)
- return FALSE;
+ return false;
}
*x = x1 + ((x2 - x1) * (y - y1) / (y2 - y1));
- return TRUE;
+ return true;
}
void DrawGouraud(CFX_DIBitmap* pBitmap,
@@ -650,8 +650,8 @@ struct CPDF_PatchDrawer {
Coon_Bezier C2,
Coon_Bezier D1,
Coon_Bezier D2) {
- FX_BOOL bSmall = C1.Distance() < 2 && C2.Distance() < 2 &&
- D1.Distance() < 2 && D2.Distance() < 2;
+ bool bSmall = C1.Distance() < 2 && C2.Distance() < 2 && D1.Distance() < 2 &&
+ D2.Distance() < 2;
Coon_Color div_colors[4];
int d_bottom = 0;
int d_left = 0;
@@ -850,7 +850,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern,
CFX_Matrix* pMatrix,
FX_RECT& clip_rect,
int alpha,
- FX_BOOL bAlphaMode) {
+ bool bAlphaMode) {
const auto& funcs = pPattern->GetFuncs();
CPDF_Dictionary* pDict = pPattern->GetShadingObject()->GetDict();
CPDF_ColorSpace* pColorSpace = pPattern->GetCS();
@@ -942,7 +942,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern,
void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern,
const CPDF_PageObject* pPageObj,
const CFX_Matrix* pObj2Device,
- FX_BOOL bStroke) {
+ bool bStroke) {
if (!pattern->Load())
return;
@@ -958,7 +958,7 @@ void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern,
return;
}
FX_RECT rect;
- if (GetObjectClippedRect(pPageObj, pObj2Device, FALSE, rect)) {
+ if (GetObjectClippedRect(pPageObj, pObj2Device, false, rect)) {
m_pDevice->RestoreState(false);
return;
}
@@ -991,7 +991,7 @@ void CPDF_RenderStatus::ProcessShading(const CPDF_ShadingObject* pShadingObj,
void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
CPDF_PageObject* pPageObj,
const CFX_Matrix* pObj2Device,
- FX_BOOL bStroke) {
+ bool bStroke) {
if (!pPattern->Load()) {
return;
}
@@ -1019,12 +1019,12 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
CFX_Matrix mtPattern2Device = *pPattern->pattern_to_form();
mtPattern2Device.Concat(*pObj2Device);
GetScaledMatrix(mtPattern2Device);
- FX_BOOL bAligned = FALSE;
+ bool bAligned = false;
if (pPattern->bbox().left == 0 && pPattern->bbox().bottom == 0 &&
pPattern->bbox().right == pPattern->x_step() &&
pPattern->bbox().top == pPattern->y_step() &&
(mtPattern2Device.IsScaled() || mtPattern2Device.Is90Rotated())) {
- bAligned = TRUE;
+ bAligned = true;
}
CFX_FloatRect cell_bbox = pPattern->bbox();
mtPattern2Device.TransformRect(cell_bbox);
@@ -1180,14 +1180,14 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
}
}
CompositeDIBitmap(&screen, clip_box.left, clip_box.top, 0, 255,
- FXDIB_BLEND_NORMAL, FALSE);
+ FXDIB_BLEND_NORMAL, false);
m_pDevice->RestoreState(false);
}
void CPDF_RenderStatus::DrawPathWithPattern(CPDF_PathObject* pPathObj,
const CFX_Matrix* pObj2Device,
const CPDF_Color* pColor,
- FX_BOOL bStroke) {
+ bool bStroke) {
CPDF_Pattern* pattern = pColor->GetPattern();
if (!pattern)
return;
@@ -1201,19 +1201,19 @@ void CPDF_RenderStatus::DrawPathWithPattern(CPDF_PathObject* pPathObj,
void CPDF_RenderStatus::ProcessPathPattern(CPDF_PathObject* pPathObj,
const CFX_Matrix* pObj2Device,
int& filltype,
- FX_BOOL& bStroke) {
+ bool& bStroke) {
if (filltype) {
const CPDF_Color& FillColor = *pPathObj->m_ColorState.GetFillColor();
if (FillColor.IsPattern()) {
- DrawPathWithPattern(pPathObj, pObj2Device, &FillColor, FALSE);
+ DrawPathWithPattern(pPathObj, pObj2Device, &FillColor, false);
filltype = 0;
}
}
if (bStroke) {
const CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor();
if (StrokeColor.IsPattern()) {
- DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE);
- bStroke = FALSE;
+ DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, true);
+ bStroke = false;
}
}
}
diff --git a/core/fpdfapi/render/fpdf_render_text.cpp b/core/fpdfapi/render/fpdf_render_text.cpp
index 7d29f5c87f..86fac2d90f 100644
--- a/core/fpdfapi/render/fpdf_render_text.cpp
+++ b/core/fpdfapi/render/fpdf_render_text.cpp
@@ -31,15 +31,15 @@
#include "core/fxge/cfx_renderdevice.h"
#include "third_party/base/numerics/safe_math.h"
-FX_BOOL CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj,
- const CFX_Matrix* pObj2Device,
- CFX_PathData* pClippingPath) {
+bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj,
+ const CFX_Matrix* pObj2Device,
+ CFX_PathData* pClippingPath) {
if (textobj->m_nChars == 0)
- return TRUE;
+ return true;
const TextRenderingMode text_render_mode = textobj->m_TextState.GetTextMode();
if (text_render_mode == TextRenderingMode::MODE_INVISIBLE)
- return TRUE;
+ return true;
CPDF_Font* pFont = textobj->m_TextState.GetFont();
if (pFont->IsType3Font())
@@ -74,7 +74,7 @@ FX_BOOL CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj,
// realize it. Fall through.
ASSERT(false);
case TextRenderingMode::MODE_CLIP:
- return TRUE;
+ return true;
}
}
FX_ARGB stroke_argb = 0;
@@ -97,13 +97,13 @@ FX_BOOL CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj,
CFX_Matrix text_matrix;
textobj->GetTextMatrix(&text_matrix);
if (!IsAvailableMatrix(text_matrix))
- return TRUE;
+ return true;
FX_FLOAT font_size = textobj->m_TextState.GetFontSize();
if (bPattern) {
DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size,
&text_matrix, bFill, bStroke);
- return TRUE;
+ return true;
}
if (bClip || bStroke) {
const CFX_Matrix* pDeviceMatrix = pObj2Device;
@@ -168,12 +168,12 @@ class CPDF_RefType3Cache {
};
// TODO(npm): Font fallback for type 3 fonts? (Completely separate code!!)
-FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
- const CFX_Matrix* pObj2Device) {
+bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
+ const CFX_Matrix* pObj2Device) {
CPDF_Type3Font* pType3Font = textobj->m_TextState.GetFont()->AsType3Font();
for (int i = 0; i < m_Type3FontCache.GetSize(); ++i) {
if (m_Type3FontCache.GetAt(i) == pType3Font)
- return TRUE;
+ return true;
}
CFX_Matrix dCTM = m_pDevice->GetCTM();
@@ -184,14 +184,14 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
CFX_Matrix char_matrix = pType3Font->GetFontMatrix();
FX_FLOAT font_size = textobj->m_TextState.GetFontSize();
char_matrix.Scale(font_size, font_size);
- FX_ARGB fill_argb = GetFillArgb(textobj, TRUE);
+ FX_ARGB fill_argb = GetFillArgb(textobj, true);
int fill_alpha = FXARGB_A(fill_argb);
int device_class = m_pDevice->GetDeviceClass();
std::vector<FXTEXT_GLYPHPOS> glyphs;
if (device_class == FXDC_DISPLAY)
glyphs.resize(textobj->m_nChars);
else if (fill_alpha < 255)
- return FALSE;
+ return false;
CPDF_RefType3Cache refTypeCache(pType3Font);
uint32_t* pChars = textobj->m_pCharCodes;
@@ -225,7 +225,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
}
glyphs.clear();
}
- CPDF_GraphicStates* pStates = CloneObjStates(textobj, FALSE);
+ CPDF_GraphicStates* pStates = CloneObjStates(textobj, false);
CPDF_RenderOptions Options = m_Options;
Options.m_Flags |= RENDER_FORCE_HALFTONE | RENDER_RECT_AA;
Options.m_Flags &= ~RENDER_FORCE_DOWNSAMPLE;
@@ -239,7 +239,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
status.Initialize(m_pContext, m_pDevice, nullptr, nullptr, this,
pStates, &Options,
pType3Char->m_pForm->m_Transparency, m_bDropObjects,
- pFormResource, FALSE, pType3Char, fill_argb);
+ pFormResource, false, pType3Char, fill_argb);
status.m_Type3FontCache.Append(m_Type3FontCache);
status.m_Type3FontCache.Add(pType3Font);
m_pDevice->SaveState();
@@ -253,14 +253,14 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
if (!bitmap_device.Create((int)(rect.Width() * sa),
(int)(rect.Height() * sd), FXDIB_Argb,
nullptr)) {
- return TRUE;
+ return true;
}
bitmap_device.GetBitmap()->Clear(0);
CPDF_RenderStatus status;
status.Initialize(m_pContext, &bitmap_device, nullptr, nullptr, this,
pStates, &Options,
pType3Char->m_pForm->m_Transparency, m_bDropObjects,
- pFormResource, FALSE, pType3Char, fill_argb);
+ pFormResource, false, pType3Char, fill_argb);
status.m_Type3FontCache.Append(m_Type3FontCache);
status.m_Type3FontCache.Add(pType3Font);
matrix.TranslateI(-rect.left, -rect.top);
@@ -292,23 +292,23 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
image_matrix.Concat(matrix);
CPDF_ImageRenderer renderer;
if (renderer.Start(this, pType3Char->m_pBitmap.get(), fill_argb, 255,
- &image_matrix, 0, FALSE)) {
+ &image_matrix, 0, false)) {
renderer.Continue(nullptr);
}
if (!renderer.m_Result)
- return FALSE;
+ return false;
}
}
}
if (glyphs.empty())
- return TRUE;
+ return true;
FX_RECT rect = FXGE_GetGlyphsBBox(glyphs, 0, sa, sd);
CFX_DIBitmap bitmap;
if (!bitmap.Create(static_cast<int>(rect.Width() * sa),
static_cast<int>(rect.Height() * sd), FXDIB_8bppMask)) {
- return TRUE;
+ return true;
}
bitmap.Clear(0);
for (const FXTEXT_GLYPHPOS& glyph : glyphs) {
@@ -333,10 +333,10 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
glyph.m_pGlyph->m_Bitmap.GetWidth(),
glyph.m_pGlyph->m_Bitmap.GetHeight(),
&glyph.m_pGlyph->m_Bitmap, fill_argb, 0, 0,
- FXDIB_BLEND_NORMAL, nullptr, FALSE, 0, nullptr);
+ FXDIB_BLEND_NORMAL, nullptr, false, 0, nullptr);
}
m_pDevice->SetBitMask(&bitmap, rect.left, rect.top, fill_argb);
- return TRUE;
+ return true;
}
class CPDF_CharPosList {
@@ -368,7 +368,7 @@ void CPDF_CharPosList::Load(int nChars,
m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, nChars);
m_nChars = 0;
CPDF_CIDFont* pCIDFont = pFont->AsCIDFont();
- FX_BOOL bVertWriting = pCIDFont && pCIDFont->IsVertWriting();
+ bool bVertWriting = pCIDFont && pCIDFont->IsVertWriting();
for (int iChar = 0; iChar < nChars; iChar++) {
uint32_t CharCode =
nChars == 1 ? (uint32_t)(uintptr_t)pCharCodes : pCharCodes[iChar];
@@ -400,7 +400,7 @@ void CPDF_CharPosList::Load(int nChars,
}
charpos.m_OriginX = iChar ? pCharPos[iChar - 1] : 0;
charpos.m_OriginY = 0;
- charpos.m_bGlyphAdjust = FALSE;
+ charpos.m_bGlyphAdjust = false;
if (!pCIDFont) {
continue;
}
@@ -423,29 +423,29 @@ void CPDF_CharPosList::Load(int nChars,
pCIDFont->CIDTransformToFloat(pTransform[4]) * FontSize;
charpos.m_OriginY +=
pCIDFont->CIDTransformToFloat(pTransform[5]) * FontSize;
- charpos.m_bGlyphAdjust = TRUE;
+ charpos.m_bGlyphAdjust = true;
}
}
}
// static
-FX_BOOL CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice,
- int nChars,
- uint32_t* pCharCodes,
- FX_FLOAT* pCharPos,
- CPDF_Font* pFont,
- FX_FLOAT font_size,
- const CFX_Matrix* pText2User,
- const CFX_Matrix* pUser2Device,
- const CFX_GraphStateData* pGraphState,
- FX_ARGB fill_argb,
- FX_ARGB stroke_argb,
- CFX_PathData* pClippingPath,
- int nFlag) {
+bool CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice,
+ int nChars,
+ uint32_t* pCharCodes,
+ FX_FLOAT* pCharPos,
+ CPDF_Font* pFont,
+ FX_FLOAT font_size,
+ const CFX_Matrix* pText2User,
+ const CFX_Matrix* pUser2Device,
+ const CFX_GraphStateData* pGraphState,
+ FX_ARGB fill_argb,
+ FX_ARGB stroke_argb,
+ CFX_PathData* pClippingPath,
+ int nFlag) {
CPDF_CharPosList CharPosList;
CharPosList.Load(nChars, pCharCodes, pCharPos, pFont, font_size);
if (CharPosList.m_nChars == 0)
- return TRUE;
+ return true;
bool bDraw = true;
int32_t fontPosition = CharPosList.m_pCharPos[0].m_FallbackFontPosition;
uint32_t startIndex = 0;
@@ -535,19 +535,19 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice,
}
// static
-FX_BOOL CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice,
- int nChars,
- uint32_t* pCharCodes,
- FX_FLOAT* pCharPos,
- CPDF_Font* pFont,
- FX_FLOAT font_size,
- const CFX_Matrix* pText2Device,
- FX_ARGB fill_argb,
- const CPDF_RenderOptions* pOptions) {
+bool CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice,
+ int nChars,
+ uint32_t* pCharCodes,
+ FX_FLOAT* pCharPos,
+ CPDF_Font* pFont,
+ FX_FLOAT font_size,
+ const CFX_Matrix* pText2Device,
+ FX_ARGB fill_argb,
+ const CPDF_RenderOptions* pOptions) {
CPDF_CharPosList CharPosList;
CharPosList.Load(nChars, pCharCodes, pCharPos, pFont, font_size);
if (CharPosList.m_nChars == 0)
- return TRUE;
+ return true;
int FXGE_flags = 0;
if (pOptions) {
uint32_t dwFlags = pOptions->m_Flags;
@@ -609,13 +609,13 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj,
CPDF_Font* pFont,
FX_FLOAT font_size,
const CFX_Matrix* pTextMatrix,
- FX_BOOL bFill,
- FX_BOOL bStroke) {
+ bool bFill,
+ bool bStroke) {
if (!bStroke) {
CPDF_PathObject path;
std::vector<std::unique_ptr<CPDF_TextObject>> pCopy;
pCopy.push_back(std::unique_ptr<CPDF_TextObject>(textobj->Clone()));
- path.m_bStroke = FALSE;
+ path.m_bStroke = false;
path.m_FillType = FXFILL_WINDING;
path.m_ClipPath.AppendTexts(&pCopy);
path.m_ColorState = textobj->m_ColorState;
diff --git a/core/fpdfapi/render/render_int.h b/core/fpdfapi/render/render_int.h
index 9c5a7e919b..e6090e8ebe 100644
--- a/core/fpdfapi/render/render_int.h
+++ b/core/fpdfapi/render/render_int.h
@@ -49,18 +49,17 @@ class CPDF_Type3Glyphs;
class CPDF_Type3Char;
class CPDF_Type3Font;
-FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix);
+bool IsAvailableMatrix(const CFX_Matrix& matrix);
class CPDF_TransferFunc {
public:
explicit CPDF_TransferFunc(CPDF_Document* pDoc);
FX_COLORREF TranslateColor(FX_COLORREF src) const;
- CFX_DIBSource* TranslateImage(const CFX_DIBSource* pSrc,
- FX_BOOL bAutoDropSrc);
+ CFX_DIBSource* TranslateImage(const CFX_DIBSource* pSrc, bool bAutoDropSrc);
CPDF_Document* const m_pPDFDoc;
- FX_BOOL m_bIdentity;
+ bool m_bIdentity;
uint8_t m_Samples[256 * 3];
};
@@ -70,7 +69,7 @@ class CPDF_DocRenderData {
~CPDF_DocRenderData();
CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont);
CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObj);
- void Clear(FX_BOOL bRelease = FALSE);
+ void Clear(bool bRelease = false);
void ReleaseCachedType3(CPDF_Type3Font* pFont);
void ReleaseTransferFunc(CPDF_Object* pObj);
@@ -90,27 +89,27 @@ class CPDF_RenderStatus {
CPDF_RenderStatus();
~CPDF_RenderStatus();
- FX_BOOL Initialize(class CPDF_RenderContext* pContext,
- CFX_RenderDevice* pDevice,
- const CFX_Matrix* pDeviceMatrix,
- const CPDF_PageObject* pStopObj,
- const CPDF_RenderStatus* pParentStatus,
- const CPDF_GraphicStates* pInitialStates,
- const CPDF_RenderOptions* pOptions,
- int transparency,
- FX_BOOL bDropObjects,
- CPDF_Dictionary* pFormResource = nullptr,
- FX_BOOL bStdCS = FALSE,
- CPDF_Type3Char* pType3Char = nullptr,
- FX_ARGB fill_color = 0,
- uint32_t GroupFamily = 0,
- FX_BOOL bLoadMask = FALSE);
+ bool Initialize(class CPDF_RenderContext* pContext,
+ CFX_RenderDevice* pDevice,
+ const CFX_Matrix* pDeviceMatrix,
+ const CPDF_PageObject* pStopObj,
+ const CPDF_RenderStatus* pParentStatus,
+ const CPDF_GraphicStates* pInitialStates,
+ const CPDF_RenderOptions* pOptions,
+ int transparency,
+ bool bDropObjects,
+ CPDF_Dictionary* pFormResource = nullptr,
+ bool bStdCS = false,
+ CPDF_Type3Char* pType3Char = nullptr,
+ FX_ARGB fill_color = 0,
+ uint32_t GroupFamily = 0,
+ bool bLoadMask = false);
void RenderObjectList(const CPDF_PageObjectHolder* pObjectHolder,
const CFX_Matrix* pObj2Device);
void RenderSingleObject(CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device);
- FX_BOOL ContinueSingleObject(CPDF_PageObject* pObj,
- const CFX_Matrix* pObj2Device,
- IFX_Pause* pPause);
+ bool ContinueSingleObject(CPDF_PageObject* pObj,
+ const CFX_Matrix* pObj2Device,
+ IFX_Pause* pPause);
CPDF_RenderContext* GetContext() { return m_pContext; }
#if defined _SKIA_SUPPORT_
@@ -128,46 +127,44 @@ class CPDF_RenderStatus {
void ProcessClipPath(CPDF_ClipPath ClipPath, const CFX_Matrix* pObj2Device);
void DrawClipPath(CPDF_ClipPath ClipPath, const CFX_Matrix* pObj2Device);
- FX_BOOL ProcessTransparency(CPDF_PageObject* PageObj,
- const CFX_Matrix* pObj2Device);
+ bool ProcessTransparency(CPDF_PageObject* PageObj,
+ const CFX_Matrix* pObj2Device);
void ProcessObjectNoClip(CPDF_PageObject* PageObj,
const CFX_Matrix* pObj2Device);
void DrawObjWithBackground(CPDF_PageObject* pObj,
const CFX_Matrix* pObj2Device);
- FX_BOOL DrawObjWithBlend(CPDF_PageObject* pObj,
- const CFX_Matrix* pObj2Device);
- FX_BOOL ProcessPath(CPDF_PathObject* pPathObj, const CFX_Matrix* pObj2Device);
+ bool DrawObjWithBlend(CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device);
+ bool ProcessPath(CPDF_PathObject* pPathObj, const CFX_Matrix* pObj2Device);
void ProcessPathPattern(CPDF_PathObject* pPathObj,
const CFX_Matrix* pObj2Device,
int& filltype,
- FX_BOOL& bStroke);
+ bool& bStroke);
void DrawPathWithPattern(CPDF_PathObject* pPathObj,
const CFX_Matrix* pObj2Device,
const CPDF_Color* pColor,
- FX_BOOL bStroke);
+ bool bStroke);
void DrawTilingPattern(CPDF_TilingPattern* pPattern,
CPDF_PageObject* pPageObj,
const CFX_Matrix* pObj2Device,
- FX_BOOL bStroke);
+ bool bStroke);
void DrawShadingPattern(CPDF_ShadingPattern* pPattern,
const CPDF_PageObject* pPageObj,
const CFX_Matrix* pObj2Device,
- FX_BOOL bStroke);
- FX_BOOL SelectClipPath(const CPDF_PathObject* pPathObj,
- const CFX_Matrix* pObj2Device,
- FX_BOOL bStroke);
- FX_BOOL ProcessImage(CPDF_ImageObject* pImageObj,
- const CFX_Matrix* pObj2Device);
- FX_BOOL OutputBitmapAlpha(CPDF_ImageObject* pImageObj,
- const CFX_Matrix* pImage2Device);
- FX_BOOL OutputImage(CPDF_ImageObject* pImageObj,
- const CFX_Matrix* pImage2Device);
- FX_BOOL OutputDIBSource(const CFX_DIBSource* pOutputBitmap,
- FX_ARGB fill_argb,
- int bitmap_alpha,
- const CFX_Matrix* pImage2Device,
- CPDF_ImageCacheEntry* pImageCache,
- uint32_t flags);
+ bool bStroke);
+ bool SelectClipPath(const CPDF_PathObject* pPathObj,
+ const CFX_Matrix* pObj2Device,
+ bool bStroke);
+ bool ProcessImage(CPDF_ImageObject* pImageObj, const CFX_Matrix* pObj2Device);
+ bool OutputBitmapAlpha(CPDF_ImageObject* pImageObj,
+ const CFX_Matrix* pImage2Device);
+ bool OutputImage(CPDF_ImageObject* pImageObj,
+ const CFX_Matrix* pImage2Device);
+ bool OutputDIBSource(const CFX_DIBSource* pOutputBitmap,
+ FX_ARGB fill_argb,
+ int bitmap_alpha,
+ const CFX_Matrix* pImage2Device,
+ CPDF_ImageCacheEntry* pImageCache,
+ uint32_t flags);
void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
int left,
int top,
@@ -181,47 +178,47 @@ class CPDF_RenderStatus {
CFX_Matrix* pMatrix,
FX_RECT& clip_rect,
int alpha,
- FX_BOOL bAlphaMode);
- FX_BOOL ProcessType3Text(CPDF_TextObject* textobj,
- const CFX_Matrix* pObj2Device);
- FX_BOOL ProcessText(CPDF_TextObject* textobj,
- const CFX_Matrix* pObj2Device,
- CFX_PathData* pClippingPath);
+ bool bAlphaMode);
+ bool ProcessType3Text(CPDF_TextObject* textobj,
+ const CFX_Matrix* pObj2Device);
+ bool ProcessText(CPDF_TextObject* textobj,
+ const CFX_Matrix* pObj2Device,
+ CFX_PathData* pClippingPath);
void DrawTextPathWithPattern(const CPDF_TextObject* textobj,
const CFX_Matrix* pObj2Device,
CPDF_Font* pFont,
FX_FLOAT font_size,
const CFX_Matrix* pTextMatrix,
- FX_BOOL bFill,
- FX_BOOL bStroke);
- FX_BOOL ProcessForm(const CPDF_FormObject* pFormObj,
- const CFX_Matrix* pObj2Device);
+ bool bFill,
+ bool bStroke);
+ bool ProcessForm(const CPDF_FormObject* pFormObj,
+ const CFX_Matrix* pObj2Device);
CFX_DIBitmap* GetBackdrop(const CPDF_PageObject* pObj,
const FX_RECT& rect,
int& left,
int& top,
- FX_BOOL bBackAlphaRequired);
+ bool bBackAlphaRequired);
CFX_DIBitmap* LoadSMask(CPDF_Dictionary* pSMaskDict,
FX_RECT* pClipRect,
const CFX_Matrix* pMatrix);
void Init(CPDF_RenderContext* pParent);
static class CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont);
static CPDF_GraphicStates* CloneObjStates(const CPDF_GraphicStates* pPathObj,
- FX_BOOL bStroke);
+ bool bStroke);
CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObject) const;
- FX_ARGB GetFillArgb(CPDF_PageObject* pObj, FX_BOOL bType3 = FALSE) const;
+ FX_ARGB GetFillArgb(CPDF_PageObject* pObj, bool bType3 = false) const;
FX_ARGB GetStrokeArgb(CPDF_PageObject* pObj) const;
- FX_BOOL GetObjectClippedRect(const CPDF_PageObject* pObj,
- const CFX_Matrix* pObj2Device,
- FX_BOOL bLogical,
- FX_RECT& rect) const;
+ bool GetObjectClippedRect(const CPDF_PageObject* pObj,
+ const CFX_Matrix* pObj2Device,
+ bool bLogical,
+ FX_RECT& rect) const;
void GetScaledMatrix(CFX_Matrix& matrix) const;
static const int kRenderMaxRecursionDepth = 64;
static int s_CurrentRecursionDepth;
CPDF_RenderContext* m_pContext;
- FX_BOOL m_bStopped;
+ bool m_bStopped;
CFX_RenderDevice* m_pDevice;
CFX_Matrix m_DeviceMatrix;
CPDF_ClipPath m_LastClipPath;
@@ -230,12 +227,12 @@ class CPDF_RenderStatus {
CPDF_GraphicStates m_InitialStates;
int m_HalftoneLimit;
std::unique_ptr<CPDF_ImageRenderer> m_pImageRenderer;
- FX_BOOL m_bPrint;
+ bool m_bPrint;
int m_Transparency;
- FX_BOOL m_bDropObjects;
- FX_BOOL m_bStdCS;
+ bool m_bDropObjects;
+ bool m_bStdCS;
uint32_t m_GroupFamily;
- FX_BOOL m_bLoadMask;
+ bool m_bLoadMask;
CPDF_Type3Char* m_pType3Char;
FX_ARGB m_T3FillColor;
int m_curBlend;
@@ -247,26 +244,26 @@ class CPDF_ImageLoader {
: m_pBitmap(nullptr),
m_pMask(nullptr),
m_MatteColor(0),
- m_bCached(FALSE),
+ m_bCached(false),
m_nDownsampleWidth(0),
m_nDownsampleHeight(0) {}
~CPDF_ImageLoader();
- FX_BOOL Start(const CPDF_ImageObject* pImage,
- CPDF_PageRenderCache* pCache,
- std::unique_ptr<CPDF_ImageLoaderHandle>* pLoadHandle,
- FX_BOOL bStdCS = FALSE,
- uint32_t GroupFamily = 0,
- FX_BOOL bLoadMask = FALSE,
- CPDF_RenderStatus* pRenderStatus = nullptr,
- int32_t nDownsampleWidth = 0,
- int32_t nDownsampleHeight = 0);
- FX_BOOL Continue(CPDF_ImageLoaderHandle* LoadHandle, IFX_Pause* pPause);
+ bool Start(const CPDF_ImageObject* pImage,
+ CPDF_PageRenderCache* pCache,
+ std::unique_ptr<CPDF_ImageLoaderHandle>* pLoadHandle,
+ bool bStdCS = false,
+ uint32_t GroupFamily = 0,
+ bool bLoadMask = false,
+ CPDF_RenderStatus* pRenderStatus = nullptr,
+ int32_t nDownsampleWidth = 0,
+ int32_t nDownsampleHeight = 0);
+ bool Continue(CPDF_ImageLoaderHandle* LoadHandle, IFX_Pause* pPause);
CFX_DIBSource* m_pBitmap;
CFX_DIBSource* m_pMask;
uint32_t m_MatteColor;
- FX_BOOL m_bCached;
+ bool m_bCached;
protected:
int32_t m_nDownsampleWidth;
@@ -278,16 +275,16 @@ class CPDF_ImageLoaderHandle {
CPDF_ImageLoaderHandle();
~CPDF_ImageLoaderHandle();
- FX_BOOL Start(CPDF_ImageLoader* pImageLoader,
- const CPDF_ImageObject* pImage,
- CPDF_PageRenderCache* pCache,
- FX_BOOL bStdCS = FALSE,
- uint32_t GroupFamily = 0,
- FX_BOOL bLoadMask = FALSE,
- CPDF_RenderStatus* pRenderStatus = nullptr,
- int32_t nDownsampleWidth = 0,
- int32_t nDownsampleHeight = 0);
- FX_BOOL Continue(IFX_Pause* pPause);
+ bool Start(CPDF_ImageLoader* pImageLoader,
+ const CPDF_ImageObject* pImage,
+ CPDF_PageRenderCache* pCache,
+ bool bStdCS = false,
+ uint32_t GroupFamily = 0,
+ bool bLoadMask = false,
+ CPDF_RenderStatus* pRenderStatus = nullptr,
+ int32_t nDownsampleWidth = 0,
+ int32_t nDownsampleHeight = 0);
+ bool Continue(IFX_Pause* pPause);
protected:
void HandleFailure();
@@ -304,31 +301,31 @@ class CPDF_ImageRenderer {
CPDF_ImageRenderer();
~CPDF_ImageRenderer();
- FX_BOOL Start(CPDF_RenderStatus* pStatus,
- CPDF_PageObject* pObj,
- const CFX_Matrix* pObj2Device,
- FX_BOOL bStdCS,
- int blendType = FXDIB_BLEND_NORMAL);
- FX_BOOL Continue(IFX_Pause* pPause);
+ bool Start(CPDF_RenderStatus* pStatus,
+ CPDF_PageObject* pObj,
+ const CFX_Matrix* pObj2Device,
+ bool bStdCS,
+ int blendType = FXDIB_BLEND_NORMAL);
+ bool Continue(IFX_Pause* pPause);
- FX_BOOL Start(CPDF_RenderStatus* pStatus,
- const CFX_DIBSource* pDIBSource,
- FX_ARGB bitmap_argb,
- int bitmap_alpha,
- const CFX_Matrix* pImage2Device,
- uint32_t flags,
- FX_BOOL bStdCS,
- int blendType = FXDIB_BLEND_NORMAL);
+ bool Start(CPDF_RenderStatus* pStatus,
+ const CFX_DIBSource* pDIBSource,
+ FX_ARGB bitmap_argb,
+ int bitmap_alpha,
+ const CFX_Matrix* pImage2Device,
+ uint32_t flags,
+ bool bStdCS,
+ int blendType = FXDIB_BLEND_NORMAL);
- FX_BOOL m_Result;
+ bool m_Result;
protected:
- FX_BOOL StartBitmapAlpha();
- FX_BOOL StartDIBSource();
- FX_BOOL StartRenderDIBSource();
- FX_BOOL StartLoadDIBSource();
- FX_BOOL DrawMaskedImage();
- FX_BOOL DrawPatternImage(const CFX_Matrix* pObj2Device);
+ bool StartBitmapAlpha();
+ bool StartDIBSource();
+ bool StartRenderDIBSource();
+ bool StartLoadDIBSource();
+ bool DrawMaskedImage();
+ bool DrawPatternImage(const CFX_Matrix* pObj2Device);
CPDF_RenderStatus* m_pRenderStatus;
CPDF_ImageObject* m_pImageObject;
@@ -339,14 +336,14 @@ class CPDF_ImageRenderer {
const CFX_DIBSource* m_pDIBSource;
std::unique_ptr<CFX_DIBitmap> m_pClone;
int m_BitmapAlpha;
- FX_BOOL m_bPatternColor;
+ bool m_bPatternColor;
CPDF_Pattern* m_pPattern;
FX_ARGB m_FillArgb;
uint32_t m_Flags;
std::unique_ptr<CFX_ImageTransformer> m_pTransformer;
void* m_DeviceHandle;
std::unique_ptr<CPDF_ImageLoaderHandle> m_LoadHandle;
- FX_BOOL m_bStdCS;
+ bool m_bStdCS;
int m_BlendType;
};
@@ -355,12 +352,12 @@ class CPDF_ScaledRenderBuffer {
CPDF_ScaledRenderBuffer();
~CPDF_ScaledRenderBuffer();
- FX_BOOL Initialize(CPDF_RenderContext* pContext,
- CFX_RenderDevice* pDevice,
- const FX_RECT& pRect,
- const CPDF_PageObject* pObj,
- const CPDF_RenderOptions* pOptions = nullptr,
- int max_dpi = 0);
+ bool Initialize(CPDF_RenderContext* pContext,
+ CFX_RenderDevice* pDevice,
+ const FX_RECT& pRect,
+ const CPDF_PageObject* pObj,
+ const CPDF_RenderOptions* pOptions = nullptr,
+ int max_dpi = 0);
CFX_RenderDevice* GetDevice() {
return m_pBitmapDevice ? m_pBitmapDevice.get() : m_pDevice;
}
@@ -380,11 +377,11 @@ class CPDF_DeviceBuffer {
public:
CPDF_DeviceBuffer();
~CPDF_DeviceBuffer();
- FX_BOOL Initialize(CPDF_RenderContext* pContext,
- CFX_RenderDevice* pDevice,
- FX_RECT* pRect,
- const CPDF_PageObject* pObj,
- int max_dpi = 0);
+ bool Initialize(CPDF_RenderContext* pContext,
+ CFX_RenderDevice* pDevice,
+ FX_RECT* pRect,
+ const CPDF_PageObject* pObj,
+ int max_dpi = 0);
void OutputToDevice();
CFX_DIBitmap* GetBitmap() const { return m_pBitmap.get(); }
const CFX_Matrix* GetMatrix() const { return &m_Matrix; }
@@ -404,16 +401,16 @@ class CPDF_ImageCacheEntry {
~CPDF_ImageCacheEntry();
void Reset(const CFX_DIBitmap* pBitmap);
- FX_BOOL GetCachedBitmap(CFX_DIBSource*& pBitmap,
- CFX_DIBSource*& pMask,
- uint32_t& MatteColor,
- CPDF_Dictionary* pPageResources,
- FX_BOOL bStdCS = FALSE,
- uint32_t GroupFamily = 0,
- FX_BOOL bLoadMask = FALSE,
- CPDF_RenderStatus* pRenderStatus = nullptr,
- int32_t downsampleWidth = 0,
- int32_t downsampleHeight = 0);
+ bool GetCachedBitmap(CFX_DIBSource*& pBitmap,
+ CFX_DIBSource*& pMask,
+ uint32_t& MatteColor,
+ CPDF_Dictionary* pPageResources,
+ bool bStdCS = false,
+ uint32_t GroupFamily = 0,
+ bool bLoadMask = false,
+ CPDF_RenderStatus* pRenderStatus = nullptr,
+ int32_t downsampleWidth = 0,
+ int32_t downsampleHeight = 0);
uint32_t EstimateSize() const { return m_dwCacheSize; }
uint32_t GetTimeCount() const { return m_dwTimeCount; }
CPDF_Stream* GetStream() const { return m_pStream; }
@@ -423,9 +420,9 @@ class CPDF_ImageCacheEntry {
public:
int StartGetCachedBitmap(CPDF_Dictionary* pFormResources,
CPDF_Dictionary* pPageResources,
- FX_BOOL bStdCS = FALSE,
+ bool bStdCS = false,
uint32_t GroupFamily = 0,
- FX_BOOL bLoadMask = FALSE,
+ bool bLoadMask = false,
CPDF_RenderStatus* pRenderStatus = nullptr,
int32_t downsampleWidth = 0,
int32_t downsampleHeight = 0);
@@ -459,25 +456,25 @@ class CPDF_DIBSource : public CFX_DIBSource {
CPDF_DIBSource();
~CPDF_DIBSource() override;
- FX_BOOL Load(CPDF_Document* pDoc,
- const CPDF_Stream* pStream,
- CPDF_DIBSource** ppMask,
- uint32_t* pMatteColor,
- CPDF_Dictionary* pFormResources,
- CPDF_Dictionary* pPageResources,
- FX_BOOL bStdCS = FALSE,
- uint32_t GroupFamily = 0,
- FX_BOOL bLoadMask = FALSE);
+ bool Load(CPDF_Document* pDoc,
+ const CPDF_Stream* pStream,
+ CPDF_DIBSource** ppMask,
+ uint32_t* pMatteColor,
+ CPDF_Dictionary* pFormResources,
+ CPDF_Dictionary* pPageResources,
+ bool bStdCS = false,
+ uint32_t GroupFamily = 0,
+ bool bLoadMask = false);
// CFX_DIBSource
- FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const override;
+ bool SkipToScanline(int line, IFX_Pause* pPause) const override;
uint8_t* GetBuffer() const override;
const uint8_t* GetScanline(int line) const override;
void DownSampleScanline(int line,
uint8_t* dest_scan,
int dest_bpp,
int dest_width,
- FX_BOOL bFlipX,
+ bool bFlipX,
int clip_left,
int clip_width) const override;
@@ -487,12 +484,12 @@ class CPDF_DIBSource : public CFX_DIBSource {
int StartLoadDIBSource(CPDF_Document* pDoc,
const CPDF_Stream* pStream,
- FX_BOOL bHasMask,
+ bool bHasMask,
CPDF_Dictionary* pFormResources,
CPDF_Dictionary* pPageResources,
- FX_BOOL bStdCS = FALSE,
+ bool bStdCS = false,
uint32_t GroupFamily = 0,
- FX_BOOL bLoadMask = FALSE);
+ bool bLoadMask = false);
int ContinueLoadDIBSource(IFX_Pause* pPause);
int StratLoadMask();
int StartLoadMaskDIB();
@@ -503,8 +500,7 @@ class CPDF_DIBSource : public CFX_DIBSource {
private:
bool LoadColorInfo(const CPDF_Dictionary* pFormResources,
const CPDF_Dictionary* pPageResources);
- DIB_COMP_DATA* GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode,
- FX_BOOL& bColorKey);
+ DIB_COMP_DATA* GetDecodeAndMaskArray(bool& bDefaultDecode, bool& bColorKey);
CPDF_DIBSource* LoadMask(uint32_t& MatteColor);
CPDF_DIBSource* LoadMaskDIB(CPDF_Stream* pMask);
void LoadJpxBitmap();
@@ -519,7 +515,7 @@ class CPDF_DIBSource : public CFX_DIBSource {
const uint8_t* pSrcLine,
uint8_t* dest_scan,
int dest_width,
- FX_BOOL bFlipX,
+ bool bFlipX,
int clip_left,
int clip_width) const;
void DownSampleScanline8Bit(int orig_Bpp,
@@ -528,7 +524,7 @@ class CPDF_DIBSource : public CFX_DIBSource {
const uint8_t* pSrcLine,
uint8_t* dest_scan,
int dest_width,
- FX_BOOL bFlipX,
+ bool bFlipX,
int clip_left,
int clip_width) const;
void DownSampleScanline32Bit(int orig_Bpp,
@@ -537,10 +533,10 @@ class CPDF_DIBSource : public CFX_DIBSource {
const uint8_t* pSrcLine,
uint8_t* dest_scan,
int dest_width,
- FX_BOOL bFlipX,
+ bool bFlipX,
int clip_left,
int clip_width) const;
- FX_BOOL TransMask() const;
+ bool TransMask() const;
CPDF_Document* m_pDocument;
const CPDF_Stream* m_pStream;
@@ -553,13 +549,13 @@ class CPDF_DIBSource : public CFX_DIBSource {
uint32_t m_nComponents;
uint32_t m_GroupFamily;
uint32_t m_MatteColor;
- FX_BOOL m_bLoadMask;
- FX_BOOL m_bDefaultDecode;
- FX_BOOL m_bImageMask;
- FX_BOOL m_bDoBpcCheck;
- FX_BOOL m_bColorKey;
- FX_BOOL m_bHasMask;
- FX_BOOL m_bStdCS;
+ bool m_bLoadMask;
+ bool m_bDefaultDecode;
+ bool m_bImageMask;
+ bool m_bDoBpcCheck;
+ bool m_bColorKey;
+ bool m_bHasMask;
+ bool m_bStdCS;
DIB_COMP_DATA* m_pCompData;
uint8_t* m_pLineBuf;
uint8_t* m_pMaskedLine;
diff --git a/core/fpdfdoc/cpdf_aaction.cpp b/core/fpdfdoc/cpdf_aaction.cpp
index da654b107d..39120fcdb3 100644
--- a/core/fpdfdoc/cpdf_aaction.cpp
+++ b/core/fpdfdoc/cpdf_aaction.cpp
@@ -14,7 +14,7 @@ const FX_CHAR* g_sAATypes[] = {"E", "X", "D", "U", "Fo", "Bl", "PO", "PC",
} // namespace
-FX_BOOL CPDF_AAction::ActionExist(AActionType eType) const {
+bool CPDF_AAction::ActionExist(AActionType eType) const {
return m_pDict && m_pDict->KeyExist(g_sAATypes[eType]);
}
diff --git a/core/fpdfdoc/cpdf_aaction.h b/core/fpdfdoc/cpdf_aaction.h
index cef39f0407..d615915ee3 100644
--- a/core/fpdfdoc/cpdf_aaction.h
+++ b/core/fpdfdoc/cpdf_aaction.h
@@ -40,7 +40,7 @@ class CPDF_AAction {
CPDF_AAction() : m_pDict(nullptr) {}
explicit CPDF_AAction(CPDF_Dictionary* pDict) : m_pDict(pDict) {}
- FX_BOOL ActionExist(AActionType eType) const;
+ bool ActionExist(AActionType eType) const;
CPDF_Action GetAction(AActionType eType) const;
CPDF_Dictionary* GetDict() const { return m_pDict; }
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index 879353c7b3..80edde8a8f 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -349,13 +349,13 @@ CFX_ByteString CPDF_Annot::AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype) {
return "";
}
-FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage,
- CFX_RenderDevice* pDevice,
- const CFX_Matrix* pUser2Device,
- AppearanceMode mode,
- const CPDF_RenderOptions* pOptions) {
+bool CPDF_Annot::DrawAppearance(CPDF_Page* pPage,
+ CFX_RenderDevice* pDevice,
+ const CFX_Matrix* pUser2Device,
+ AppearanceMode mode,
+ const CPDF_RenderOptions* pOptions) {
if (!ShouldDrawAnnotation())
- return FALSE;
+ return false;
// It might happen that by the time this annotation instance was created,
// it was flagged as "hidden" (e.g. /F 2), and hence CPVT_GenerateAP decided
@@ -368,19 +368,19 @@ FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage,
CPDF_Form* pForm =
FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix);
if (!pForm) {
- return FALSE;
+ return false;
}
CPDF_RenderContext context(pPage);
context.AppendLayer(pForm, &matrix);
context.Render(pDevice, pOptions, nullptr);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_Annot::DrawInContext(const CPDF_Page* pPage,
- CPDF_RenderContext* pContext,
- const CFX_Matrix* pUser2Device,
- AppearanceMode mode) {
+bool CPDF_Annot::DrawInContext(const CPDF_Page* pPage,
+ CPDF_RenderContext* pContext,
+ const CFX_Matrix* pUser2Device,
+ AppearanceMode mode) {
if (!ShouldDrawAnnotation())
- return FALSE;
+ return false;
// It might happen that by the time this annotation instance was created,
// it was flagged as "hidden" (e.g. /F 2), and hence CPVT_GenerateAP decided
@@ -393,10 +393,10 @@ FX_BOOL CPDF_Annot::DrawInContext(const CPDF_Page* pPage,
CPDF_Form* pForm =
FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix);
if (!pForm) {
- return FALSE;
+ return false;
}
pContext->AppendLayer(pForm, &matrix);
- return TRUE;
+ return true;
}
void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
const CFX_Matrix* pUser2Device,
diff --git a/core/fpdfdoc/cpdf_annot.h b/core/fpdfdoc/cpdf_annot.h
index d4bbca91f7..e5404a8c9e 100644
--- a/core/fpdfdoc/cpdf_annot.h
+++ b/core/fpdfdoc/cpdf_annot.h
@@ -83,15 +83,15 @@ class CPDF_Annot {
CPDF_Dictionary* GetAnnotDict() { return m_pAnnotDict; }
CPDF_Document* GetDocument() const { return m_pDocument; }
- FX_BOOL DrawAppearance(CPDF_Page* pPage,
- CFX_RenderDevice* pDevice,
- const CFX_Matrix* pUser2Device,
- AppearanceMode mode,
- const CPDF_RenderOptions* pOptions);
- FX_BOOL DrawInContext(const CPDF_Page* pPage,
- CPDF_RenderContext* pContext,
- const CFX_Matrix* pUser2Device,
- AppearanceMode mode);
+ bool DrawAppearance(CPDF_Page* pPage,
+ CFX_RenderDevice* pDevice,
+ const CFX_Matrix* pUser2Device,
+ AppearanceMode mode,
+ const CPDF_RenderOptions* pOptions);
+ bool DrawInContext(const CPDF_Page* pPage,
+ CPDF_RenderContext* pContext,
+ const CFX_Matrix* pUser2Device,
+ AppearanceMode mode);
void ClearCachedAP();
void DrawBorder(CFX_RenderDevice* pDevice,
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp
index 4821f8e6dd..e89b47705e 100644
--- a/core/fpdfdoc/cpdf_annotlist.cpp
+++ b/core/fpdfdoc/cpdf_annotlist.cpp
@@ -101,9 +101,9 @@ CPDF_AnnotList::~CPDF_AnnotList() {}
void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage,
CFX_RenderDevice* pDevice,
CPDF_RenderContext* pContext,
- FX_BOOL bPrinting,
+ bool bPrinting,
CFX_Matrix* pMatrix,
- FX_BOOL bWidgetPass,
+ bool bWidgetPass,
CPDF_RenderOptions* pOptions,
FX_RECT* clip_rect) {
for (const auto& pAnnot : m_AnnotList) {
@@ -151,26 +151,26 @@ void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage,
void CPDF_AnnotList::DisplayAnnots(CPDF_Page* pPage,
CFX_RenderDevice* pDevice,
CPDF_RenderContext* pContext,
- FX_BOOL bPrinting,
+ bool bPrinting,
CFX_Matrix* pUser2Device,
uint32_t dwAnnotFlags,
CPDF_RenderOptions* pOptions,
FX_RECT* pClipRect) {
if (dwAnnotFlags & ANNOTFLAG_INVISIBLE) {
- DisplayPass(pPage, pDevice, pContext, bPrinting, pUser2Device, FALSE,
+ DisplayPass(pPage, pDevice, pContext, bPrinting, pUser2Device, false,
pOptions, pClipRect);
}
if (dwAnnotFlags & ANNOTFLAG_HIDDEN) {
- DisplayPass(pPage, pDevice, pContext, bPrinting, pUser2Device, TRUE,
+ DisplayPass(pPage, pDevice, pContext, bPrinting, pUser2Device, true,
pOptions, pClipRect);
}
}
void CPDF_AnnotList::DisplayAnnots(CPDF_Page* pPage,
CPDF_RenderContext* pContext,
- FX_BOOL bPrinting,
+ bool bPrinting,
CFX_Matrix* pMatrix,
- FX_BOOL bShowWidget,
+ bool bShowWidget,
CPDF_RenderOptions* pOptions) {
uint32_t dwAnnotFlags = bShowWidget ? ANNOTFLAG_INVISIBLE | ANNOTFLAG_HIDDEN
: ANNOTFLAG_INVISIBLE;
diff --git a/core/fpdfdoc/cpdf_annotlist.h b/core/fpdfdoc/cpdf_annotlist.h
index 2488c68b0b..e17b958517 100644
--- a/core/fpdfdoc/cpdf_annotlist.h
+++ b/core/fpdfdoc/cpdf_annotlist.h
@@ -27,15 +27,15 @@ class CPDF_AnnotList {
void DisplayAnnots(CPDF_Page* pPage,
CPDF_RenderContext* pContext,
- FX_BOOL bPrinting,
+ bool bPrinting,
CFX_Matrix* pMatrix,
- FX_BOOL bShowWidget,
+ bool bShowWidget,
CPDF_RenderOptions* pOptions);
void DisplayAnnots(CPDF_Page* pPage,
CFX_RenderDevice* pDevice,
CPDF_RenderContext* pContext,
- FX_BOOL bPrinting,
+ bool bPrinting,
CFX_Matrix* pMatrix,
uint32_t dwAnnotFlags,
CPDF_RenderOptions* pOptions,
@@ -51,9 +51,9 @@ class CPDF_AnnotList {
void DisplayPass(CPDF_Page* pPage,
CFX_RenderDevice* pDevice,
CPDF_RenderContext* pContext,
- FX_BOOL bPrinting,
+ bool bPrinting,
CFX_Matrix* pMatrix,
- FX_BOOL bWidget,
+ bool bWidget,
CPDF_RenderOptions* pOptions,
FX_RECT* clip_rect);
diff --git a/core/fpdfdoc/cpdf_defaultappearance.cpp b/core/fpdfdoc/cpdf_defaultappearance.cpp
index e1094604fa..130115bdfb 100644
--- a/core/fpdfdoc/cpdf_defaultappearance.cpp
+++ b/core/fpdfdoc/cpdf_defaultappearance.cpp
@@ -10,9 +10,9 @@
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
#include "core/fpdfdoc/cpdf_formcontrol.h"
-FX_BOOL CPDF_DefaultAppearance::HasFont() {
+bool CPDF_DefaultAppearance::HasFont() {
if (m_csDA.IsEmpty())
- return FALSE;
+ return false;
CPDF_SimpleParser syntax(m_csDA.AsStringC());
return syntax.FindTagParamFromStart("Tf", 2);
@@ -50,18 +50,18 @@ void CPDF_DefaultAppearance::GetFont(CFX_ByteString& csFontNameTag,
csFontNameTag = PDF_NameDecode(csFontNameTag);
}
-FX_BOOL CPDF_DefaultAppearance::HasColor(PaintOperation nOperation) {
+bool CPDF_DefaultAppearance::HasColor(PaintOperation nOperation) {
if (m_csDA.IsEmpty())
- return FALSE;
+ return false;
CPDF_SimpleParser syntax(m_csDA.AsStringC());
if (syntax.FindTagParamFromStart(
(nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) {
- return TRUE;
+ return true;
}
if (syntax.FindTagParamFromStart(
(nOperation == PaintOperation::STROKE ? "RG" : "rg"), 3)) {
- return TRUE;
+ return true;
}
return syntax.FindTagParamFromStart(
(nOperation == PaintOperation::STROKE ? "K" : "k"), 4);
@@ -182,9 +182,9 @@ void CPDF_DefaultAppearance::GetColor(FX_ARGB& color,
}
}
-FX_BOOL CPDF_DefaultAppearance::HasTextMatrix() {
+bool CPDF_DefaultAppearance::HasTextMatrix() {
if (m_csDA.IsEmpty())
- return FALSE;
+ return false;
CPDF_SimpleParser syntax(m_csDA.AsStringC());
return syntax.FindTagParamFromStart("Tm", 6);
diff --git a/core/fpdfdoc/cpdf_defaultappearance.h b/core/fpdfdoc/cpdf_defaultappearance.h
index 4507f4f78f..4fd32ebd0c 100644
--- a/core/fpdfdoc/cpdf_defaultappearance.h
+++ b/core/fpdfdoc/cpdf_defaultappearance.h
@@ -27,11 +27,11 @@ class CPDF_DefaultAppearance {
CFX_ByteString GetStr() const { return m_csDA; }
- FX_BOOL HasFont();
+ bool HasFont();
CFX_ByteString GetFontString();
void GetFont(CFX_ByteString& csFontNameTag, FX_FLOAT& fFontSize);
- FX_BOOL HasColor(PaintOperation nOperation = PaintOperation::FILL);
+ bool HasColor(PaintOperation nOperation = PaintOperation::FILL);
CFX_ByteString GetColorString(
PaintOperation nOperation = PaintOperation::FILL);
void GetColor(int& iColorType,
@@ -41,7 +41,7 @@ class CPDF_DefaultAppearance {
int& iColorType,
PaintOperation nOperation = PaintOperation::FILL);
- FX_BOOL HasTextMatrix();
+ bool HasTextMatrix();
CFX_ByteString GetTextMatrixString();
CFX_Matrix GetTextMatrix();
diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp
index d0b4a2dced..b01784b8dd 100644
--- a/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -138,14 +138,14 @@ bool CPDF_FormControl::IsDefaultChecked() const {
GetType() == CPDF_FormField::RadioButton);
CPDF_Object* pDV = FPDF_GetFieldAttr(m_pField->m_pDict, "DV");
if (!pDV)
- return FALSE;
+ return false;
CFX_ByteString csDV = pDV->GetString();
CFX_ByteString csOn = GetOnStateName();
return (csDV == csOn);
}
-void CPDF_FormControl::CheckControl(FX_BOOL bChecked) {
+void CPDF_FormControl::CheckControl(bool bChecked) {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
CFX_ByteString csOn = GetOnStateName();
diff --git a/core/fpdfdoc/cpdf_formcontrol.h b/core/fpdfdoc/cpdf_formcontrol.h
index e86443402d..d24dd04941 100644
--- a/core/fpdfdoc/cpdf_formcontrol.h
+++ b/core/fpdfdoc/cpdf_formcontrol.h
@@ -115,7 +115,7 @@ class CPDF_FormControl {
CFX_ByteString GetOnStateName() const;
void SetOnStateName(const CFX_ByteString& csOn);
- void CheckControl(FX_BOOL bChecked);
+ void CheckControl(bool bChecked);
FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry);
FX_FLOAT GetOriginalColor(int index, const CFX_ByteString& csEntry);
void GetOriginalColor(int& iColorType,
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index dc45fbcec7..e82ef7800e 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -161,7 +161,7 @@ CFX_WideString CPDF_FormField::GetFullName() const {
return FPDF_GetFullName(m_pDict);
}
-FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
+bool CPDF_FormField::ResetField(bool bNotify) {
switch (m_Type) {
case CPDF_FormField::CheckBox:
case CPDF_FormField::RadioButton: {
@@ -171,10 +171,10 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
// unison field. Otherwise, merge these branches.
if (IsUnison(this)) {
for (int i = 0; i < iCount; i++)
- CheckControl(i, GetControl(i)->IsDefaultChecked(), FALSE);
+ CheckControl(i, GetControl(i)->IsDefaultChecked(), false);
} else {
for (int i = 0; i < iCount; i++)
- CheckControl(i, GetControl(i)->IsDefaultChecked(), FALSE);
+ CheckControl(i, GetControl(i)->IsDefaultChecked(), false);
}
}
if (bNotify && m_pForm->m_pFormNotify)
@@ -190,9 +190,9 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
csValue = GetOptionLabel(iIndex);
if (bNotify && !NotifyListOrComboBoxBeforeChange(csValue))
- return FALSE;
+ return false;
- SetItemSelection(iIndex, TRUE);
+ SetItemSelection(iIndex, true);
if (bNotify)
NotifyListOrComboBoxAfterChange();
break;
@@ -213,15 +213,15 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
CPDF_Object* pRV = FPDF_GetFieldAttr(m_pDict, "RV");
if (!pRV && (csDValue == csValue))
- return FALSE;
+ return false;
if (bNotify && !NotifyBeforeValueChange(csDValue))
- return FALSE;
+ return false;
if (pDV) {
CPDF_Object* pClone = pDV->Clone();
if (!pClone)
- return FALSE;
+ return false;
m_pDict->SetFor("V", pClone);
if (pRV) {
@@ -237,7 +237,7 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
break;
}
}
- return TRUE;
+ return true;
}
int CPDF_FormField::GetControlIndex(const CPDF_FormControl* pControl) const {
@@ -305,7 +305,7 @@ CFX_WideString CPDF_FormField::GetRichTextString() const {
return pObj ? pObj->GetUnicodeText() : L"";
}
-CFX_WideString CPDF_FormField::GetValue(FX_BOOL bDefault) const {
+CFX_WideString CPDF_FormField::GetValue(bool bDefault) const {
if (GetType() == CheckBox || GetType() == RadioButton)
return GetCheckValue(bDefault);
@@ -337,21 +337,21 @@ CFX_WideString CPDF_FormField::GetValue(FX_BOOL bDefault) const {
}
CFX_WideString CPDF_FormField::GetValue() const {
- return GetValue(FALSE);
+ return GetValue(false);
}
CFX_WideString CPDF_FormField::GetDefaultValue() const {
- return GetValue(TRUE);
+ return GetValue(true);
}
-FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value,
- FX_BOOL bDefault,
- FX_BOOL bNotify) {
+bool CPDF_FormField::SetValue(const CFX_WideString& value,
+ bool bDefault,
+ bool bNotify) {
switch (m_Type) {
case CheckBox:
case RadioButton: {
SetCheckValue(value, bDefault, bNotify);
- return TRUE;
+ return true;
}
case File:
case RichText:
@@ -359,7 +359,7 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value,
case ComboBox: {
CFX_WideString csValue = value;
if (bNotify && !NotifyBeforeValueChange(csValue))
- return FALSE;
+ return false;
int iIndex = FindOptionValue(csValue);
if (iIndex < 0) {
@@ -372,7 +372,7 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value,
m_pDict->SetStringFor(bDefault ? "DV" : "V", PDF_EncodeText(csValue));
if (!bDefault) {
ClearSelection();
- SetItemSelection(iIndex, TRUE);
+ SetItemSelection(iIndex, true);
}
}
if (bNotify)
@@ -382,17 +382,17 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value,
case ListBox: {
int iIndex = FindOptionValue(value);
if (iIndex < 0)
- return FALSE;
+ return false;
if (bDefault && iIndex == GetDefaultSelectedItem())
- return FALSE;
+ return false;
if (bNotify && !NotifyBeforeSelectionChange(value))
- return FALSE;
+ return false;
if (!bDefault) {
ClearSelection();
- SetItemSelection(iIndex, TRUE);
+ SetItemSelection(iIndex, true);
}
if (bNotify)
NotifyAfterSelectionChange();
@@ -401,11 +401,11 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value,
default:
break;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, FX_BOOL bNotify) {
- return SetValue(value, FALSE, bNotify);
+bool CPDF_FormField::SetValue(const CFX_WideString& value, bool bNotify) {
+ return SetValue(value, false, bNotify);
}
int CPDF_FormField::GetMaxLen() const {
@@ -476,7 +476,7 @@ int CPDF_FormField::GetSelectedIndex(int index) const {
return -1;
}
-FX_BOOL CPDF_FormField::ClearSelection(FX_BOOL bNotify) {
+bool CPDF_FormField::ClearSelection(bool bNotify) {
if (bNotify && m_pForm->m_pFormNotify) {
CFX_WideString csValue;
int iIndex = GetSelectedIndex(0);
@@ -484,28 +484,28 @@ FX_BOOL CPDF_FormField::ClearSelection(FX_BOOL bNotify) {
csValue = GetOptionLabel(iIndex);
if (!NotifyListOrComboBoxBeforeChange(csValue))
- return FALSE;
+ return false;
}
m_pDict->RemoveFor("V");
m_pDict->RemoveFor("I");
if (bNotify)
NotifyListOrComboBoxAfterChange();
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_FormField::IsItemSelected(int index) const {
+bool CPDF_FormField::IsItemSelected(int index) const {
ASSERT(GetType() == ComboBox || GetType() == ListBox);
if (index < 0 || index >= CountOptions())
- return FALSE;
+ return false;
if (IsOptionSelected(index))
- return TRUE;
+ return true;
CFX_WideString opt_value = GetOptionValue(index);
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
if (!pValue) {
pValue = FPDF_GetFieldAttr(m_pDict, "I");
if (!pValue)
- return FALSE;
+ return false;
}
if (pValue->IsString())
@@ -513,13 +513,13 @@ FX_BOOL CPDF_FormField::IsItemSelected(int index) const {
if (pValue->IsNumber()) {
if (pValue->GetString().IsEmpty())
- return FALSE;
+ return false;
return (pValue->GetInteger() == index);
}
CPDF_Array* pArray = pValue->AsArray();
if (!pArray)
- return FALSE;
+ return false;
int iPos = -1;
for (int j = 0; j < CountSelectedOptions(); j++) {
@@ -531,25 +531,23 @@ FX_BOOL CPDF_FormField::IsItemSelected(int index) const {
for (int i = 0; i < static_cast<int>(pArray->GetCount()); i++)
if (pArray->GetDirectObjectAt(i)->GetUnicodeText() == opt_value &&
i == iPos) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_FormField::SetItemSelection(int index,
- FX_BOOL bSelected,
- FX_BOOL bNotify) {
+bool CPDF_FormField::SetItemSelection(int index, bool bSelected, bool bNotify) {
ASSERT(GetType() == ComboBox || GetType() == ListBox);
if (index < 0 || index >= CountOptions())
- return FALSE;
+ return false;
CFX_WideString opt_value = GetOptionValue(index);
if (bNotify && !NotifyListOrComboBoxBeforeChange(opt_value))
- return FALSE;
+ return false;
if (bSelected) {
if (GetType() == ListBox) {
- SelectOption(index, TRUE);
+ SelectOption(index, true);
if (!(m_Flags & kFormListMultiSelect)) {
m_pDict->SetStringFor("V", PDF_EncodeText(opt_value));
} else {
@@ -572,7 +570,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index,
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
if (pValue) {
if (GetType() == ListBox) {
- SelectOption(index, FALSE);
+ SelectOption(index, false);
if (pValue->IsString()) {
if (pValue->GetUnicodeText() == opt_value)
m_pDict->RemoveFor("V");
@@ -596,13 +594,13 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index,
}
if (bNotify)
NotifyListOrComboBoxAfterChange();
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_FormField::IsItemDefaultSelected(int index) const {
+bool CPDF_FormField::IsItemDefaultSelected(int index) const {
ASSERT(GetType() == ComboBox || GetType() == ListBox);
if (index < 0 || index >= CountOptions())
- return FALSE;
+ return false;
int iDVIndex = GetDefaultSelectedItem();
return iDVIndex >= 0 && iDVIndex == index;
}
@@ -669,7 +667,7 @@ int CPDF_FormField::FindOptionValue(const CFX_WideString& csOptValue) const {
#ifdef PDF_ENABLE_XFA
int CPDF_FormField::InsertOption(CFX_WideString csOptLabel,
int index,
- FX_BOOL bNotify) {
+ bool bNotify) {
if (csOptLabel.IsEmpty())
return -1;
@@ -690,7 +688,7 @@ int CPDF_FormField::InsertOption(CFX_WideString csOptLabel,
pOpt->AddString(csStr);
index = iCount;
} else {
- CPDF_String* pString = new CPDF_String(csStr, FALSE);
+ CPDF_String* pString = new CPDF_String(csStr, false);
pOpt->InsertAt(index, pString);
}
@@ -699,14 +697,14 @@ int CPDF_FormField::InsertOption(CFX_WideString csOptLabel,
return index;
}
-FX_BOOL CPDF_FormField::ClearOptions(FX_BOOL bNotify) {
+bool CPDF_FormField::ClearOptions(bool bNotify) {
if (bNotify && m_pForm->m_pFormNotify) {
CFX_WideString csValue;
int iIndex = GetSelectedIndex(0);
if (iIndex >= 0)
csValue = GetOptionLabel(iIndex);
if (!NotifyListOrComboBoxBeforeChange(csValue))
- return FALSE;
+ return false;
}
m_pDict->RemoveFor("Opt");
@@ -718,19 +716,19 @@ FX_BOOL CPDF_FormField::ClearOptions(FX_BOOL bNotify) {
if (bNotify)
NotifyListOrComboBoxAfterChange();
- return TRUE;
+ return true;
}
#endif // PDF_ENABLE_XFA
-FX_BOOL CPDF_FormField::CheckControl(int iControlIndex,
- bool bChecked,
- bool bNotify) {
+bool CPDF_FormField::CheckControl(int iControlIndex,
+ bool bChecked,
+ bool bNotify) {
ASSERT(GetType() == CheckBox || GetType() == RadioButton);
CPDF_FormControl* pControl = GetControl(iControlIndex);
if (!pControl)
- return FALSE;
+ return false;
if (!bChecked && pControl->IsChecked() == bChecked)
- return FALSE;
+ return false;
CFX_WideString csWExport = pControl->GetExportValue();
CFX_ByteString csBExport = PDF_EncodeText(csWExport);
@@ -744,15 +742,15 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex,
if (pCtrl->GetOnStateName() == pControl->GetOnStateName())
pCtrl->CheckControl(bChecked);
else if (bChecked)
- pCtrl->CheckControl(FALSE);
+ pCtrl->CheckControl(false);
} else if (bChecked) {
- pCtrl->CheckControl(FALSE);
+ pCtrl->CheckControl(false);
}
} else {
if (i == iControlIndex)
pCtrl->CheckControl(bChecked);
else if (bChecked)
- pCtrl->CheckControl(FALSE);
+ pCtrl->CheckControl(false);
}
}
@@ -775,16 +773,16 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex,
}
if (bNotify && m_pForm->m_pFormNotify)
m_pForm->m_pFormNotify->AfterCheckedStatusChange(this);
- return TRUE;
+ return true;
}
-CFX_WideString CPDF_FormField::GetCheckValue(FX_BOOL bDefault) const {
+CFX_WideString CPDF_FormField::GetCheckValue(bool bDefault) const {
ASSERT(GetType() == CheckBox || GetType() == RadioButton);
CFX_WideString csExport = L"Off";
int iCount = CountControls();
for (int i = 0; i < iCount; i++) {
CPDF_FormControl* pControl = GetControl(i);
- FX_BOOL bChecked =
+ bool bChecked =
bDefault ? pControl->IsDefaultChecked() : pControl->IsChecked();
if (bChecked) {
csExport = pControl->GetExportValue();
@@ -794,9 +792,9 @@ CFX_WideString CPDF_FormField::GetCheckValue(FX_BOOL bDefault) const {
return csExport;
}
-FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value,
- FX_BOOL bDefault,
- FX_BOOL bNotify) {
+bool CPDF_FormField::SetCheckValue(const CFX_WideString& value,
+ bool bDefault,
+ bool bNotify) {
ASSERT(GetType() == CheckBox || GetType() == RadioButton);
int iCount = CountControls();
for (int i = 0; i < iCount; i++) {
@@ -810,7 +808,7 @@ FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value,
}
if (bNotify && m_pForm->m_pFormNotify)
m_pForm->m_pFormNotify->AfterCheckedStatusChange(this);
- return TRUE;
+ return true;
}
int CPDF_FormField::GetTopVisibleIndex() const {
@@ -834,44 +832,42 @@ int CPDF_FormField::GetSelectedOptionIndex(int index) const {
return pArray->GetIntegerAt(index);
}
-FX_BOOL CPDF_FormField::IsOptionSelected(int iOptIndex) const {
+bool CPDF_FormField::IsOptionSelected(int iOptIndex) const {
CPDF_Array* pArray = ToArray(FPDF_GetFieldAttr(m_pDict, "I"));
if (!pArray)
- return FALSE;
+ return false;
for (CPDF_Object* pObj : *pArray) {
if (pObj->GetInteger() == iOptIndex)
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_FormField::SelectOption(int iOptIndex,
- FX_BOOL bSelected,
- FX_BOOL bNotify) {
+bool CPDF_FormField::SelectOption(int iOptIndex, bool bSelected, bool bNotify) {
CPDF_Array* pArray = m_pDict->GetArrayFor("I");
if (!pArray) {
if (!bSelected)
- return TRUE;
+ return true;
pArray = new CPDF_Array;
m_pDict->SetFor("I", pArray);
}
- FX_BOOL bReturn = FALSE;
+ bool bReturn = false;
for (size_t i = 0; i < pArray->GetCount(); i++) {
int iFind = pArray->GetIntegerAt(i);
if (iFind == iOptIndex) {
if (bSelected)
- return TRUE;
+ return true;
if (bNotify && m_pForm->m_pFormNotify) {
CFX_WideString csValue = GetOptionLabel(iOptIndex);
if (!NotifyListOrComboBoxBeforeChange(csValue))
- return FALSE;
+ return false;
}
pArray->RemoveAt(i);
- bReturn = TRUE;
+ bReturn = true;
break;
}
@@ -882,10 +878,10 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex,
if (bNotify && m_pForm->m_pFormNotify) {
CFX_WideString csValue = GetOptionLabel(iOptIndex);
if (!NotifyListOrComboBoxBeforeChange(csValue))
- return FALSE;
+ return false;
}
pArray->InsertAt(i, new CPDF_Number(iOptIndex));
- bReturn = TRUE;
+ bReturn = true;
break;
}
}
@@ -899,10 +895,10 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex,
if (bNotify)
NotifyListOrComboBoxAfterChange();
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_FormField::ClearSelectedOptions(FX_BOOL bNotify) {
+bool CPDF_FormField::ClearSelectedOptions(bool bNotify) {
if (bNotify && m_pForm->m_pFormNotify) {
CFX_WideString csValue;
int iIndex = GetSelectedIndex(0);
@@ -910,13 +906,13 @@ FX_BOOL CPDF_FormField::ClearSelectedOptions(FX_BOOL bNotify) {
csValue = GetOptionLabel(iIndex);
if (!NotifyListOrComboBoxBeforeChange(csValue))
- return FALSE;
+ return false;
}
m_pDict->RemoveFor("I");
if (bNotify)
NotifyListOrComboBoxAfterChange();
- return TRUE;
+ return true;
}
void CPDF_FormField::LoadDA() {
diff --git a/core/fpdfdoc/cpdf_formfield.h b/core/fpdfdoc/cpdf_formfield.h
index abdd6f78b9..37f17c3a8a 100644
--- a/core/fpdfdoc/cpdf_formfield.h
+++ b/core/fpdfdoc/cpdf_formfield.h
@@ -56,7 +56,7 @@ class CPDF_FormField {
CPDF_Dictionary* GetFieldDict() const { return m_pDict; }
void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; }
- FX_BOOL ResetField(FX_BOOL bNotify = FALSE);
+ bool ResetField(bool bNotify = false);
int CountControls() const { return m_ControlList.GetSize(); }
@@ -77,19 +77,17 @@ class CPDF_FormField {
CFX_WideString GetValue() const;
CFX_WideString GetDefaultValue() const;
- FX_BOOL SetValue(const CFX_WideString& value, FX_BOOL bNotify = FALSE);
+ bool SetValue(const CFX_WideString& value, bool bNotify = false);
int GetMaxLen() const;
int CountSelectedItems() const;
int GetSelectedIndex(int index) const;
- FX_BOOL ClearSelection(FX_BOOL bNotify = FALSE);
- FX_BOOL IsItemSelected(int index) const;
- FX_BOOL SetItemSelection(int index,
- FX_BOOL bSelected,
- FX_BOOL bNotify = FALSE);
+ bool ClearSelection(bool bNotify = false);
+ bool IsItemSelected(int index) const;
+ bool SetItemSelection(int index, bool bSelected, bool bNotify = false);
- FX_BOOL IsItemDefaultSelected(int index) const;
+ bool IsItemDefaultSelected(int index) const;
int GetDefaultSelectedItem() const;
int CountOptions() const;
@@ -100,26 +98,24 @@ class CPDF_FormField {
int FindOption(CFX_WideString csOptLabel) const;
int FindOptionValue(const CFX_WideString& csOptValue) const;
- FX_BOOL CheckControl(int iControlIndex, bool bChecked, bool bNotify = false);
+ bool CheckControl(int iControlIndex, bool bChecked, bool bNotify = false);
int GetTopVisibleIndex() const;
int CountSelectedOptions() const;
int GetSelectedOptionIndex(int index) const;
- FX_BOOL IsOptionSelected(int iOptIndex) const;
+ bool IsOptionSelected(int iOptIndex) const;
- FX_BOOL SelectOption(int iOptIndex,
- FX_BOOL bSelected,
- FX_BOOL bNotify = FALSE);
+ bool SelectOption(int iOptIndex, bool bSelected, bool bNotify = false);
- FX_BOOL ClearSelectedOptions(FX_BOOL bNotify = FALSE);
+ bool ClearSelectedOptions(bool bNotify = false);
#ifdef PDF_ENABLE_XFA
- FX_BOOL ClearOptions(FX_BOOL bNotify = FALSE);
+ bool ClearOptions(bool bNotify = false);
int InsertOption(CFX_WideString csOptLabel,
int index = -1,
- FX_BOOL bNotify = FALSE);
+ bool bNotify = false);
#endif // PDF_ENABLE_XFA
FX_FLOAT GetFontSize() const { return m_FontSize; }
@@ -132,20 +128,16 @@ class CPDF_FormField {
CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict);
~CPDF_FormField();
- CFX_WideString GetValue(FX_BOOL bDefault) const;
- FX_BOOL SetValue(const CFX_WideString& value,
- FX_BOOL bDefault,
- FX_BOOL bNotify);
+ CFX_WideString GetValue(bool bDefault) const;
+ bool SetValue(const CFX_WideString& value, bool bDefault, bool bNotify);
void SyncFieldFlags();
int FindListSel(CPDF_String* str);
CFX_WideString GetOptionText(int index, int sub_index) const;
void LoadDA();
- CFX_WideString GetCheckValue(FX_BOOL bDefault) const;
- FX_BOOL SetCheckValue(const CFX_WideString& value,
- FX_BOOL bDefault,
- FX_BOOL bNotify);
+ CFX_WideString GetCheckValue(bool bDefault) const;
+ bool SetCheckValue(const CFX_WideString& value, bool bDefault, bool bNotify);
bool NotifyBeforeSelectionChange(const CFX_WideString& value);
void NotifyAfterSelectionChange();
diff --git a/core/fpdfdoc/cpdf_iconfit.cpp b/core/fpdfdoc/cpdf_iconfit.cpp
index 7834710588..aedb785912 100644
--- a/core/fpdfdoc/cpdf_iconfit.cpp
+++ b/core/fpdfdoc/cpdf_iconfit.cpp
@@ -24,8 +24,8 @@ CPDF_IconFit::ScaleMethod CPDF_IconFit::GetScaleMethod() {
return Always;
}
-FX_BOOL CPDF_IconFit::IsProportionalScale() {
- return m_pDict ? m_pDict->GetStringFor("S", "P") != "A" : TRUE;
+bool CPDF_IconFit::IsProportionalScale() {
+ return m_pDict ? m_pDict->GetStringFor("S", "P") != "A" : true;
}
void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) {
diff --git a/core/fpdfdoc/cpdf_iconfit.h b/core/fpdfdoc/cpdf_iconfit.h
index 1ef023ab5f..37df48d43e 100644
--- a/core/fpdfdoc/cpdf_iconfit.h
+++ b/core/fpdfdoc/cpdf_iconfit.h
@@ -18,7 +18,7 @@ class CPDF_IconFit {
explicit CPDF_IconFit(const CPDF_Dictionary* pDict) : m_pDict(pDict) {}
ScaleMethod GetScaleMethod();
- FX_BOOL IsProportionalScale();
+ bool IsProportionalScale();
void GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom);
bool GetFittingBounds();
const CPDF_Dictionary* GetDict() const { return m_pDict; }
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp
index b8b4b68e29..f709c57961 100644
--- a/core/fpdfdoc/cpdf_interform.cpp
+++ b/core/fpdfdoc/cpdf_interform.cpp
@@ -163,19 +163,19 @@ CPDF_Font* GetNativeFont(CPDF_Dictionary* pFormDict,
return nullptr;
}
-FX_BOOL FindFont(CPDF_Dictionary* pFormDict,
- const CPDF_Font* pFont,
- CFX_ByteString& csNameTag) {
+bool FindFont(CPDF_Dictionary* pFormDict,
+ const CPDF_Font* pFont,
+ CFX_ByteString& csNameTag) {
if (!pFormDict || !pFont)
- return FALSE;
+ return false;
CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
if (!pDR)
- return FALSE;
+ return false;
CPDF_Dictionary* pFonts = pDR->GetDictFor("Font");
if (!pFonts)
- return FALSE;
+ return false;
for (const auto& it : *pFonts) {
const CFX_ByteString& csKey = it.first;
@@ -190,27 +190,27 @@ FX_BOOL FindFont(CPDF_Dictionary* pFormDict,
continue;
if (pFont->GetFontDict() == pElement) {
csNameTag = csKey;
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL FindFont(CPDF_Dictionary* pFormDict,
- CPDF_Document* pDocument,
- CFX_ByteString csFontName,
- CPDF_Font*& pFont,
- CFX_ByteString& csNameTag) {
+bool FindFont(CPDF_Dictionary* pFormDict,
+ CPDF_Document* pDocument,
+ CFX_ByteString csFontName,
+ CPDF_Font*& pFont,
+ CFX_ByteString& csNameTag) {
if (!pFormDict)
- return FALSE;
+ return false;
CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
if (!pDR)
- return FALSE;
+ return false;
CPDF_Dictionary* pFonts = pDR->GetDictFor("Font");
if (!pFonts)
- return FALSE;
+ return false;
if (csFontName.GetLength() > 0)
csFontName.Remove(' ');
@@ -235,10 +235,10 @@ FX_BOOL FindFont(CPDF_Dictionary* pFormDict,
csBaseFont.Remove(' ');
if (csBaseFont == csFontName) {
csNameTag = csKey;
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
void AddFont(CPDF_Dictionary*& pFormDict,
@@ -329,7 +329,7 @@ class CFieldNameExtractor {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
typedef struct {
- FX_BOOL bFind;
+ bool bFind;
LOGFONTA lf;
} PDF_FONTDATA;
@@ -342,11 +342,11 @@ static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEXA* lpelfe,
PDF_FONTDATA* pData = (PDF_FONTDATA*)lParam;
memcpy(&pData->lf, &lpelfe->elfLogFont, sizeof(LOGFONTA));
- pData->bFind = TRUE;
+ pData->bFind = true;
return 0;
}
-FX_BOOL RetrieveSpecificFont(LOGFONTA& lf) {
+bool RetrieveSpecificFont(LOGFONTA& lf) {
PDF_FONTDATA fd;
memset(&fd, 0, sizeof(PDF_FONTDATA));
HDC hDC = ::GetDC(nullptr);
@@ -359,10 +359,10 @@ FX_BOOL RetrieveSpecificFont(LOGFONTA& lf) {
return fd.bFind;
}
-FX_BOOL RetrieveSpecificFont(uint8_t charSet,
- uint8_t pitchAndFamily,
- LPCSTR pcsFontName,
- LOGFONTA& lf) {
+bool RetrieveSpecificFont(uint8_t charSet,
+ uint8_t pitchAndFamily,
+ LPCSTR pcsFontName,
+ LOGFONTA& lf) {
memset(&lf, 0, sizeof(LOGFONTA));
lf.lfCharSet = charSet;
lf.lfPitchAndFamily = pitchAndFamily;
@@ -730,7 +730,7 @@ CFX_ByteString CPDF_InterForm::GenerateNewResourceName(
int num = 0;
CFX_ByteString bsNum;
- while (TRUE) {
+ while (true) {
CFX_ByteString csKey = csTmp + bsNum;
if (!pDict->KeyExist(csKey))
return csKey;
@@ -764,7 +764,7 @@ CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) {
csFontName = "Helvetica";
return csFontName;
}
- FX_BOOL bRet = FALSE;
+ bool bRet = false;
if (charSet == FXFONT_SHIFTJIS_CHARSET) {
bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE,
"MS Mincho", lf);
@@ -809,7 +809,7 @@ CPDF_Font* CPDF_InterForm::AddNativeFont(uint8_t charSet,
if (!csFontName.IsEmpty()) {
if (csFontName == "Helvetica")
return AddStandardFont(pDocument, csFontName);
- return pDocument->AddWindowsFont(&lf, FALSE, TRUE);
+ return pDocument->AddWindowsFont(&lf, false, true);
}
#endif
return nullptr;
@@ -940,7 +940,7 @@ CPDF_FormControl* CPDF_InterForm::GetControlByDict(
return it != m_ControlMap.end() ? it->second : nullptr;
}
-FX_BOOL CPDF_InterForm::NeedConstructAP() const {
+bool CPDF_InterForm::NeedConstructAP() const {
return m_pFormDict && m_pFormDict->GetBooleanFor("NeedAppearances");
}
@@ -1061,7 +1061,7 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) {
}
}
-FX_BOOL CPDF_InterForm::HasXFAForm() const {
+bool CPDF_InterForm::HasXFAForm() const {
return m_pFormDict && m_pFormDict->GetArrayFor("XFA");
}
@@ -1241,7 +1241,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(
pFieldDict->SetFor("T", new CPDF_String(fullname));
if (pField->GetType() == CPDF_FormField::CheckBox ||
pField->GetType() == CPDF_FormField::RadioButton) {
- CFX_WideString csExport = pField->GetCheckValue(FALSE);
+ CFX_WideString csExport = pField->GetCheckValue(false);
CFX_ByteString csBExport = PDF_EncodeText(csExport);
CPDF_Object* pOpt = FPDF_GetFieldAttr(pField->m_pDict, "Opt");
if (pOpt)
@@ -1261,7 +1261,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(
void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict,
const CFX_WideString& parent_name,
- FX_BOOL bNotify,
+ bool bNotify,
int nLevel) {
CFX_WideString name;
if (!parent_name.IsEmpty())
diff --git a/core/fpdfdoc/cpdf_interform.h b/core/fpdfdoc/cpdf_interform.h
index fef4ae2bc4..fbff0289a1 100644
--- a/core/fpdfdoc/cpdf_interform.h
+++ b/core/fpdfdoc/cpdf_interform.h
@@ -60,7 +60,7 @@ class CPDF_InterForm {
int* z_order) const;
CPDF_FormControl* GetControlByDict(const CPDF_Dictionary* pWidgetDict) const;
- FX_BOOL NeedConstructAP() const;
+ bool NeedConstructAP() const;
int CountFieldsInCalculationOrder();
CPDF_FormField* GetFieldInCalculationOrder(int index);
int FindFieldInCalculationOrder(const CPDF_FormField* pField);
@@ -86,7 +86,7 @@ class CPDF_InterForm {
bool ResetForm(bool bNotify);
void SetFormNotify(IPDF_FormNotify* pNotify);
- FX_BOOL HasXFAForm() const;
+ bool HasXFAForm() const;
void FixPageFields(const CPDF_Page* pPage);
private:
@@ -99,7 +99,7 @@ class CPDF_InterForm {
CPDF_Dictionary* pWidgetDict);
void FDF_ImportField(CPDF_Dictionary* pField,
const CFX_WideString& parent_name,
- FX_BOOL bNotify = FALSE,
+ bool bNotify = false,
int nLevel = 0);
bool ValidateFieldName(CFX_WideString& csNewFieldName,
int iType,
diff --git a/core/fpdfdoc/cpdf_metadata.cpp b/core/fpdfdoc/cpdf_metadata.cpp
index 226194682c..bdb70c0166 100644
--- a/core/fpdfdoc/cpdf_metadata.cpp
+++ b/core/fpdfdoc/cpdf_metadata.cpp
@@ -21,7 +21,7 @@ CPDF_Metadata::CPDF_Metadata(CPDF_Document* pDoc) {
return;
CPDF_StreamAcc acc;
- acc.LoadAllData(pStream, FALSE);
+ acc.LoadAllData(pStream, false);
m_pXmlElement.reset(CXML_Element::Parse(acc.GetData(), acc.GetSize()));
}
diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp
index 75454f67ff..5fe8c0137e 100644
--- a/core/fpdfdoc/cpdf_variabletext.cpp
+++ b/core/fpdfdoc/cpdf_variabletext.cpp
@@ -69,7 +69,7 @@ int32_t CPDF_VariableText::Provider::GetWordFontIndex(uint16_t word,
return -1;
}
-FX_BOOL CPDF_VariableText::Provider::IsLatinWord(uint16_t word) {
+bool CPDF_VariableText::Provider::IsLatinWord(uint16_t word) {
return (word >= 0x61 && word <= 0x7A) || (word >= 0x41 && word <= 0x5A) ||
word == 0x2D || word == 0x27;
}
@@ -92,74 +92,74 @@ void CPDF_VariableText::Iterator::SetAt(const CPVT_WordPlace& place) {
m_CurPos = place;
}
-FX_BOOL CPDF_VariableText::Iterator::NextWord() {
+bool CPDF_VariableText::Iterator::NextWord() {
if (m_CurPos == m_pVT->GetEndWordPlace())
- return FALSE;
+ return false;
m_CurPos = m_pVT->GetNextWordPlace(m_CurPos);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_VariableText::Iterator::PrevWord() {
+bool CPDF_VariableText::Iterator::PrevWord() {
if (m_CurPos == m_pVT->GetBeginWordPlace())
- return FALSE;
+ return false;
m_CurPos = m_pVT->GetPrevWordPlace(m_CurPos);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_VariableText::Iterator::NextLine() {
+bool CPDF_VariableText::Iterator::NextLine() {
if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
if (m_CurPos.nLineIndex < pSection->m_LineArray.GetSize() - 1) {
m_CurPos =
CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex + 1, -1);
- return TRUE;
+ return true;
}
if (m_CurPos.nSecIndex < m_pVT->m_SectionArray.GetSize() - 1) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1);
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText::Iterator::PrevLine() {
+bool CPDF_VariableText::Iterator::PrevLine() {
if (m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
if (m_CurPos.nLineIndex > 0) {
m_CurPos =
CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex - 1, -1);
- return TRUE;
+ return true;
}
if (m_CurPos.nSecIndex > 0) {
if (CSection* pLastSection =
m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex - 1)) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1,
pLastSection->m_LineArray.GetSize() - 1, -1);
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText::Iterator::NextSection() {
+bool CPDF_VariableText::Iterator::NextSection() {
if (m_CurPos.nSecIndex < m_pVT->m_SectionArray.GetSize() - 1) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText::Iterator::PrevSection() {
+bool CPDF_VariableText::Iterator::PrevSection() {
ASSERT(m_pVT);
if (m_CurPos.nSecIndex > 0) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1, 0, -1);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText::Iterator::GetWord(CPVT_Word& word) const {
+bool CPDF_VariableText::Iterator::GetWord(CPVT_Word& word) const {
word.WordPlace = m_CurPos;
if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
if (pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) {
@@ -178,26 +178,26 @@ FX_BOOL CPDF_VariableText::Iterator::GetWord(CPVT_Word& word) const {
word.nFontIndex = m_pVT->GetWordFontIndex(*pWord);
word.fFontSize = m_pVT->GetWordFontSize(*pWord);
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText::Iterator::SetWord(const CPVT_Word& word) {
+bool CPDF_VariableText::Iterator::SetWord(const CPVT_Word& word) {
if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
if (CPVT_WordInfo* pWord =
pSection->m_WordArray.GetAt(m_CurPos.nWordIndex)) {
if (pWord->pWordProps)
*pWord->pWordProps = word.WordProps;
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText::Iterator::GetLine(CPVT_Line& line) const {
+bool CPDF_VariableText::Iterator::GetLine(CPVT_Line& line) const {
ASSERT(m_pVT);
line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1);
if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
@@ -209,13 +209,13 @@ FX_BOOL CPDF_VariableText::Iterator::GetLine(CPVT_Line& line) const {
line.fLineAscent = pLine->m_LineInfo.fLineAscent;
line.fLineDescent = pLine->m_LineInfo.fLineDescent;
line.lineEnd = pLine->GetEndWordPlace();
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText::Iterator::GetSection(CPVT_Section& section) const {
+bool CPDF_VariableText::Iterator::GetSection(CPVT_Section& section) const {
section.secplace = CPVT_WordPlace(m_CurPos.nSecIndex, 0, -1);
if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
section.rcSection = m_pVT->InToOut(pSection->m_SecInfo.rcSection);
@@ -223,35 +223,35 @@ FX_BOOL CPDF_VariableText::Iterator::GetSection(CPVT_Section& section) const {
section.SecProps = *pSection->m_SecInfo.pSecProps;
if (pSection->m_SecInfo.pWordProps)
section.WordProps = *pSection->m_SecInfo.pWordProps;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText::Iterator::SetSection(const CPVT_Section& section) {
+bool CPDF_VariableText::Iterator::SetSection(const CPVT_Section& section) {
if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
if (pSection->m_SecInfo.pSecProps)
*pSection->m_SecInfo.pSecProps = section.SecProps;
if (pSection->m_SecInfo.pWordProps)
*pSection->m_SecInfo.pWordProps = section.WordProps;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
CPDF_VariableText::CPDF_VariableText()
: m_nLimitChar(0),
m_nCharArray(0),
- m_bMultiLine(FALSE),
- m_bLimitWidth(FALSE),
- m_bAutoFontSize(FALSE),
+ m_bMultiLine(false),
+ m_bLimitWidth(false),
+ m_bAutoFontSize(false),
m_nAlignment(0),
m_fLineLeading(0.0f),
m_fCharSpace(0.0f),
m_nHorzScale(100),
m_wSubWord(0),
m_fFontSize(0.0f),
- m_bInitial(FALSE),
+ m_bInitial(false),
m_pVTProvider(nullptr) {}
CPDF_VariableText::~CPDF_VariableText() {
@@ -272,12 +272,12 @@ void CPDF_VariableText::Initialize() {
if (CSection* pSection = m_SectionArray.GetAt(0))
pSection->ResetLinePlace();
- m_bInitial = TRUE;
+ m_bInitial = true;
}
}
void CPDF_VariableText::ResetAll() {
- m_bInitial = FALSE;
+ m_bInitial = false;
ResetSectionArray();
}
@@ -372,7 +372,7 @@ CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace& place,
CPVT_WordPlace CPDF_VariableText::DeleteWords(
const CPVT_WordRange& PlaceRange) {
- FX_BOOL bLastSecPos = FALSE;
+ bool bLastSecPos = false;
if (CSection* pSection = m_SectionArray.GetAt(PlaceRange.EndPos.nSecIndex))
bLastSecPos = (PlaceRange.EndPos == pSection->GetEndWordPlace());
@@ -386,11 +386,11 @@ CPVT_WordPlace CPDF_VariableText::DeleteWords(
}
CPVT_WordPlace CPDF_VariableText::DeleteWord(const CPVT_WordPlace& place) {
- return ClearRightWord(AdjustLineHeader(place, TRUE));
+ return ClearRightWord(AdjustLineHeader(place, true));
}
CPVT_WordPlace CPDF_VariableText::BackSpaceWord(const CPVT_WordPlace& place) {
- return ClearLeftWord(AdjustLineHeader(place, TRUE));
+ return ClearLeftWord(AdjustLineHeader(place, true));
}
void CPDF_VariableText::SetText(const CFX_WideString& swText) {
@@ -447,7 +447,7 @@ void CPDF_VariableText::UpdateWordPlace(CPVT_WordPlace& place) const {
if (place.nSecIndex >= m_SectionArray.GetSize())
place = GetEndWordPlace();
- place = AdjustLineHeader(place, TRUE);
+ place = AdjustLineHeader(place, true);
if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex))
pSection->UpdateWordPlace(place);
}
@@ -475,19 +475,19 @@ int32_t CPDF_VariableText::WordPlaceToWordIndex(
CPVT_WordPlace CPDF_VariableText::WordIndexToWordPlace(int32_t index) const {
CPVT_WordPlace place = GetBeginWordPlace();
int32_t nOldIndex = 0, nIndex = 0;
- FX_BOOL bFind = FALSE;
+ bool bFind = false;
for (int32_t i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) {
if (CSection* pSection = m_SectionArray.GetAt(i)) {
nIndex += pSection->m_WordArray.GetSize();
if (nIndex == index) {
place = pSection->GetEndWordPlace();
- bFind = TRUE;
+ bFind = true;
break;
} else if (nIndex > index) {
place.nSecIndex = i;
place.nWordIndex = index - nOldIndex - 1;
pSection->UpdateWordPlace(place);
- bFind = TRUE;
+ bFind = true;
break;
}
if (i != m_SectionArray.GetSize() - 1)
@@ -551,15 +551,15 @@ CPVT_WordPlace CPDF_VariableText::SearchWordPlace(
int32_t nLeft = 0;
int32_t nRight = m_SectionArray.GetSize() - 1;
int32_t nMid = m_SectionArray.GetSize() / 2;
- FX_BOOL bUp = TRUE;
- FX_BOOL bDown = TRUE;
+ bool bUp = true;
+ bool bDown = true;
while (nLeft <= nRight) {
if (CSection* pSection = m_SectionArray.GetAt(nMid)) {
if (IsFloatBigger(pt.y, pSection->m_SecInfo.rcSection.top)) {
- bUp = FALSE;
+ bUp = false;
}
if (IsFloatBigger(pSection->m_SecInfo.rcSection.bottom, pt.y)) {
- bDown = FALSE;
+ bDown = false;
}
if (IsFloatSmaller(pt.y, pSection->m_SecInfo.rcSection.top)) {
nRight = nMid - 1;
@@ -712,46 +712,46 @@ CPVT_WordPlace CPDF_VariableText::AddWord(const CPVT_WordPlace& place,
return place;
}
-FX_BOOL CPDF_VariableText::GetWordInfo(const CPVT_WordPlace& place,
- CPVT_WordInfo& wordinfo) {
+bool CPDF_VariableText::GetWordInfo(const CPVT_WordPlace& place,
+ CPVT_WordInfo& wordinfo) {
if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
if (CPVT_WordInfo* pWord = pSection->m_WordArray.GetAt(place.nWordIndex)) {
wordinfo = *pWord;
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText::SetWordInfo(const CPVT_WordPlace& place,
- const CPVT_WordInfo& wordinfo) {
+bool CPDF_VariableText::SetWordInfo(const CPVT_WordPlace& place,
+ const CPVT_WordInfo& wordinfo) {
if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
if (CPVT_WordInfo* pWord = pSection->m_WordArray.GetAt(place.nWordIndex)) {
*pWord = wordinfo;
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText::GetLineInfo(const CPVT_WordPlace& place,
- CPVT_LineInfo& lineinfo) {
+bool CPDF_VariableText::GetLineInfo(const CPVT_WordPlace& place,
+ CPVT_LineInfo& lineinfo) {
if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
if (CLine* pLine = pSection->m_LineArray.GetAt(place.nLineIndex)) {
lineinfo = pLine->m_LineInfo;
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText::GetSectionInfo(const CPVT_WordPlace& place,
- CPVT_SectionInfo& secinfo) {
+bool CPDF_VariableText::GetSectionInfo(const CPVT_WordPlace& place,
+ CPVT_SectionInfo& secinfo) {
if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
secinfo = pSection->m_SecInfo;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void CPDF_VariableText::SetPlateRect(const CFX_FloatRect& rect) {
@@ -854,7 +854,7 @@ int32_t CPDF_VariableText::GetHorzScale(const CPVT_WordInfo& WordInfo) {
}
void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace& place) {
- CPVT_WordPlace wordplace = AdjustLineHeader(place, TRUE);
+ CPVT_WordPlace wordplace = AdjustLineHeader(place, true);
if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
for (int32_t w = pSection->m_WordArray.GetSize() - 1;
w > wordplace.nWordIndex; w--) {
@@ -865,23 +865,23 @@ void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace& place) {
}
CPVT_WordPlace CPDF_VariableText::AdjustLineHeader(const CPVT_WordPlace& place,
- FX_BOOL bPrevOrNext) const {
+ bool bPrevOrNext) const {
if (place.nWordIndex < 0 && place.nLineIndex > 0)
return bPrevOrNext ? GetPrevWordPlace(place) : GetNextWordPlace(place);
return place;
}
-FX_BOOL CPDF_VariableText::ClearEmptySection(const CPVT_WordPlace& place) {
+bool CPDF_VariableText::ClearEmptySection(const CPVT_WordPlace& place) {
if (place.nSecIndex == 0 && m_SectionArray.GetSize() == 1)
- return FALSE;
+ return false;
if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
if (pSection->m_WordArray.GetSize() == 0) {
delete pSection;
m_SectionArray.RemoveAt(place.nSecIndex);
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
void CPDF_VariableText::ClearEmptySections(const CPVT_WordRange& PlaceRange) {
@@ -894,7 +894,7 @@ void CPDF_VariableText::ClearEmptySections(const CPVT_WordRange& PlaceRange) {
}
void CPDF_VariableText::LinkLatterSection(const CPVT_WordPlace& place) {
- CPVT_WordPlace oldplace = AdjustLineHeader(place, TRUE);
+ CPVT_WordPlace oldplace = AdjustLineHeader(place, true);
if (CSection* pNextSection = m_SectionArray.GetAt(place.nSecIndex + 1)) {
if (CSection* pSection = m_SectionArray.GetAt(oldplace.nSecIndex)) {
for (int32_t w = 0, sz = pNextSection->m_WordArray.GetSize(); w < sz;
@@ -912,8 +912,8 @@ void CPDF_VariableText::LinkLatterSection(const CPVT_WordPlace& place) {
void CPDF_VariableText::ClearWords(const CPVT_WordRange& PlaceRange) {
CPVT_WordRange NewRange;
- NewRange.BeginPos = AdjustLineHeader(PlaceRange.BeginPos, TRUE);
- NewRange.EndPos = AdjustLineHeader(PlaceRange.EndPos, TRUE);
+ NewRange.BeginPos = AdjustLineHeader(PlaceRange.BeginPos, true);
+ NewRange.EndPos = AdjustLineHeader(PlaceRange.EndPos, true);
for (int32_t s = NewRange.EndPos.nSecIndex; s >= NewRange.BeginPos.nSecIndex;
s--) {
if (CSection* pSection = m_SectionArray.GetAt(s))
@@ -942,7 +942,7 @@ CPVT_WordPlace CPDF_VariableText::ClearLeftWord(const CPVT_WordPlace& place) {
CPVT_WordPlace CPDF_VariableText::ClearRightWord(const CPVT_WordPlace& place) {
if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
CPVT_WordPlace rightplace =
- AdjustLineHeader(GetNextWordPlace(place), FALSE);
+ AdjustLineHeader(GetNextWordPlace(place), false);
if (rightplace != place) {
if (rightplace.nSecIndex != place.nSecIndex)
LinkLatterSection(place);
@@ -1088,8 +1088,8 @@ int32_t CPDF_VariableText::GetDefaultFontIndex() {
return m_pVTProvider ? m_pVTProvider->GetDefaultFontIndex() : -1;
}
-FX_BOOL CPDF_VariableText::IsLatinWord(uint16_t word) {
- return m_pVTProvider ? m_pVTProvider->IsLatinWord(word) : FALSE;
+bool CPDF_VariableText::IsLatinWord(uint16_t word) {
+ return m_pVTProvider ? m_pVTProvider->IsLatinWord(word) : false;
}
CPDF_VariableText::Iterator* CPDF_VariableText::GetIterator() {
diff --git a/core/fpdfdoc/cpdf_variabletext.h b/core/fpdfdoc/cpdf_variabletext.h
index 21edc35b5b..5983a2978b 100644
--- a/core/fpdfdoc/cpdf_variabletext.h
+++ b/core/fpdfdoc/cpdf_variabletext.h
@@ -41,17 +41,17 @@ class CPDF_VariableText {
explicit Iterator(CPDF_VariableText* pVT);
~Iterator();
- FX_BOOL NextWord();
- FX_BOOL PrevWord();
- FX_BOOL NextLine();
- FX_BOOL PrevLine();
- FX_BOOL NextSection();
- FX_BOOL PrevSection();
- FX_BOOL SetWord(const CPVT_Word& word);
- FX_BOOL GetWord(CPVT_Word& word) const;
- FX_BOOL GetLine(CPVT_Line& line) const;
- FX_BOOL GetSection(CPVT_Section& section) const;
- FX_BOOL SetSection(const CPVT_Section& section);
+ bool NextWord();
+ bool PrevWord();
+ bool NextLine();
+ bool PrevLine();
+ bool NextSection();
+ bool PrevSection();
+ bool SetWord(const CPVT_Word& word);
+ bool GetWord(CPVT_Word& word) const;
+ bool GetLine(CPVT_Line& line) const;
+ bool GetSection(CPVT_Section& section) const;
+ bool SetSection(const CPVT_Section& section);
void SetAt(int32_t nWordIndex);
void SetAt(const CPVT_WordPlace& place);
const CPVT_WordPlace& GetAt() const { return m_CurPos; }
@@ -72,7 +72,7 @@ class CPDF_VariableText {
virtual int32_t GetWordFontIndex(uint16_t word,
int32_t charset,
int32_t nFontIndex);
- virtual FX_BOOL IsLatinWord(uint16_t word);
+ virtual bool IsLatinWord(uint16_t word);
virtual int32_t GetDefaultFontIndex();
private:
@@ -94,14 +94,14 @@ class CPDF_VariableText {
void SetPasswordChar(uint16_t wSubWord) { m_wSubWord = wSubWord; }
void SetLimitChar(int32_t nLimitChar) { m_nLimitChar = nLimitChar; }
void SetCharSpace(FX_FLOAT fCharSpace) { m_fCharSpace = fCharSpace; }
- void SetMultiLine(FX_BOOL bMultiLine) { m_bMultiLine = bMultiLine; }
- void SetAutoReturn(FX_BOOL bAuto) { m_bLimitWidth = bAuto; }
+ void SetMultiLine(bool bMultiLine) { m_bMultiLine = bMultiLine; }
+ void SetAutoReturn(bool bAuto) { m_bLimitWidth = bAuto; }
void SetFontSize(FX_FLOAT fFontSize) { m_fFontSize = fFontSize; }
void SetCharArray(int32_t nCharArray) { m_nCharArray = nCharArray; }
- void SetAutoFontSize(FX_BOOL bAuto) { m_bAutoFontSize = bAuto; }
+ void SetAutoFontSize(bool bAuto) { m_bAutoFontSize = bAuto; }
void Initialize();
- FX_BOOL IsValid() const { return m_bInitial; }
+ bool IsValid() const { return m_bInitial; }
void RearrangeAll();
void RearrangePart(const CPVT_WordRange& PlaceRange);
@@ -125,7 +125,7 @@ class CPDF_VariableText {
uint16_t GetPasswordChar() const { return GetSubWord(); }
int32_t GetCharArray() const { return m_nCharArray; }
int32_t GetLimitChar() const { return m_nLimitChar; }
- FX_BOOL IsMultiLine() const { return m_bMultiLine; }
+ bool IsMultiLine() const { return m_bMultiLine; }
int32_t GetHorzScale() const { return m_nHorzScale; }
FX_FLOAT GetCharSpace() const { return m_fCharSpace; }
CPVT_WordPlace GetBeginWordPlace() const;
@@ -143,7 +143,7 @@ class CPDF_VariableText {
CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const;
void UpdateWordPlace(CPVT_WordPlace& place) const;
CPVT_WordPlace AdjustLineHeader(const CPVT_WordPlace& place,
- FX_BOOL bPrevOrNext) const;
+ bool bPrevOrNext) const;
int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const;
CPVT_WordPlace WordIndexToWordPlace(int32_t index) const;
@@ -169,7 +169,7 @@ class CPDF_VariableText {
int32_t GetTypeDescent(int32_t nFontIndex);
int32_t GetWordFontIndex(uint16_t word, int32_t charset, int32_t nFontIndex);
int32_t GetDefaultFontIndex();
- FX_BOOL IsLatinWord(uint16_t word);
+ bool IsLatinWord(uint16_t word);
CPVT_WordPlace AddSection(const CPVT_WordPlace& place,
const CPVT_SectionInfo& secinfo);
@@ -177,12 +177,10 @@ class CPDF_VariableText {
const CPVT_LineInfo& lineinfo);
CPVT_WordPlace AddWord(const CPVT_WordPlace& place,
const CPVT_WordInfo& wordinfo);
- FX_BOOL GetWordInfo(const CPVT_WordPlace& place, CPVT_WordInfo& wordinfo);
- FX_BOOL SetWordInfo(const CPVT_WordPlace& place,
- const CPVT_WordInfo& wordinfo);
- FX_BOOL GetLineInfo(const CPVT_WordPlace& place, CPVT_LineInfo& lineinfo);
- FX_BOOL GetSectionInfo(const CPVT_WordPlace& place,
- CPVT_SectionInfo& secinfo);
+ bool GetWordInfo(const CPVT_WordPlace& place, CPVT_WordInfo& wordinfo);
+ bool SetWordInfo(const CPVT_WordPlace& place, const CPVT_WordInfo& wordinfo);
+ bool GetLineInfo(const CPVT_WordPlace& place, CPVT_LineInfo& lineinfo);
+ bool GetSectionInfo(const CPVT_WordPlace& place, CPVT_SectionInfo& secinfo);
FX_FLOAT GetWordFontSize(const CPVT_WordInfo& WordInfo);
FX_FLOAT GetWordWidth(int32_t nFontIndex,
uint16_t Word,
@@ -209,7 +207,7 @@ class CPDF_VariableText {
void ClearSectionRightWords(const CPVT_WordPlace& place);
- FX_BOOL ClearEmptySection(const CPVT_WordPlace& place);
+ bool ClearEmptySection(const CPVT_WordPlace& place);
void ClearEmptySections(const CPVT_WordRange& PlaceRange);
void LinkLatterSection(const CPVT_WordPlace& place);
void ClearWords(const CPVT_WordRange& PlaceRange);
@@ -226,16 +224,16 @@ class CPDF_VariableText {
CPVT_ArrayTemplate<CSection*> m_SectionArray;
int32_t m_nLimitChar;
int32_t m_nCharArray;
- FX_BOOL m_bMultiLine;
- FX_BOOL m_bLimitWidth;
- FX_BOOL m_bAutoFontSize;
+ bool m_bMultiLine;
+ bool m_bLimitWidth;
+ bool m_bAutoFontSize;
int32_t m_nAlignment;
FX_FLOAT m_fLineLeading;
FX_FLOAT m_fCharSpace;
int32_t m_nHorzScale;
uint16_t m_wSubWord;
FX_FLOAT m_fFontSize;
- FX_BOOL m_bInitial;
+ bool m_bInitial;
CPDF_VariableText::Provider* m_pVTProvider;
std::unique_ptr<CPDF_VariableText::Iterator> m_pVTIterator;
CFX_FloatRect m_rcPlate;
diff --git a/core/fpdfdoc/cpdf_viewerpreferences.cpp b/core/fpdfdoc/cpdf_viewerpreferences.cpp
index fb005bef86..799f2d5814 100644
--- a/core/fpdfdoc/cpdf_viewerpreferences.cpp
+++ b/core/fpdfdoc/cpdf_viewerpreferences.cpp
@@ -13,14 +13,14 @@ CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document* pDoc)
CPDF_ViewerPreferences::~CPDF_ViewerPreferences() {}
-FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const {
+bool CPDF_ViewerPreferences::IsDirectionR2L() const {
CPDF_Dictionary* pDict = GetViewerPreferences();
- return pDict ? pDict->GetStringFor("Direction") == "R2L" : FALSE;
+ return pDict ? pDict->GetStringFor("Direction") == "R2L" : false;
}
-FX_BOOL CPDF_ViewerPreferences::PrintScaling() const {
+bool CPDF_ViewerPreferences::PrintScaling() const {
CPDF_Dictionary* pDict = GetViewerPreferences();
- return pDict ? pDict->GetStringFor("PrintScaling") != "None" : TRUE;
+ return pDict ? pDict->GetStringFor("PrintScaling") != "None" : true;
}
int32_t CPDF_ViewerPreferences::NumCopies() const {
diff --git a/core/fpdfdoc/cpdf_viewerpreferences.h b/core/fpdfdoc/cpdf_viewerpreferences.h
index f400c37b97..c64292d9f9 100644
--- a/core/fpdfdoc/cpdf_viewerpreferences.h
+++ b/core/fpdfdoc/cpdf_viewerpreferences.h
@@ -19,8 +19,8 @@ class CPDF_ViewerPreferences {
explicit CPDF_ViewerPreferences(CPDF_Document* pDoc);
~CPDF_ViewerPreferences();
- FX_BOOL IsDirectionR2L() const;
- FX_BOOL PrintScaling() const;
+ bool IsDirectionR2L() const;
+ bool PrintScaling() const;
int32_t NumCopies() const;
CPDF_Array* PrintPageRange() const;
CFX_ByteString Duplex() const;
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index 28b436a05c..66abde63a8 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -215,21 +215,21 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
vt.SetPlateRect(rcBody);
vt.SetAlignment(nAlign);
if (IsFloatZero(fFontSize))
- vt.SetAutoFontSize(TRUE);
+ vt.SetAutoFontSize(true);
else
vt.SetFontSize(fFontSize);
- FX_BOOL bMultiLine = (dwFlags >> 12) & 1;
+ bool bMultiLine = (dwFlags >> 12) & 1;
if (bMultiLine) {
- vt.SetMultiLine(TRUE);
- vt.SetAutoReturn(TRUE);
+ vt.SetMultiLine(true);
+ vt.SetAutoReturn(true);
}
uint16_t subWord = 0;
if ((dwFlags >> 13) & 1) {
subWord = '*';
vt.SetPasswordChar(subWord);
}
- FX_BOOL bCharArray = (dwFlags >> 24) & 1;
+ bool bCharArray = (dwFlags >> 24) & 1;
if (bCharArray)
vt.SetCharArray(dwMaxLen);
else
@@ -281,7 +281,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
rcEdit.Normalize();
vt.SetPlateRect(rcEdit);
if (IsFloatZero(fFontSize))
- vt.SetAutoFontSize(TRUE);
+ vt.SetAutoFontSize(true);
else
vt.SetFontSize(fFontSize);
@@ -292,7 +292,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
CFX_FloatPoint ptOffset =
CFX_FloatPoint(0.0f, (rcContent.Height() - rcEdit.Height()) / 2.0f);
CFX_ByteString sEdit = CPVT_GenerateAP::GenerateEditAP(
- &map, vt.GetIterator(), ptOffset, TRUE, 0);
+ &map, vt.GetIterator(), ptOffset, true, 0);
if (sEdit.GetLength() > 0) {
sAppStream << "/Tx BMC\n"
<< "q\n";
@@ -359,12 +359,12 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
else if (CPDF_Array* pArray = pOpt->AsArray())
swItem = pArray->GetDirectObjectAt(1)->GetUnicodeText();
- FX_BOOL bSelected = FALSE;
+ bool bSelected = false;
if (pSels) {
for (size_t s = 0, ssz = pSels->GetCount(); s < ssz; s++) {
int value = pSels->GetIntegerAt(s);
if (value >= 0 && i == static_cast<size_t>(value)) {
- bSelected = TRUE;
+ bSelected = true;
break;
}
}
@@ -396,7 +396,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
PaintOperation::FILL)
<< CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(),
CFX_FloatPoint(0.0f, fy),
- TRUE, 0)
+ true, 0)
<< "ET\n";
} else {
sBody << "BT\n"
@@ -404,7 +404,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
PaintOperation::FILL)
<< CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(),
CFX_FloatPoint(0.0f, fy),
- TRUE, 0)
+ true, 0)
<< "ET\n";
}
fy -= fItemHeight;
@@ -515,15 +515,15 @@ CFX_ByteString GetPopupContentsString(CPDF_Document* pDoc,
vt.SetProvider(&prd);
vt.SetPlateRect(pAnnotDict.GetRectFor("Rect"));
vt.SetFontSize(12);
- vt.SetAutoReturn(TRUE);
- vt.SetMultiLine(TRUE);
+ vt.SetAutoReturn(true);
+ vt.SetMultiLine(true);
vt.Initialize();
vt.SetText(swValue);
vt.RearrangeAll();
CFX_FloatPoint ptOffset(3.0f, -3.0f);
CFX_ByteString sContent = CPVT_GenerateAP::GenerateEditAP(
- &map, vt.GetIterator(), ptOffset, FALSE, 0);
+ &map, vt.GetIterator(), ptOffset, false, 0);
if (sContent.IsEmpty())
return CFX_ByteString();
@@ -1098,7 +1098,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
IPVT_FontMap* pFontMap,
CPDF_VariableText::Iterator* pIterator,
const CFX_FloatPoint& ptOffset,
- FX_BOOL bContinuous,
+ bool bContinuous,
uint16_t SubWord) {
CFX_ByteTextBuf sEditStream;
CFX_ByteTextBuf sLineStream;
diff --git a/core/fpdfdoc/cpvt_generateap.h b/core/fpdfdoc/cpvt_generateap.h
index 5a52d87250..16c939fe92 100644
--- a/core/fpdfdoc/cpvt_generateap.h
+++ b/core/fpdfdoc/cpvt_generateap.h
@@ -49,7 +49,7 @@ class CPVT_GenerateAP {
static CFX_ByteString GenerateEditAP(IPVT_FontMap* pFontMap,
CPDF_VariableText::Iterator* pIterator,
const CFX_FloatPoint& ptOffset,
- FX_BOOL bContinuous,
+ bool bContinuous,
uint16_t SubWord);
static CFX_ByteString GenerateBorderAP(const CFX_FloatRect& rect,
FX_FLOAT fWidth,
diff --git a/core/fpdfdoc/cpvt_wordplace.h b/core/fpdfdoc/cpvt_wordplace.h
index 00b5215d57..f4a6b087b9 100644
--- a/core/fpdfdoc/cpvt_wordplace.h
+++ b/core/fpdfdoc/cpvt_wordplace.h
@@ -27,7 +27,7 @@ struct CPVT_WordPlace {
wp.nWordIndex == nWordIndex;
}
- FX_BOOL operator!=(const CPVT_WordPlace& wp) const { return !(*this == wp); }
+ bool operator!=(const CPVT_WordPlace& wp) const { return !(*this == wp); }
inline int32_t WordCmp(const CPVT_WordPlace& wp) const {
if (nSecIndex > wp.nSecIndex)
diff --git a/core/fpdfdoc/cpvt_wordrange.h b/core/fpdfdoc/cpvt_wordrange.h
index a92613c6a7..b291e50e53 100644
--- a/core/fpdfdoc/cpvt_wordrange.h
+++ b/core/fpdfdoc/cpvt_wordrange.h
@@ -38,9 +38,9 @@ struct CPVT_WordRange {
SwapWordPlace();
}
- FX_BOOL IsExist() const { return BeginPos != EndPos; }
+ bool IsExist() const { return BeginPos != EndPos; }
- FX_BOOL operator!=(const CPVT_WordRange& wr) const {
+ bool operator!=(const CPVT_WordRange& wr) const {
return wr.BeginPos != BeginPos || wr.EndPos != EndPos;
}
diff --git a/core/fpdfdoc/csection.cpp b/core/fpdfdoc/csection.cpp
index 6686c0c773..4964504175 100644
--- a/core/fpdfdoc/csection.cpp
+++ b/core/fpdfdoc/csection.cpp
@@ -149,8 +149,8 @@ void CSection::UpdateWordPlace(CPVT_WordPlace& place) const {
CPVT_WordPlace CSection::SearchWordPlace(const CFX_FloatPoint& point) const {
ASSERT(m_pVT);
CPVT_WordPlace place = GetBeginWordPlace();
- FX_BOOL bUp = TRUE;
- FX_BOOL bDown = TRUE;
+ bool bUp = true;
+ bool bDown = true;
int32_t nLeft = 0;
int32_t nRight = m_LineArray.GetSize() - 1;
int32_t nMid = m_LineArray.GetSize() / 2;
@@ -162,10 +162,10 @@ CPVT_WordPlace CSection::SearchWordPlace(const CFX_FloatPoint& point) const {
m_pVT->GetLineLeading(m_SecInfo);
fBottom = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineDescent;
if (IsFloatBigger(point.y, fTop)) {
- bUp = FALSE;
+ bUp = false;
}
if (IsFloatSmaller(point.y, fBottom)) {
- bDown = FALSE;
+ bDown = false;
}
if (IsFloatSmaller(point.y, fTop)) {
nRight = nMid - 1;
diff --git a/core/fpdfdoc/ctypeset.cpp b/core/fpdfdoc/ctypeset.cpp
index cfaeb4ca7c..452143e682 100644
--- a/core/fpdfdoc/ctypeset.cpp
+++ b/core/fpdfdoc/ctypeset.cpp
@@ -258,20 +258,20 @@ CPVT_FloatRect CTypeset::CharArray() {
CFX_SizeF CTypeset::GetEditSize(FX_FLOAT fFontSize) {
ASSERT(m_pSection);
ASSERT(m_pVT);
- SplitLines(FALSE, fFontSize);
+ SplitLines(false, fFontSize);
return CFX_SizeF(m_rcRet.Width(), m_rcRet.Height());
}
CPVT_FloatRect CTypeset::Typeset() {
ASSERT(m_pVT);
m_pSection->m_LineArray.Empty();
- SplitLines(TRUE, 0.0f);
+ SplitLines(true, 0.0f);
m_pSection->m_LineArray.Clear();
OutputLines();
return m_rcRet;
}
-void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) {
+void CTypeset::SplitLines(bool bTypeset, FX_FLOAT fFontSize) {
ASSERT(m_pVT);
ASSERT(m_pSection);
int32_t nLineHead = 0;
@@ -281,7 +281,7 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) {
FX_FLOAT fLineAscent = 0.0f, fBackupLineAscent = 0.0f;
FX_FLOAT fLineDescent = 0.0f, fBackupLineDescent = 0.0f;
int32_t nWordStartPos = 0;
- FX_BOOL bFullWord = FALSE;
+ bool bFullWord = false;
int32_t nLineFullWordIndex = 0;
int32_t nCharIndex = 0;
CPVT_LineInfo line;
@@ -290,7 +290,7 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) {
m_pVT->GetPlateWidth() - m_pVT->GetLineIndent(m_pSection->m_SecInfo),
0.0f);
int32_t nTotalWords = m_pSection->m_WordArray.GetSize();
- FX_BOOL bOpened = FALSE;
+ bool bOpened = false;
if (nTotalWords > 0) {
int32_t i = 0;
while (i < nTotalWords) {
@@ -316,20 +316,20 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) {
}
if (!bOpened) {
if (IsOpenStylePunctuation(pWord->Word)) {
- bOpened = TRUE;
- bFullWord = TRUE;
+ bOpened = true;
+ bFullWord = true;
} else if (pOldWord) {
if (NeedDivision(pOldWord->Word, pWord->Word)) {
- bFullWord = TRUE;
+ bFullWord = true;
}
}
} else {
if (!IsSpace(pWord->Word) && !IsOpenStylePunctuation(pWord->Word)) {
- bOpened = FALSE;
+ bOpened = false;
}
}
if (bFullWord) {
- bFullWord = FALSE;
+ bFullWord = false;
if (nCharIndex > 0) {
nLineFullWordIndex++;
}
@@ -371,7 +371,7 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) {
fLineDescent = 0.0f;
nCharIndex = 0;
nLineFullWordIndex = 0;
- bFullWord = FALSE;
+ bFullWord = false;
} else {
fLineWidth += fWordWidth;
i++;
diff --git a/core/fpdfdoc/ctypeset.h b/core/fpdfdoc/ctypeset.h
index 3f6551d18c..4161c03b42 100644
--- a/core/fpdfdoc/ctypeset.h
+++ b/core/fpdfdoc/ctypeset.h
@@ -23,7 +23,7 @@ class CTypeset final {
CPVT_FloatRect CharArray();
private:
- void SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize);
+ void SplitLines(bool bTypeset, FX_FLOAT fFontSize);
void OutputLines();
CPVT_FloatRect m_rcRet;
diff --git a/core/fpdfdoc/doc_tagged.cpp b/core/fpdfdoc/doc_tagged.cpp
index b38b484150..10c573b5ca 100644
--- a/core/fpdfdoc/doc_tagged.cpp
+++ b/core/fpdfdoc/doc_tagged.cpp
@@ -152,14 +152,14 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(
} else {
CPDF_StructElementImpl* pParentElement =
AddPageNode(pParent, map, nLevel + 1);
- FX_BOOL bSave = FALSE;
+ bool bSave = false;
for (CPDF_StructKid& kid : pParentElement->m_Kids) {
if (kid.m_Type != CPDF_StructKid::Element)
continue;
if (kid.m_Element.m_pDict != pDict)
continue;
kid.m_Element.m_pElement = pElement->Retain();
- bSave = TRUE;
+ bSave = true;
}
if (!bSave) {
pElement->Release();
@@ -168,15 +168,15 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(
}
return pElement;
}
-FX_BOOL CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict,
- CPDF_StructElementImpl* pElement) {
+bool CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict,
+ CPDF_StructElementImpl* pElement) {
CPDF_Object* pObj = m_pTreeRoot->GetDirectObjectFor("K");
if (!pObj)
- return FALSE;
+ return false;
if (pObj->IsDictionary()) {
if (pObj->GetObjNum() != pDict->GetObjNum())
- return FALSE;
+ return false;
m_Kids[0].Reset(pElement);
}
if (CPDF_Array* pTopKids = pObj->AsArray()) {
@@ -189,9 +189,9 @@ FX_BOOL CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict,
}
}
if (!bSave)
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree,
@@ -358,20 +358,20 @@ static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs,
}
CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
- FX_BOOL bInheritable,
+ bool bInheritable,
FX_FLOAT fLevel) {
if (fLevel > nMaxRecursion) {
return nullptr;
}
if (bInheritable) {
- CPDF_Object* pAttr = GetAttr(owner, name, FALSE);
+ CPDF_Object* pAttr = GetAttr(owner, name, false);
if (pAttr) {
return pAttr;
}
if (!m_pParent) {
return nullptr;
}
- return m_pParent->GetAttr(owner, name, TRUE, fLevel + 1);
+ return m_pParent->GetAttr(owner, name, true, fLevel + 1);
}
CPDF_Object* pA = m_pDict->GetDirectObjectFor("A");
if (pA) {
@@ -408,7 +408,7 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner,
}
CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
- FX_BOOL bInheritable,
+ bool bInheritable,
int subindex) {
CPDF_Object* pAttr = GetAttr(owner, name, bInheritable);
CPDF_Array* pArray = ToArray(pAttr);
@@ -423,7 +423,7 @@ CFX_ByteString CPDF_StructElementImpl::GetName(
const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
const CFX_ByteStringC& default_value,
- FX_BOOL bInheritable,
+ bool bInheritable,
int subindex) {
CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex);
if (ToName(pAttr))
@@ -434,7 +434,7 @@ CFX_ByteString CPDF_StructElementImpl::GetName(
FX_ARGB CPDF_StructElementImpl::GetColor(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
FX_ARGB default_value,
- FX_BOOL bInheritable,
+ bool bInheritable,
int subindex) {
CPDF_Array* pArray = ToArray(GetAttr(owner, name, bInheritable, subindex));
if (!pArray)
@@ -446,7 +446,7 @@ FX_ARGB CPDF_StructElementImpl::GetColor(const CFX_ByteStringC& owner,
FX_FLOAT CPDF_StructElementImpl::GetNumber(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
FX_FLOAT default_value,
- FX_BOOL bInheritable,
+ bool bInheritable,
int subindex) {
CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex);
return ToNumber(pAttr) ? pAttr->GetNumber() : default_value;
@@ -454,7 +454,7 @@ FX_FLOAT CPDF_StructElementImpl::GetNumber(const CFX_ByteStringC& owner,
int CPDF_StructElementImpl::GetInteger(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
int default_value,
- FX_BOOL bInheritable,
+ bool bInheritable,
int subindex) {
CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex);
return ToNumber(pAttr) ? pAttr->GetInteger() : default_value;
diff --git a/core/fpdfdoc/fpdf_tagged.h b/core/fpdfdoc/fpdf_tagged.h
index da382579ae..716e626743 100644
--- a/core/fpdfdoc/fpdf_tagged.h
+++ b/core/fpdfdoc/fpdf_tagged.h
@@ -62,31 +62,31 @@ class IPDF_StructElement {
virtual CPDF_Object* GetAttr(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
- FX_BOOL bInheritable = FALSE,
+ bool bInheritable = false,
FX_FLOAT fLevel = 0.0F) = 0;
virtual CFX_ByteString GetName(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
const CFX_ByteStringC& default_value,
- FX_BOOL bInheritable = FALSE,
+ bool bInheritable = false,
int subindex = -1) = 0;
virtual FX_ARGB GetColor(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
FX_ARGB default_value,
- FX_BOOL bInheritable = FALSE,
+ bool bInheritable = false,
int subindex = -1) = 0;
virtual FX_FLOAT GetNumber(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
FX_FLOAT default_value,
- FX_BOOL bInheritable = FALSE,
+ bool bInheritable = false,
int subindex = -1) = 0;
virtual int GetInteger(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
int default_value,
- FX_BOOL bInheritable = FALSE,
+ bool bInheritable = false,
int subindex = -1) = 0;
};
diff --git a/core/fpdfdoc/tagged_int.h b/core/fpdfdoc/tagged_int.h
index 14dfaf58b4..43e43f1ed6 100644
--- a/core/fpdfdoc/tagged_int.h
+++ b/core/fpdfdoc/tagged_int.h
@@ -32,8 +32,8 @@ class CPDF_StructTreeImpl final : public IPDF_StructTree {
CPDF_Dictionary* pElement,
std::map<CPDF_Dictionary*, CPDF_StructElementImpl*>& map,
int nLevel = 0);
- FX_BOOL AddTopLevelNode(CPDF_Dictionary* pDict,
- CPDF_StructElementImpl* pElement);
+ bool AddTopLevelNode(CPDF_Dictionary* pDict,
+ CPDF_StructElementImpl* pElement);
protected:
const CPDF_Dictionary* const m_pTreeRoot;
@@ -59,34 +59,34 @@ class CPDF_StructElementImpl final : public IPDF_StructElement {
const CPDF_StructKid& GetKid(int index) const override;
CPDF_Object* GetAttr(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
- FX_BOOL bInheritable = FALSE,
+ bool bInheritable = false,
FX_FLOAT fLevel = 0.0F) override;
CFX_ByteString GetName(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
const CFX_ByteStringC& default_value,
- FX_BOOL bInheritable = FALSE,
+ bool bInheritable = false,
int subindex = -1) override;
FX_ARGB GetColor(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
FX_ARGB default_value,
- FX_BOOL bInheritable = FALSE,
+ bool bInheritable = false,
int subindex = -1) override;
FX_FLOAT GetNumber(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
FX_FLOAT default_value,
- FX_BOOL bInheritable = FALSE,
+ bool bInheritable = false,
int subindex = -1) override;
int GetInteger(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
int default_value,
- FX_BOOL bInheritable = FALSE,
+ bool bInheritable = false,
int subindex = -1) override;
void LoadKids(CPDF_Dictionary* pDict);
void LoadKid(uint32_t PageObjNum, CPDF_Object* pObj, CPDF_StructKid* pKid);
CPDF_Object* GetAttr(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
- FX_BOOL bInheritable,
+ bool bInheritable,
int subindex);
CPDF_StructElementImpl* Retain();
void Release();
diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp
index 8546a8294c..a1fc93e158 100644
--- a/core/fpdftext/cpdf_linkextract.cpp
+++ b/core/fpdftext/cpdf_linkextract.cpp
@@ -108,7 +108,7 @@ bool CPDF_LinkExtract::CheckMailLink(CFX_WideString& str) {
if (ch != L'.' || i == pPos - 1 || i == 0) {
if (i == aPos - 1) {
// There is '.' or invalid char before '@'.
- return FALSE;
+ return false;
}
// End extracting for other invalid chars, '.' at the beginning, or
// consecutive '.'.
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index a65af601cc..f7654f3e87 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -670,7 +670,7 @@ void CPDF_TextPage::AddCharInfoByRLDirection(FX_WCHAR wChar,
}
info.m_Index = m_TextBuf.GetLength();
- wChar = FX_GetMirrorChar(wChar, TRUE, FALSE);
+ wChar = FX_GetMirrorChar(wChar, true, false);
FX_WCHAR* pDst = nullptr;
FX_STRSIZE nCount = Unicode_GetNormalization(wChar, pDst);
if (nCount >= 1) {
@@ -952,9 +952,9 @@ void CPDF_TextPage::SwapTempTextBuf(int32_t iCharListStartAppend,
std::swap(pTempBuffer[i], pTempBuffer[j]);
}
-FX_BOOL CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj,
- const CPDF_Font* pFont,
- int nItems) const {
+bool CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj,
+ const CPDF_Font* pFont,
+ int nItems) const {
CFX_WideString str;
for (int32_t i = 0; i < nItems; i++) {
CPDF_TextObjectItem item;
@@ -1059,8 +1059,8 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
int nItems = pTextObj->CountItems();
FX_FLOAT baseSpace = CalculateBaseSpace(pTextObj, matrix);
- const FX_BOOL bR2L = IsRightToLeft(pTextObj, pFont, nItems);
- const FX_BOOL bIsBidiAndMirrorInverse =
+ const bool bR2L = IsRightToLeft(pTextObj, pFont, nItems);
+ const bool bIsBidiAndMirrorInverse =
bR2L && (matrix.a * matrix.d - matrix.b * matrix.c) < 0;
int32_t iBufStartAppend = m_TempTextBuf.GetLength();
int32_t iCharListStartAppend =
@@ -1241,7 +1241,7 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::GetTextObjectWritingMode(
return m_TextlineDir;
}
-FX_BOOL CPDF_TextPage::IsHyphen(FX_WCHAR curChar) {
+bool CPDF_TextPage::IsHyphen(FX_WCHAR curChar) {
CFX_WideString strCurText = m_TempTextBuf.MakeString();
if (strCurText.IsEmpty())
strCurText = m_TextBuf.AsStringC();
@@ -1257,7 +1257,7 @@ FX_BOOL CPDF_TextPage::IsHyphen(FX_WCHAR curChar) {
(preChar >= L'a' && preChar <= L'z')) &&
((curChar >= L'A' && curChar <= L'Z') ||
(curChar >= L'a' && curChar <= L'z'))) {
- return TRUE;
+ return true;
}
}
const PAGECHAR_INFO* preInfo;
@@ -1266,13 +1266,13 @@ FX_BOOL CPDF_TextPage::IsHyphen(FX_WCHAR curChar) {
else if (!m_CharList.empty())
preInfo = &m_CharList.back();
else
- return FALSE;
+ return false;
if (FPDFTEXT_CHAR_PIECE == preInfo->m_Flag &&
(0xAD == preInfo->m_Unicode || 0x2D == preInfo->m_Unicode)) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
@@ -1350,7 +1350,7 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
rect1.Intersect(rect2);
if ((rect1.IsEmpty() && rect2.Height() > 5 && rect3.Height() > 5) ||
((y > threshold * 2 || y < threshold * -3) &&
- (FXSYS_fabs(y) < 1 ? FXSYS_fabs(x) < FXSYS_fabs(y) : TRUE))) {
+ (FXSYS_fabs(y) < 1 ? FXSYS_fabs(x) < FXSYS_fabs(y) : true))) {
bNewline = true;
if (nItem > 1) {
CPDF_TextObjectItem tempItem;
@@ -1428,10 +1428,10 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
return GenerateCharacter::None;
}
-FX_BOOL CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1,
- CPDF_TextObject* pTextObj2) {
+bool CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1,
+ CPDF_TextObject* pTextObj2) {
if (!pTextObj1 || !pTextObj2)
- return FALSE;
+ return false;
CFX_FloatRect rcPreObj(pTextObj2->m_Left, pTextObj2->m_Bottom,
pTextObj2->m_Right, pTextObj2->m_Top);
CFX_FloatRect rcCurObj(pTextObj1->m_Left, pTextObj1->m_Bottom,
@@ -1443,27 +1443,27 @@ FX_BOOL CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1,
PAGECHAR_INFO perCharTemp = m_CharList[nCount - 2];
FX_FLOAT dbSpace = perCharTemp.m_CharBox.Width();
if (dbXdif > dbSpace)
- return FALSE;
+ return false;
}
}
if (!rcPreObj.IsEmpty() || !rcCurObj.IsEmpty()) {
rcPreObj.Intersect(rcCurObj);
if (rcPreObj.IsEmpty())
- return FALSE;
+ return false;
if (FXSYS_fabs(rcPreObj.Width() - rcCurObj.Width()) >
rcCurObj.Width() / 2) {
- return FALSE;
+ return false;
}
if (pTextObj2->GetFontSize() != pTextObj1->GetFontSize())
- return FALSE;
+ return false;
}
int nPreCount = pTextObj2->CountItems();
int nCurCount = pTextObj1->CountItems();
if (nPreCount != nCurCount)
- return FALSE;
+ return false;
// If both objects have no items, consider them same.
if (!nPreCount)
- return TRUE;
+ return true;
CPDF_TextObjectItem itemPer = {0, 0.0f, 0.0f};
CPDF_TextObjectItem itemCur = {0, 0.0f, 0.0f};
@@ -1471,7 +1471,7 @@ FX_BOOL CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1,
pTextObj2->GetItemInfo(i, &itemPer);
pTextObj1->GetItemInfo(i, &itemCur);
if (itemCur.m_CharCode != itemPer.m_CharCode)
- return FALSE;
+ return false;
}
if (FXSYS_fabs(pTextObj1->GetPosX() - pTextObj2->GetPosX()) >
GetCharWidth(itemPer.m_CharCode, pTextObj2->GetFont()) *
@@ -1480,12 +1480,12 @@ FX_BOOL CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1,
std::max(std::max(rcPreObj.Height(), rcPreObj.Width()),
pTextObj2->GetFontSize()) /
8) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_TextPage::IsSameAsPreTextObject(
+bool CPDF_TextPage::IsSameAsPreTextObject(
CPDF_TextObject* pTextObj,
const CPDF_PageObjectList* pObjList,
CPDF_PageObjectList::const_iterator iter) {
@@ -1496,20 +1496,20 @@ FX_BOOL CPDF_TextPage::IsSameAsPreTextObject(
if (pOtherObj == pTextObj || !pOtherObj->IsText())
continue;
if (IsSameTextObject(pOtherObj->AsText(), pTextObj))
- return TRUE;
+ return true;
++i;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_TextPage::GenerateCharInfo(FX_WCHAR unicode, PAGECHAR_INFO& info) {
+bool CPDF_TextPage::GenerateCharInfo(FX_WCHAR unicode, PAGECHAR_INFO& info) {
const PAGECHAR_INFO* preChar;
if (!m_TempCharList.empty())
preChar = &m_TempCharList.back();
else if (!m_CharList.empty())
preChar = &m_CharList.back();
else
- return FALSE;
+ return false;
info.m_Index = m_TextBuf.GetLength();
info.m_Unicode = unicode;
info.m_pTextObj = nullptr;
@@ -1530,11 +1530,11 @@ FX_BOOL CPDF_TextPage::GenerateCharInfo(FX_WCHAR unicode, PAGECHAR_INFO& info) {
info.m_OriginY = preChar->m_OriginY;
info.m_CharBox = CFX_FloatRect(info.m_OriginX, info.m_OriginY, info.m_OriginX,
info.m_OriginY);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_TextPage::IsRectIntersect(const CFX_FloatRect& rect1,
- const CFX_FloatRect& rect2) {
+bool CPDF_TextPage::IsRectIntersect(const CFX_FloatRect& rect1,
+ const CFX_FloatRect& rect2) {
CFX_FloatRect rect = rect1;
rect.Intersect(rect2);
return !rect.IsEmpty();
diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h
index 99c2b5299b..aa1fc5bb03 100644
--- a/core/fpdftext/cpdf_textpage.h
+++ b/core/fpdftext/cpdf_textpage.h
@@ -107,8 +107,8 @@ class CPDF_TextPage {
FX_FLOAT& right,
FX_FLOAT& bottom) const;
- static FX_BOOL IsRectIntersect(const CFX_FloatRect& rect1,
- const CFX_FloatRect& rect2);
+ static bool IsRectIntersect(const CFX_FloatRect& rect1,
+ const CFX_FloatRect& rect2);
private:
enum class TextOrientation {
@@ -124,7 +124,7 @@ class CPDF_TextPage {
Hyphen,
};
- FX_BOOL IsHyphen(FX_WCHAR curChar);
+ bool IsHyphen(FX_WCHAR curChar);
bool IsControlChar(const PAGECHAR_INFO& charInfo);
void ProcessObject();
void ProcessFormObject(CPDF_FormObject* pFormObj,
@@ -136,12 +136,11 @@ class CPDF_TextPage {
CPDF_PageObjectList::const_iterator ObjPos);
GenerateCharacter ProcessInsertObject(const CPDF_TextObject* pObj,
const CFX_Matrix& formMatrix);
- FX_BOOL GenerateCharInfo(FX_WCHAR unicode, PAGECHAR_INFO& info);
- FX_BOOL IsSameAsPreTextObject(CPDF_TextObject* pTextObj,
- const CPDF_PageObjectList* pObjList,
- CPDF_PageObjectList::const_iterator ObjPos);
- FX_BOOL IsSameTextObject(CPDF_TextObject* pTextObj1,
- CPDF_TextObject* pTextObj2);
+ bool GenerateCharInfo(FX_WCHAR unicode, PAGECHAR_INFO& info);
+ bool IsSameAsPreTextObject(CPDF_TextObject* pTextObj,
+ const CPDF_PageObjectList* pObjList,
+ CPDF_PageObjectList::const_iterator ObjPos);
+ bool IsSameTextObject(CPDF_TextObject* pTextObj1, CPDF_TextObject* pTextObj2);
int GetCharWidth(uint32_t charCode, CPDF_Font* pFont) const;
void CloseTempLine();
FPDFText_MarkedContent PreMarkedContent(PDFTEXT_Obj pObj);
@@ -156,9 +155,9 @@ class CPDF_TextPage {
void AppendGeneratedCharacter(FX_WCHAR unicode, const CFX_Matrix& formMatrix);
void SwapTempTextBuf(int32_t iCharListStartAppend, int32_t iBufStartAppend);
- FX_BOOL IsRightToLeft(const CPDF_TextObject* pTextObj,
- const CPDF_Font* pFont,
- int nItems) const;
+ bool IsRightToLeft(const CPDF_TextObject* pTextObj,
+ const CPDF_Font* pFont,
+ int nItems) const;
const CPDF_Page* const m_pPage;
std::vector<uint16_t> m_CharIndex;
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index 1eb5c4e67b..a79b5e7e8a 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -17,7 +17,7 @@
namespace {
-FX_BOOL IsIgnoreSpaceCharacter(FX_WCHAR curChar) {
+bool IsIgnoreSpaceCharacter(FX_WCHAR curChar) {
if (curChar < 255 || (curChar >= 0x0600 && curChar <= 0x06FF) ||
(curChar >= 0xFE70 && curChar <= 0xFEFF) ||
(curChar >= 0xFB50 && curChar <= 0xFDFF) ||
@@ -26,9 +26,9 @@ FX_BOOL IsIgnoreSpaceCharacter(FX_WCHAR curChar) {
(curChar >= 0xA640 && curChar <= 0xA69F) ||
(curChar >= 0x2DE0 && curChar <= 0x2DFF) || curChar == 8467 ||
(curChar >= 0x2000 && curChar <= 0x206F)) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
} // namespace
@@ -38,11 +38,11 @@ CPDF_TextPageFind::CPDF_TextPageFind(const CPDF_TextPage* pTextPage)
m_flags(0),
m_findNextStart(-1),
m_findPreStart(-1),
- m_bMatchCase(FALSE),
- m_bMatchWholeWord(FALSE),
+ m_bMatchCase(false),
+ m_bMatchWholeWord(false),
m_resStart(0),
m_resEnd(-1),
- m_IsFind(FALSE) {
+ m_IsFind(false) {
m_strText = m_pTextPage->GetPageText();
int nCount = pTextPage->CountChars();
if (nCount)
@@ -81,11 +81,11 @@ int CPDF_TextPageFind::GetCharIndex(int index) const {
return m_pTextPage->CharIndexFromTextIndex(index);
}
-FX_BOOL CPDF_TextPageFind::FindFirst(const CFX_WideString& findwhat,
- int flags,
- int startPos) {
+bool CPDF_TextPageFind::FindFirst(const CFX_WideString& findwhat,
+ int flags,
+ int startPos) {
if (!m_pTextPage)
- return FALSE;
+ return false;
if (m_strText.IsEmpty() || m_bMatchCase != (flags & FPDFTEXT_MATCHCASE))
m_strText = m_pTextPage->GetPageText();
CFX_WideString findwhatStr = findwhat;
@@ -93,8 +93,8 @@ FX_BOOL CPDF_TextPageFind::FindFirst(const CFX_WideString& findwhat,
m_flags = flags;
m_bMatchCase = flags & FPDFTEXT_MATCHCASE;
if (m_strText.IsEmpty()) {
- m_IsFind = FALSE;
- return TRUE;
+ m_IsFind = false;
+ return true;
}
FX_STRSIZE len = findwhatStr.GetLength();
if (!m_bMatchCase) {
@@ -119,26 +119,26 @@ FX_BOOL CPDF_TextPageFind::FindFirst(const CFX_WideString& findwhat,
else
m_csFindWhatArray.push_back(findwhatStr);
if (m_csFindWhatArray.empty())
- return FALSE;
- m_IsFind = TRUE;
+ return false;
+ m_IsFind = true;
m_resStart = 0;
m_resEnd = -1;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_TextPageFind::FindNext() {
+bool CPDF_TextPageFind::FindNext() {
if (!m_pTextPage)
- return FALSE;
+ return false;
m_resArray.clear();
if (m_findNextStart == -1)
- return FALSE;
+ return false;
if (m_strText.IsEmpty()) {
- m_IsFind = FALSE;
+ m_IsFind = false;
return m_IsFind;
}
int strLen = m_strText.GetLength();
if (m_findNextStart > strLen - 1) {
- m_IsFind = FALSE;
+ m_IsFind = false;
return m_IsFind;
}
int nCount = pdfium::CollectionSize<int>(m_csFindWhatArray);
@@ -165,13 +165,13 @@ FX_BOOL CPDF_TextPageFind::FindNext() {
int endIndex;
nResultPos = m_strText.Find(csWord.c_str(), nStartPos);
if (nResultPos == -1) {
- m_IsFind = FALSE;
+ m_IsFind = false;
return m_IsFind;
}
endIndex = nResultPos + csWord.GetLength() - 1;
if (iWord == 0)
m_resStart = nResultPos;
- FX_BOOL bMatch = TRUE;
+ bool bMatch = true;
if (iWord != 0 && !bSpaceStart) {
int PreResEndPos = nStartPos;
int curChar = csWord.GetAt(0);
@@ -180,13 +180,13 @@ FX_BOOL CPDF_TextPageFind::FindNext() {
if (nStartPos == nResultPos &&
!(IsIgnoreSpaceCharacter(lastChar) ||
IsIgnoreSpaceCharacter(curChar))) {
- bMatch = FALSE;
+ bMatch = false;
}
for (int d = PreResEndPos; d < nResultPos; d++) {
FX_WCHAR strInsert = m_strText.GetAt(d);
if (strInsert != TEXT_LINEFEED_CHAR && strInsert != TEXT_SPACE_CHAR &&
strInsert != TEXT_RETURN_CHAR && strInsert != 160) {
- bMatch = FALSE;
+ bMatch = false;
break;
}
}
@@ -195,7 +195,7 @@ FX_BOOL CPDF_TextPageFind::FindNext() {
FX_WCHAR strInsert = m_strText.GetAt(nResultPos - 1);
if (strInsert != TEXT_LINEFEED_CHAR && strInsert != TEXT_SPACE_CHAR &&
strInsert != TEXT_RETURN_CHAR && strInsert != 160) {
- bMatch = FALSE;
+ bMatch = false;
m_resStart = nResultPos;
} else {
m_resStart = nResultPos - 1;
@@ -215,7 +215,7 @@ FX_BOOL CPDF_TextPageFind::FindNext() {
}
}
m_resEnd = nResultPos + m_csFindWhatArray.back().GetLength() - 1;
- m_IsFind = TRUE;
+ m_IsFind = true;
int resStart = GetCharIndex(m_resStart);
int resEnd = GetCharIndex(m_resEnd);
m_resArray = m_pTextPage->GetRectArray(resStart, resEnd - resStart + 1);
@@ -229,18 +229,18 @@ FX_BOOL CPDF_TextPageFind::FindNext() {
return m_IsFind;
}
-FX_BOOL CPDF_TextPageFind::FindPrev() {
+bool CPDF_TextPageFind::FindPrev() {
if (!m_pTextPage)
- return FALSE;
+ return false;
m_resArray.clear();
if (m_strText.IsEmpty() || m_findPreStart < 0) {
- m_IsFind = FALSE;
+ m_IsFind = false;
return m_IsFind;
}
CPDF_TextPageFind findEngine(m_pTextPage);
- FX_BOOL ret = findEngine.FindFirst(m_findWhat, m_flags);
+ bool ret = findEngine.FindFirst(m_findWhat, m_flags);
if (!ret) {
- m_IsFind = FALSE;
+ m_IsFind = false;
return m_IsFind;
}
int order = -1, MatchedCount = 0;
@@ -256,12 +256,12 @@ FX_BOOL CPDF_TextPageFind::FindPrev() {
}
}
if (order == -1) {
- m_IsFind = FALSE;
+ m_IsFind = false;
return m_IsFind;
}
m_resStart = m_pTextPage->TextIndexFromCharIndex(order);
m_resEnd = m_pTextPage->TextIndexFromCharIndex(order + MatchedCount - 1);
- m_IsFind = TRUE;
+ m_IsFind = true;
m_resArray = m_pTextPage->GetRectArray(order, MatchedCount);
if (m_flags & FPDFTEXT_CONSECUTIVE) {
m_findNextStart = m_resStart + 1;
@@ -318,16 +318,16 @@ void CPDF_TextPageFind::ExtractFindWhat(const CFX_WideString& findwhat) {
}
}
-FX_BOOL CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText,
- int startPos,
- int endPos) {
+bool CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText,
+ int startPos,
+ int endPos) {
FX_WCHAR char_left = 0;
FX_WCHAR char_right = 0;
int char_count = endPos - startPos + 1;
if (char_count < 1)
- return FALSE;
+ return false;
if (char_count == 1 && csPageText.GetAt(startPos) > 255)
- return TRUE;
+ return true;
if (startPos - 1 >= 0)
char_left = csPageText.GetAt(startPos - 1);
if (startPos + char_count < csPageText.GetLength())
@@ -339,39 +339,39 @@ FX_BOOL CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText,
(char_right > 'a' && char_right < 'z') ||
(char_right > 0xfb00 && char_right < 0xfb06) ||
std::iswdigit(char_right)) {
- return FALSE;
+ return false;
}
if (!(('A' > char_left || char_left > 'Z') &&
('a' > char_left || char_left > 'z') &&
('A' > char_right || char_right > 'Z') &&
('a' > char_right || char_right > 'z'))) {
- return FALSE;
+ return false;
}
if (char_count > 0) {
if (csPageText.GetAt(startPos) >= L'0' &&
csPageText.GetAt(startPos) <= L'9' && char_left >= L'0' &&
char_left <= L'9') {
- return FALSE;
+ return false;
}
if (csPageText.GetAt(endPos) >= L'0' && csPageText.GetAt(endPos) <= L'9' &&
char_right >= L'0' && char_right <= L'9') {
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString,
- const FX_WCHAR* lpszFullString,
- int iSubString,
- FX_WCHAR chSep) {
+bool CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString,
+ const FX_WCHAR* lpszFullString,
+ int iSubString,
+ FX_WCHAR chSep) {
if (!lpszFullString)
- return FALSE;
+ return false;
while (iSubString--) {
lpszFullString = std::wcschr(lpszFullString, chSep);
if (!lpszFullString) {
rString.clear();
- return FALSE;
+ return false;
}
lpszFullString++;
while (*lpszFullString == chSep)
@@ -384,7 +384,7 @@ FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString,
FXSYS_memcpy(rString.GetBuffer(nLen), lpszFullString,
nLen * sizeof(FX_WCHAR));
rString.ReleaseBuffer();
- return TRUE;
+ return true;
}
CFX_WideString CPDF_TextPageFind::MakeReverse(const CFX_WideString& str) {
diff --git a/core/fpdftext/cpdf_textpagefind.h b/core/fpdftext/cpdf_textpagefind.h
index f84ae37c73..c60cb576a7 100644
--- a/core/fpdftext/cpdf_textpagefind.h
+++ b/core/fpdftext/cpdf_textpagefind.h
@@ -20,23 +20,21 @@ class CPDF_TextPageFind {
explicit CPDF_TextPageFind(const CPDF_TextPage* pTextPage);
~CPDF_TextPageFind();
- FX_BOOL FindFirst(const CFX_WideString& findwhat,
- int flags,
- int startPos = 0);
- FX_BOOL FindNext();
- FX_BOOL FindPrev();
+ bool FindFirst(const CFX_WideString& findwhat, int flags, int startPos = 0);
+ bool FindNext();
+ bool FindPrev();
int GetCurOrder() const;
int GetMatchedCount() const;
protected:
void ExtractFindWhat(const CFX_WideString& findwhat);
- FX_BOOL IsMatchWholeWord(const CFX_WideString& csPageText,
- int startPos,
- int endPos);
- FX_BOOL ExtractSubString(CFX_WideString& rString,
- const FX_WCHAR* lpszFullString,
- int iSubString,
- FX_WCHAR chSep);
+ bool IsMatchWholeWord(const CFX_WideString& csPageText,
+ int startPos,
+ int endPos);
+ bool ExtractSubString(CFX_WideString& rString,
+ const FX_WCHAR* lpszFullString,
+ int iSubString,
+ FX_WCHAR chSep);
CFX_WideString MakeReverse(const CFX_WideString& str);
int GetCharIndex(int index) const;
@@ -49,12 +47,12 @@ class CPDF_TextPageFind {
std::vector<CFX_WideString> m_csFindWhatArray;
int m_findNextStart;
int m_findPreStart;
- FX_BOOL m_bMatchCase;
- FX_BOOL m_bMatchWholeWord;
+ bool m_bMatchCase;
+ bool m_bMatchWholeWord;
int m_resStart;
int m_resEnd;
std::vector<CFX_FloatRect> m_resArray;
- FX_BOOL m_IsFind;
+ bool m_IsFind;
};
#endif // CORE_FPDFTEXT_CPDF_TEXTPAGEFIND_H_
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 &&
diff --git a/core/fxcodec/fx_codec.h b/core/fxcodec/fx_codec.h
index 0fb39413e1..faf74d0902 100644
--- a/core/fxcodec/fx_codec.h
+++ b/core/fxcodec/fx_codec.h
@@ -117,7 +117,7 @@ void AdobeCMYK_to_sRGB1(uint8_t c,
uint8_t& R,
uint8_t& G,
uint8_t& B);
-FX_BOOL MD5ComputeID(const void* buf, uint32_t dwSize, uint8_t ID[16]);
+bool MD5ComputeID(const void* buf, uint32_t dwSize, uint8_t ID[16]);
void FaxG4Decode(const uint8_t* src_buf,
uint32_t src_size,
int* pbitpos,
diff --git a/core/fxcodec/jbig2/JBig2_BitStream.cpp b/core/fxcodec/jbig2/JBig2_BitStream.cpp
index b5dfe92cda..dc4beabc4b 100644
--- a/core/fxcodec/jbig2/JBig2_BitStream.cpp
+++ b/core/fxcodec/jbig2/JBig2_BitStream.cpp
@@ -73,7 +73,7 @@ int32_t CJBig2_BitStream::read1Bit(uint32_t* dwResult) {
return 0;
}
-int32_t CJBig2_BitStream::read1Bit(FX_BOOL* bResult) {
+int32_t CJBig2_BitStream::read1Bit(bool* bResult) {
if (!IsInBound())
return -1;
diff --git a/core/fxcodec/jbig2/JBig2_BitStream.h b/core/fxcodec/jbig2/JBig2_BitStream.h
index 24e8faaf5b..aeb2eba693 100644
--- a/core/fxcodec/jbig2/JBig2_BitStream.h
+++ b/core/fxcodec/jbig2/JBig2_BitStream.h
@@ -20,7 +20,7 @@ class CJBig2_BitStream {
int32_t readNBits(uint32_t nBits, uint32_t* dwResult);
int32_t readNBits(uint32_t nBits, int32_t* nResult);
int32_t read1Bit(uint32_t* dwResult);
- int32_t read1Bit(FX_BOOL* bResult);
+ int32_t read1Bit(bool* bResult);
int32_t read1Byte(uint8_t* cResult);
int32_t readInteger(uint32_t* dwResult);
int32_t readShortInteger(uint16_t* wResult);
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp
index c0e40e325d..febd00b463 100644
--- a/core/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/fxcodec/jbig2/JBig2_Context.cpp
@@ -377,8 +377,8 @@ int32_t CJBig2_Context::ProcessingParseSegmentData(CJBig2_Segment* pSegment,
pPageInfo->m_bIsStriped = !!(wTemp & 0x8000);
pPageInfo->m_wMaxStripeSize = wTemp & 0x7fff;
bool bMaxHeight = (pPageInfo->m_dwHeight == 0xffffffff);
- if (bMaxHeight && pPageInfo->m_bIsStriped != TRUE)
- pPageInfo->m_bIsStriped = TRUE;
+ if (bMaxHeight && pPageInfo->m_bIsStriped != true)
+ pPageInfo->m_bIsStriped = true;
if (!m_bBufSpecified) {
uint32_t height =
@@ -582,7 +582,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment,
CJBig2_CacheKey key =
CJBig2_CacheKey(pSegment->m_dwObjNum, pSegment->m_dwDataOffset);
- FX_BOOL cache_hit = false;
+ bool cache_hit = false;
pSegment->m_nResultType = JBIG2_SYMBOL_DICT_POINTER;
if (m_bIsGlobal && key.first != 0) {
for (auto it = m_pSymbolDictCache->begin(); it != m_pSymbolDictCache->end();
diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.h b/core/fxcodec/jbig2/JBig2_GrdProc.h
index 3b334b113c..a82aecbf12 100644
--- a/core/fxcodec/jbig2/JBig2_GrdProc.h
+++ b/core/fxcodec/jbig2/JBig2_GrdProc.h
@@ -34,12 +34,12 @@ class CJBig2_GRDProc {
FXCODEC_STATUS Continue_decode(IFX_Pause* pPause);
FX_RECT GetReplaceRect() const { return m_ReplaceRect; }
- FX_BOOL MMR;
+ bool MMR;
uint32_t GBW;
uint32_t GBH;
uint8_t GBTEMPLATE;
- FX_BOOL TPGDON;
- FX_BOOL USESKIP;
+ bool TPGDON;
+ bool USESKIP;
CJBig2_Image* SKIP;
int8_t GBAT[8];
diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.h b/core/fxcodec/jbig2/JBig2_GrrdProc.h
index 1ba0d6add0..bdb49d7e91 100644
--- a/core/fxcodec/jbig2/JBig2_GrrdProc.h
+++ b/core/fxcodec/jbig2/JBig2_GrrdProc.h
@@ -36,7 +36,7 @@ class CJBig2_GRRDProc {
CJBig2_Image* GRREFERENCE;
int32_t GRREFERENCEDX;
int32_t GRREFERENCEDY;
- FX_BOOL TPGRON;
+ bool TPGRON;
int8_t GRAT[4];
};
diff --git a/core/fxcodec/jbig2/JBig2_GsidProc.h b/core/fxcodec/jbig2/JBig2_GsidProc.h
index c440ddb2b9..3d5dc2dd4a 100644
--- a/core/fxcodec/jbig2/JBig2_GsidProc.h
+++ b/core/fxcodec/jbig2/JBig2_GsidProc.h
@@ -24,8 +24,8 @@ class CJBig2_GSIDProc {
uint32_t* decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause);
public:
- FX_BOOL GSMMR;
- FX_BOOL GSUSESKIP;
+ bool GSMMR;
+ bool GSUSESKIP;
uint8_t GSBPP;
uint32_t GSW;
uint32_t GSH;
diff --git a/core/fxcodec/jbig2/JBig2_HtrdProc.h b/core/fxcodec/jbig2/JBig2_HtrdProc.h
index 0ff79dcf29..9a9a5c59c4 100644
--- a/core/fxcodec/jbig2/JBig2_HtrdProc.h
+++ b/core/fxcodec/jbig2/JBig2_HtrdProc.h
@@ -26,13 +26,13 @@ class CJBig2_HTRDProc {
public:
uint32_t HBW;
uint32_t HBH;
- FX_BOOL HMMR;
+ bool HMMR;
uint8_t HTEMPLATE;
uint32_t HNUMPATS;
CJBig2_Image** HPATS;
- FX_BOOL HDEFPIXEL;
+ bool HDEFPIXEL;
JBig2ComposeOp HCOMBOP;
- FX_BOOL HENABLESKIP;
+ bool HENABLESKIP;
uint32_t HGW;
uint32_t HGH;
int32_t HGX;
diff --git a/core/fxcodec/jbig2/JBig2_Image.cpp b/core/fxcodec/jbig2/JBig2_Image.cpp
index f20a1e8a2f..8f935ceb1f 100644
--- a/core/fxcodec/jbig2/JBig2_Image.cpp
+++ b/core/fxcodec/jbig2/JBig2_Image.cpp
@@ -119,28 +119,28 @@ void CJBig2_Image::copyLine(int32_t hTo, int32_t hFrom) {
m_nStride);
}
}
-void CJBig2_Image::fill(FX_BOOL v) {
+void CJBig2_Image::fill(bool v) {
if (!m_pData) {
return;
}
JBIG2_memset(m_pData, v ? 0xff : 0, m_nStride * m_nHeight);
}
-FX_BOOL CJBig2_Image::composeTo(CJBig2_Image* pDst,
- int32_t x,
- int32_t y,
- JBig2ComposeOp op) {
+bool CJBig2_Image::composeTo(CJBig2_Image* pDst,
+ int32_t x,
+ int32_t y,
+ JBig2ComposeOp op) {
if (!m_pData) {
- return FALSE;
+ return false;
}
return composeTo_opt2(pDst, x, y, op);
}
-FX_BOOL CJBig2_Image::composeTo(CJBig2_Image* pDst,
- int32_t x,
- int32_t y,
- JBig2ComposeOp op,
- const FX_RECT* pSrcRect) {
+bool CJBig2_Image::composeTo(CJBig2_Image* pDst,
+ int32_t x,
+ int32_t y,
+ JBig2ComposeOp op,
+ const FX_RECT* pSrcRect) {
if (!m_pData)
- return FALSE;
+ return false;
if (!pSrcRect || *pSrcRect == FX_RECT(0, 0, m_nWidth, m_nHeight))
return composeTo_opt2(pDst, x, y, op);
@@ -148,22 +148,22 @@ FX_BOOL CJBig2_Image::composeTo(CJBig2_Image* pDst,
return composeTo_opt2(pDst, x, y, op, pSrcRect);
}
-FX_BOOL CJBig2_Image::composeFrom(int32_t x,
- int32_t y,
- CJBig2_Image* pSrc,
- JBig2ComposeOp op) {
+bool CJBig2_Image::composeFrom(int32_t x,
+ int32_t y,
+ CJBig2_Image* pSrc,
+ JBig2ComposeOp op) {
if (!m_pData) {
- return FALSE;
+ return false;
}
return pSrc->composeTo(this, x, y, op);
}
-FX_BOOL CJBig2_Image::composeFrom(int32_t x,
- int32_t y,
- CJBig2_Image* pSrc,
- JBig2ComposeOp op,
- const FX_RECT* pSrcRect) {
+bool CJBig2_Image::composeFrom(int32_t x,
+ int32_t y,
+ CJBig2_Image* pSrc,
+ JBig2ComposeOp op,
+ const FX_RECT* pSrcRect) {
if (!m_pData) {
- return FALSE;
+ return false;
}
return pSrc->composeTo(this, x, y, op, pSrcRect);
}
@@ -229,7 +229,7 @@ CJBig2_Image* CJBig2_Image::subImage(int32_t x,
return pImage;
}
-void CJBig2_Image::expand(int32_t h, FX_BOOL v) {
+void CJBig2_Image::expand(int32_t h, bool v) {
if (!m_pData || h <= m_nHeight || h > kMaxImageBytes / m_nStride)
return;
@@ -246,10 +246,10 @@ void CJBig2_Image::expand(int32_t h, FX_BOOL v) {
m_nHeight = h;
}
-FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst,
- int32_t x,
- int32_t y,
- JBig2ComposeOp op) {
+bool CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst,
+ int32_t x,
+ int32_t y,
+ JBig2ComposeOp op) {
int32_t xs0 = 0, ys0 = 0, xs1 = 0, ys1 = 0, xd0 = 0, yd0 = 0, xd1 = 0,
yd1 = 0, xx = 0, yy = 0, w = 0, h = 0, middleDwords = 0, lineLeft = 0;
@@ -257,10 +257,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst,
tmp1 = 0, tmp2 = 0, maskL = 0, maskR = 0, maskM = 0;
if (!m_pData)
- return FALSE;
+ return false;
if (x < -1048576 || x > 1048576 || y < -1048576 || y > 1048576)
- return FALSE;
+ return false;
if (y < 0) {
ys0 = -y;
@@ -674,17 +674,17 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst,
}
return 1;
}
-FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst,
- int32_t x,
- int32_t y,
- JBig2ComposeOp op,
- const FX_RECT* pSrcRect) {
+bool CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst,
+ int32_t x,
+ int32_t y,
+ JBig2ComposeOp op,
+ const FX_RECT* pSrcRect) {
if (!m_pData) {
- return FALSE;
+ return false;
}
// TODO(weili): Check whether the range check is correct. Should x>=1048576?
if (x < -1048576 || x > 1048576 || y < -1048576 || y > 1048576) {
- return FALSE;
+ return false;
}
int32_t sw = pSrcRect->Width();
int32_t sh = pSrcRect->Height();
diff --git a/core/fxcodec/jbig2/JBig2_Image.h b/core/fxcodec/jbig2/JBig2_Image.h
index 695420d76c..54529ef868 100644
--- a/core/fxcodec/jbig2/JBig2_Image.h
+++ b/core/fxcodec/jbig2/JBig2_Image.h
@@ -34,40 +34,34 @@ class CJBig2_Image {
int32_t setPixel(int32_t x, int32_t y, int bVal);
void copyLine(int32_t hTo, int32_t hFrom);
- void fill(FX_BOOL v);
-
- FX_BOOL composeTo(CJBig2_Image* pDst,
- int32_t x,
- int32_t y,
- JBig2ComposeOp op);
- FX_BOOL composeTo(CJBig2_Image* pDst,
- int32_t x,
- int32_t y,
- JBig2ComposeOp op,
- const FX_RECT* pSrcRect);
-
- FX_BOOL composeTo_opt2(CJBig2_Image* pDst,
- int32_t x,
- int32_t y,
- JBig2ComposeOp op);
- FX_BOOL composeTo_opt2(CJBig2_Image* pDst,
- int32_t x,
- int32_t y,
- JBig2ComposeOp op,
- const FX_RECT* pSrcRect);
-
- FX_BOOL composeFrom(int32_t x,
+ void fill(bool v);
+
+ bool composeTo(CJBig2_Image* pDst, int32_t x, int32_t y, JBig2ComposeOp op);
+ bool composeTo(CJBig2_Image* pDst,
+ int32_t x,
+ int32_t y,
+ JBig2ComposeOp op,
+ const FX_RECT* pSrcRect);
+
+ bool composeTo_opt2(CJBig2_Image* pDst,
+ int32_t x,
int32_t y,
- CJBig2_Image* pSrc,
JBig2ComposeOp op);
- FX_BOOL composeFrom(int32_t x,
+ bool composeTo_opt2(CJBig2_Image* pDst,
+ int32_t x,
int32_t y,
- CJBig2_Image* pSrc,
JBig2ComposeOp op,
const FX_RECT* pSrcRect);
+ bool composeFrom(int32_t x, int32_t y, CJBig2_Image* pSrc, JBig2ComposeOp op);
+ bool composeFrom(int32_t x,
+ int32_t y,
+ CJBig2_Image* pSrc,
+ JBig2ComposeOp op,
+ const FX_RECT* pSrcRect);
+
CJBig2_Image* subImage(int32_t x, int32_t y, int32_t w, int32_t h);
- void expand(int32_t h, FX_BOOL v);
+ void expand(int32_t h, bool v);
uint8_t* m_pData;
diff --git a/core/fxcodec/jbig2/JBig2_Page.h b/core/fxcodec/jbig2/JBig2_Page.h
index 131d6c8ba7..064b9b3545 100644
--- a/core/fxcodec/jbig2/JBig2_Page.h
+++ b/core/fxcodec/jbig2/JBig2_Page.h
@@ -15,7 +15,7 @@ struct JBig2PageInfo {
uint32_t m_dwResolutionX;
uint32_t m_dwResolutionY;
uint8_t m_cFlags;
- FX_BOOL m_bIsStriped;
+ bool m_bIsStriped;
uint16_t m_wMaxStripeSize;
};
diff --git a/core/fxcodec/jbig2/JBig2_PddProc.h b/core/fxcodec/jbig2/JBig2_PddProc.h
index 93b2d350c1..578f603122 100644
--- a/core/fxcodec/jbig2/JBig2_PddProc.h
+++ b/core/fxcodec/jbig2/JBig2_PddProc.h
@@ -24,7 +24,7 @@ class CJBig2_PDDProc {
CJBig2_PatternDict* decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause);
public:
- FX_BOOL HDMMR;
+ bool HDMMR;
uint8_t HDPW;
uint8_t HDPH;
uint32_t GRAYMAX;
diff --git a/core/fxcodec/jbig2/JBig2_SddProc.cpp b/core/fxcodec/jbig2/JBig2_SddProc.cpp
index f6afb13497..7e9ace2046 100644
--- a/core/fxcodec/jbig2/JBig2_SddProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_SddProc.cpp
@@ -30,9 +30,9 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith(
int32_t DW;
CJBig2_Image* BS;
uint32_t I, J, REFAGGNINST;
- FX_BOOL* EXFLAGS;
+ bool* EXFLAGS;
uint32_t EXINDEX;
- FX_BOOL CUREXFLAG;
+ bool CUREXFLAG;
uint32_t EXRUNLENGTH;
uint32_t nTmp;
uint32_t SBNUMSYMS;
@@ -235,7 +235,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith(
}
EXINDEX = 0;
CUREXFLAG = 0;
- EXFLAGS = FX_Alloc(FX_BOOL, SDNUMINSYMS + SDNUMNEWSYMS);
+ EXFLAGS = FX_Alloc(bool, SDNUMINSYMS + SDNUMNEWSYMS);
num_ex_syms = 0;
while (EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) {
IAEX->decode(pArithDecoder, (int*)&EXRUNLENGTH);
@@ -299,9 +299,9 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(
int32_t DW;
CJBig2_Image *BS, *BHC;
uint32_t I, J, REFAGGNINST;
- FX_BOOL* EXFLAGS;
+ bool* EXFLAGS;
uint32_t EXINDEX;
- FX_BOOL CUREXFLAG;
+ bool CUREXFLAG;
uint32_t EXRUNLENGTH;
int32_t nVal, nBits;
uint32_t nTmp;
@@ -564,7 +564,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(
CUREXFLAG = 0;
pTable.reset(new CJBig2_HuffmanTable(HuffmanTable_B1, HuffmanTable_B1_Size,
HuffmanTable_HTOOB_B1));
- EXFLAGS = FX_Alloc(FX_BOOL, SDNUMINSYMS + SDNUMNEWSYMS);
+ EXFLAGS = FX_Alloc(bool, SDNUMINSYMS + SDNUMNEWSYMS);
num_ex_syms = 0;
while (EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) {
if (pHuffmanDecoder->decodeAValue(pTable.get(), (int*)&EXRUNLENGTH) != 0) {
diff --git a/core/fxcodec/jbig2/JBig2_SddProc.h b/core/fxcodec/jbig2/JBig2_SddProc.h
index fa799cb83f..4df0cb4146 100644
--- a/core/fxcodec/jbig2/JBig2_SddProc.h
+++ b/core/fxcodec/jbig2/JBig2_SddProc.h
@@ -30,8 +30,8 @@ class CJBig2_SDDProc {
IFX_Pause* pPause);
public:
- FX_BOOL SDHUFF;
- FX_BOOL SDREFAGG;
+ bool SDHUFF;
+ bool SDREFAGG;
uint32_t SDNUMINSYMS;
CJBig2_Image** SDINSYMS;
uint32_t SDNUMNEWSYMS;
diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.cpp b/core/fxcodec/jbig2/JBig2_TrdProc.cpp
index f3dd6be2b3..ccd8ebf98d 100644
--- a/core/fxcodec/jbig2/JBig2_TrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_TrdProc.cpp
@@ -89,7 +89,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream,
break;
}
}
- FX_BOOL RI = 0;
+ bool RI = 0;
if (SBREFINE != 0 && pStream->read1Bit(&RI) != 0) {
return nullptr;
}
diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.h b/core/fxcodec/jbig2/JBig2_TrdProc.h
index 9429a6a738..be50ec152f 100644
--- a/core/fxcodec/jbig2/JBig2_TrdProc.h
+++ b/core/fxcodec/jbig2/JBig2_TrdProc.h
@@ -47,8 +47,8 @@ class CJBig2_TRDProc {
JBig2ArithCtx* grContext,
JBig2IntDecoderState* pIDS);
- FX_BOOL SBHUFF;
- FX_BOOL SBREFINE;
+ bool SBHUFF;
+ bool SBREFINE;
uint32_t SBW;
uint32_t SBH;
uint32_t SBNUMINSTANCES;
@@ -59,10 +59,10 @@ class CJBig2_TRDProc {
uint8_t SBSYMCODELEN;
CJBig2_Image** SBSYMS;
- FX_BOOL SBDEFPIXEL;
+ bool SBDEFPIXEL;
JBig2ComposeOp SBCOMBOP;
- FX_BOOL TRANSPOSED;
+ bool TRANSPOSED;
JBig2Corner REFCORNER;
int8_t SBDSOFFSET;
diff --git a/core/fxcodec/lbmp/fx_bmp.cpp b/core/fxcodec/lbmp/fx_bmp.cpp
index b7f20666d8..9105c6ed9c 100644
--- a/core/fxcodec/lbmp/fx_bmp.cpp
+++ b/core/fxcodec/lbmp/fx_bmp.cpp
@@ -105,7 +105,7 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) {
bmp_ptr->bitCounts =
GetWord_LSBFirst((uint8_t*)&bmp_core_header_ptr->bcBitCount);
bmp_ptr->compress_flag = BMP_RGB;
- bmp_ptr->imgTB_flag = FALSE;
+ bmp_ptr->imgTB_flag = false;
} break;
case kBmpInfoHeaderSize: {
BmpInfoHeaderPtr bmp_info_header_ptr = nullptr;
@@ -130,7 +130,7 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) {
(uint8_t*)&bmp_info_header_ptr->biYPelsPerMeter);
if (bmp_ptr->height < 0) {
bmp_ptr->height = -bmp_ptr->height;
- bmp_ptr->imgTB_flag = TRUE;
+ bmp_ptr->imgTB_flag = true;
}
} break;
default: {
@@ -160,7 +160,7 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) {
(uint8_t*)&bmp_info_header_ptr->biYPelsPerMeter);
if (bmp_ptr->height < 0) {
bmp_ptr->height = -bmp_ptr->height;
- bmp_ptr->imgTB_flag = TRUE;
+ bmp_ptr->imgTB_flag = true;
}
if (bmp_ptr->compress_flag == BMP_RGB && biPlanes == 1 &&
bmp_ptr->color_used == 0) {
@@ -390,7 +390,7 @@ int32_t bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) {
uint8_t* first_byte_ptr = nullptr;
uint8_t* second_byte_ptr = nullptr;
bmp_ptr->col_num = 0;
- while (TRUE) {
+ while (true) {
uint32_t skip_size_org = bmp_ptr->skip_size;
if (!bmp_read_data(bmp_ptr, &first_byte_ptr, 1))
return 2;
@@ -492,7 +492,7 @@ int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) {
uint8_t* first_byte_ptr = nullptr;
uint8_t* second_byte_ptr = nullptr;
bmp_ptr->col_num = 0;
- while (TRUE) {
+ while (true) {
uint32_t skip_size_org = bmp_ptr->skip_size;
if (!bmp_read_data(bmp_ptr, &first_byte_ptr, 1))
return 2;
@@ -896,9 +896,9 @@ static void bmp_encode_rle4(bmp_compress_struct_p bmp_ptr,
dst_buf[dst_pos++] = RLE_EOI;
dst_size = dst_pos;
}
-FX_BOOL bmp_encode_image(bmp_compress_struct_p bmp_ptr,
- uint8_t*& dst_buf,
- uint32_t& dst_size) {
+bool bmp_encode_image(bmp_compress_struct_p bmp_ptr,
+ uint8_t*& dst_buf,
+ uint32_t& dst_size) {
uint32_t head_size = sizeof(BmpFileHeader) + sizeof(BmpInfoHeader);
uint32_t pal_size = sizeof(uint32_t) * bmp_ptr->pal_num;
if (bmp_ptr->info_header.biClrUsed > 0 &&
@@ -908,7 +908,7 @@ FX_BOOL bmp_encode_image(bmp_compress_struct_p bmp_ptr,
dst_size = head_size + sizeof(uint32_t) * bmp_ptr->pal_num;
dst_buf = FX_TryAlloc(uint8_t, dst_size);
if (!dst_buf)
- return FALSE;
+ return false;
FXSYS_memset(dst_buf, 0, dst_size);
bmp_ptr->file_header.bfOffBits = head_size;
@@ -935,5 +935,5 @@ FX_BOOL bmp_encode_image(bmp_compress_struct_p bmp_ptr,
}
bmp_ptr->file_header.bfSize = dst_size;
WriteFileHeader(&bmp_ptr->file_header, dst_buf);
- return TRUE;
+ return true;
}
diff --git a/core/fxcodec/lbmp/fx_bmp.h b/core/fxcodec/lbmp/fx_bmp.h
index dfaf2859ef..27a0f19970 100644
--- a/core/fxcodec/lbmp/fx_bmp.h
+++ b/core/fxcodec/lbmp/fx_bmp.h
@@ -84,7 +84,7 @@ struct tag_bmp_decompress_struct {
uint8_t* out_row_buffer;
uint16_t bitCounts;
uint32_t color_used;
- FX_BOOL imgTB_flag;
+ bool imgTB_flag;
int32_t pal_num;
int32_t pal_type;
uint32_t* pal_ptr;
@@ -99,8 +99,8 @@ struct tag_bmp_decompress_struct {
uint32_t mask_green;
uint32_t mask_blue;
- FX_BOOL (*bmp_get_data_position_fn)(bmp_decompress_struct_p bmp_ptr,
- uint32_t cur_pos);
+ bool (*bmp_get_data_position_fn)(bmp_decompress_struct_p bmp_ptr,
+ uint32_t cur_pos);
void (*bmp_get_row_fn)(bmp_decompress_struct_p bmp_ptr,
int32_t row_num,
uint8_t* row_buf);
@@ -137,7 +137,7 @@ struct tag_bmp_compress_struct {
uint32_t src_row;
uint8_t src_bpp;
uint32_t src_width;
- FX_BOOL src_free;
+ bool src_free;
uint32_t* pal_ptr;
uint16_t pal_num;
uint8_t bit_type;
@@ -145,9 +145,9 @@ struct tag_bmp_compress_struct {
bmp_compress_struct_p bmp_create_compress();
void bmp_destroy_compress(bmp_compress_struct_p bmp_ptr);
-FX_BOOL bmp_encode_image(bmp_compress_struct_p bmp_ptr,
- uint8_t*& dst_buf,
- uint32_t& dst_size);
+bool bmp_encode_image(bmp_compress_struct_p bmp_ptr,
+ uint8_t*& dst_buf,
+ uint32_t& dst_size);
uint16_t GetWord_LSBFirst(uint8_t* p);
void SetWord_LSBFirst(uint8_t* p, uint16_t v);
diff --git a/core/fxcodec/lgif/fx_gif.cpp b/core/fxcodec/lgif/fx_gif.cpp
index 08b008ddb4..b996ba9796 100644
--- a/core/fxcodec/lgif/fx_gif.cpp
+++ b/core/fxcodec/lgif/fx_gif.cpp
@@ -58,7 +58,7 @@ void CGifLZWDecoder::ClearTable() {
}
void CGifLZWDecoder::DecodeString(uint16_t code) {
stack_size = 0;
- while (TRUE) {
+ while (true) {
ASSERT(code <= code_next);
if (code < code_clear || code > code_next) {
break;
@@ -163,9 +163,7 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, uint32_t& des_size) {
}
return 0;
}
-static FX_BOOL gif_grow_buf(uint8_t*& dst_buf,
- uint32_t& dst_len,
- uint32_t size) {
+static bool gif_grow_buf(uint8_t*& dst_buf, uint32_t& dst_len, uint32_t size) {
if (dst_len < size) {
uint32_t len_org = dst_len;
while (dst_buf && dst_len < size) {
@@ -180,7 +178,7 @@ static FX_BOOL gif_grow_buf(uint8_t*& dst_buf,
FXSYS_memset(dst_buf + len_org, 0, dst_len - len_org);
return !!dst_buf;
}
- return TRUE;
+ return true;
}
static inline void gif_cut_index(uint8_t& val,
uint32_t index,
@@ -318,14 +316,14 @@ void CGifLZWEncoder::EncodeString(uint32_t index,
index_bit_cur++;
}
}
-FX_BOOL CGifLZWEncoder::Encode(const uint8_t* src_buf,
- uint32_t src_len,
- uint8_t*& dst_buf,
- uint32_t& dst_len,
- uint32_t& offset) {
+bool CGifLZWEncoder::Encode(const uint8_t* src_buf,
+ uint32_t src_len,
+ uint8_t*& dst_buf,
+ uint32_t& dst_len,
+ uint32_t& offset) {
uint8_t suffix;
if (setjmp(jmp)) {
- return FALSE;
+ return false;
}
while (src_bit_num < src_len) {
if (!LookUpInTable(src_buf, src_offset, src_bit_offset)) {
@@ -347,11 +345,11 @@ FX_BOOL CGifLZWEncoder::Encode(const uint8_t* src_buf,
src_offset = 0;
src_bit_offset = 0;
src_bit_num = 0;
- return TRUE;
+ return true;
}
-FX_BOOL CGifLZWEncoder::LookUpInTable(const uint8_t* buf,
- uint32_t& offset,
- uint8_t& out_bit_offset) {
+bool CGifLZWEncoder::LookUpInTable(const uint8_t* buf,
+ uint32_t& offset,
+ uint8_t& out_bit_offset) {
for (uint16_t i = table_cur; i < index_num; i++) {
if (code_table[i].prefix == code_table[index_num].prefix &&
code_table[i].suffix == code_table[index_num].suffix) {
@@ -359,11 +357,11 @@ FX_BOOL CGifLZWEncoder::LookUpInTable(const uint8_t* buf,
code_table[index_num].suffix =
gif_cut_buf(buf, offset, src_bit_cut, out_bit_offset, src_bit_num);
table_cur = i;
- return TRUE;
+ return true;
}
}
table_cur = code_end + 1;
- return FALSE;
+ return false;
}
void CGifLZWEncoder::Finish(uint8_t*& dst_buf,
uint32_t& dst_len,
@@ -554,7 +552,7 @@ int32_t gif_get_frame(gif_decompress_struct_p gif_ptr) {
return 0;
int32_t ret = 1;
- while (TRUE) {
+ while (true) {
switch (gif_ptr->decode_status) {
case GIF_D_STATUS_TAIL:
return 1;
@@ -859,14 +857,14 @@ int32_t gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) {
: 0;
gif_ptr->avail_in = 0;
if (!gif_img_gce_ptr) {
- FX_BOOL bRes = gif_ptr->gif_get_record_position_fn(
+ bool bRes = gif_ptr->gif_get_record_position_fn(
gif_ptr, gif_image_ptr->image_data_pos,
gif_image_ptr->image_info_ptr->left,
gif_image_ptr->image_info_ptr->top,
gif_image_ptr->image_info_ptr->width,
gif_image_ptr->image_info_ptr->height, loc_pal_num,
gif_image_ptr->local_pal_ptr, 0, 0, -1, 0,
- (FX_BOOL)((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)
+ (bool)((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)
->interlace);
if (!bRes) {
FX_Free(gif_image_ptr->image_row_buf);
@@ -875,7 +873,7 @@ int32_t gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) {
return 0;
}
} else {
- FX_BOOL bRes = gif_ptr->gif_get_record_position_fn(
+ bool bRes = gif_ptr->gif_get_record_position_fn(
gif_ptr, gif_image_ptr->image_data_pos,
gif_image_ptr->image_info_ptr->left,
gif_image_ptr->image_info_ptr->top,
@@ -883,14 +881,13 @@ int32_t gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) {
gif_image_ptr->image_info_ptr->height, loc_pal_num,
gif_image_ptr->local_pal_ptr,
(int32_t)gif_image_ptr->image_gce_ptr->delay_time,
- (FX_BOOL)((GifCEF*)&gif_image_ptr->image_gce_ptr->gce_flag)
- ->user_input,
+ (bool)((GifCEF*)&gif_image_ptr->image_gce_ptr->gce_flag)->user_input,
((GifCEF*)&gif_image_ptr->image_gce_ptr->gce_flag)->transparency
? (int32_t)gif_image_ptr->image_gce_ptr->trans_index
: -1,
(int32_t)((GifCEF*)&gif_image_ptr->image_gce_ptr->gce_flag)
->disposal_method,
- (FX_BOOL)((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)
+ (bool)((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)
->interlace);
if (!bRes) {
FX_Free(gif_image_ptr->image_row_buf);
@@ -1039,16 +1036,16 @@ uint32_t gif_get_avail_input(gif_decompress_struct_p gif_ptr,
int32_t gif_get_frame_num(gif_decompress_struct_p gif_ptr) {
return gif_ptr->img_ptr_arr_ptr->GetSize();
}
-static FX_BOOL gif_write_header(gif_compress_struct_p gif_ptr,
- uint8_t*& dst_buf,
- uint32_t& dst_len) {
+static bool gif_write_header(gif_compress_struct_p gif_ptr,
+ uint8_t*& dst_buf,
+ uint32_t& dst_len) {
if (gif_ptr->cur_offset) {
- return TRUE;
+ return true;
}
dst_len = sizeof(GifHeader) + sizeof(GifLSD) + sizeof(GifGF);
dst_buf = FX_TryAlloc(uint8_t, dst_len);
if (!dst_buf)
- return FALSE;
+ return false;
FXSYS_memset(dst_buf, 0, dst_len);
FXSYS_memcpy(dst_buf, gif_ptr->header_ptr, sizeof(GifHeader));
@@ -1063,12 +1060,12 @@ static FX_BOOL gif_write_header(gif_compress_struct_p gif_ptr,
if (gif_ptr->global_pal) {
uint16_t size = sizeof(GifPalette) * gif_ptr->gpal_num;
if (!gif_grow_buf(dst_buf, dst_len, gif_ptr->cur_offset + size)) {
- return FALSE;
+ return false;
}
FXSYS_memcpy(&dst_buf[gif_ptr->cur_offset], gif_ptr->global_pal, size);
gif_ptr->cur_offset += size;
}
- return TRUE;
+ return true;
}
void interlace_buf(const uint8_t* buf, uint32_t pitch, uint32_t height) {
CFX_ArrayTemplate<uint8_t*> pass[4];
@@ -1115,11 +1112,11 @@ static void gif_write_block_data(const uint8_t* src_buf,
FXSYS_memcpy(&dst_buf[dst_offset], &src_buf[src_offset], src_len);
dst_offset += src_len;
}
-static FX_BOOL gif_write_data(gif_compress_struct_p gif_ptr,
- uint8_t*& dst_buf,
- uint32_t& dst_len) {
+static bool gif_write_data(gif_compress_struct_p gif_ptr,
+ uint8_t*& dst_buf,
+ uint32_t& dst_len) {
if (!gif_grow_buf(dst_buf, dst_len, gif_ptr->cur_offset + GIF_DATA_BLOCK)) {
- return FALSE;
+ return false;
}
if (FXSYS_memcmp(gif_ptr->header_ptr->version, "89a", 3) == 0) {
dst_buf[gif_ptr->cur_offset++] = GIF_SIG_EXTENSION;
@@ -1153,7 +1150,7 @@ static FX_BOOL gif_write_data(gif_compress_struct_p gif_ptr,
if (gif_ptr->local_pal) {
uint32_t pal_size = sizeof(GifPalette) * gif_ptr->lpal_num;
if (!gif_grow_buf(dst_buf, dst_len, pal_size + gif_ptr->cur_offset)) {
- return FALSE;
+ return false;
}
FXSYS_memcpy(&dst_buf[gif_ptr->cur_offset], gif_ptr->local_pal, pal_size);
gif_ptr->cur_offset += pal_size;
@@ -1175,7 +1172,7 @@ static FX_BOOL gif_write_data(gif_compress_struct_p gif_ptr,
&gif_ptr->src_buf[i * gif_ptr->src_pitch],
gif_ptr->src_width * (code_bit + 1), dst_buf, dst_len,
gif_ptr->cur_offset)) {
- return FALSE;
+ return false;
}
}
gif_ptr->img_encoder_ptr->Finish(dst_buf, dst_len, gif_ptr->cur_offset);
@@ -1220,22 +1217,22 @@ static FX_BOOL gif_write_data(gif_compress_struct_p gif_ptr,
dst_buf[gif_ptr->cur_offset++] = 0;
}
dst_buf[gif_ptr->cur_offset++] = GIF_SIG_TRAILER;
- return TRUE;
+ return true;
}
-FX_BOOL gif_encode(gif_compress_struct_p gif_ptr,
- uint8_t*& dst_buf,
- uint32_t& dst_len) {
+bool gif_encode(gif_compress_struct_p gif_ptr,
+ uint8_t*& dst_buf,
+ uint32_t& dst_len) {
if (!gif_write_header(gif_ptr, dst_buf, dst_len)) {
- return FALSE;
+ return false;
}
uint32_t cur_offset = gif_ptr->cur_offset;
- FX_BOOL res = TRUE;
+ bool res = true;
if (gif_ptr->frames) {
gif_ptr->cur_offset--;
}
if (!gif_write_data(gif_ptr, dst_buf, dst_len)) {
gif_ptr->cur_offset = cur_offset;
- res = FALSE;
+ res = false;
}
dst_len = gif_ptr->cur_offset;
dst_buf[dst_len - 1] = GIF_SIG_TRAILER;
diff --git a/core/fxcodec/lgif/fx_gif.h b/core/fxcodec/lgif/fx_gif.h
index 2a40995bbe..eb5f85a187 100644
--- a/core/fxcodec/lgif/fx_gif.h
+++ b/core/fxcodec/lgif/fx_gif.h
@@ -168,18 +168,16 @@ class CGifLZWEncoder {
const uint8_t* src_buf,
uint8_t*& dst_buf,
uint32_t& offset);
- FX_BOOL Encode(const uint8_t* src_buf,
- uint32_t src_len,
- uint8_t*& dst_buf,
- uint32_t& dst_len,
- uint32_t& offset);
+ bool Encode(const uint8_t* src_buf,
+ uint32_t src_len,
+ uint8_t*& dst_buf,
+ uint32_t& dst_len,
+ uint32_t& offset);
void Finish(uint8_t*& dst_buf, uint32_t& dst_len, uint32_t& offset);
private:
void ClearTable();
- FX_BOOL LookUpInTable(const uint8_t* buf,
- uint32_t& offset,
- uint8_t& bit_offset);
+ bool LookUpInTable(const uint8_t* buf, uint32_t& offset, uint8_t& bit_offset);
void EncodeString(uint32_t index,
uint8_t*& dst_buf,
uint32_t& dst_len,
@@ -237,12 +235,19 @@ struct tag_gif_decompress_struct {
void (*gif_get_row_fn)(gif_decompress_struct_p gif_ptr,
int32_t row_num,
uint8_t* row_buf);
- FX_BOOL (*gif_get_record_position_fn)(gif_decompress_struct_p gif_ptr,
- 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);
+ bool (*gif_get_record_position_fn)(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);
CFX_ByteString* cmt_data_ptr;
GifGCE* gce_ptr;
CFX_ArrayTemplate<GifPlainText*>* pt_ptr_arr_ptr;
@@ -300,8 +305,8 @@ void gif_input_buffer(gif_decompress_struct_p gif_ptr,
uint32_t gif_get_avail_input(gif_decompress_struct_p gif_ptr,
uint8_t** avail_buf_ptr);
void interlace_buf(const uint8_t* buf, uint32_t width, uint32_t height);
-FX_BOOL gif_encode(gif_compress_struct_p gif_ptr,
- uint8_t*& dst_buf,
- uint32_t& dst_len);
+bool gif_encode(gif_compress_struct_p gif_ptr,
+ uint8_t*& dst_buf,
+ uint32_t& dst_len);
#endif // CORE_FXCODEC_LGIF_FX_GIF_H_
diff --git a/core/fxcrt/extension.h b/core/fxcrt/extension.h
index 5b1801bb1b..ca2fc3c5b7 100644
--- a/core/fxcrt/extension.h
+++ b/core/fxcrt/extension.h
@@ -46,7 +46,7 @@ class CFX_CRTFileAccess : public IFX_FileAccess {
void GetPath(CFX_WideString& wsPath) override;
IFX_SeekableStream* CreateFileStream(uint32_t dwModes) override;
- FX_BOOL Init(const CFX_WideStringC& wsPath);
+ bool Init(const CFX_WideStringC& wsPath);
protected:
CFX_WideString m_path;
@@ -81,8 +81,8 @@ class CFX_CRTFileStream final : public IFX_SeekableStream {
class CFX_MemoryStream final : public IFX_MemoryStream {
public:
- explicit CFX_MemoryStream(FX_BOOL bConsecutive);
- CFX_MemoryStream(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver);
+ explicit CFX_MemoryStream(bool bConsecutive);
+ CFX_MemoryStream(uint8_t* pBuffer, size_t nSize, bool bTakeOver);
~CFX_MemoryStream() override;
// IFX_MemoryStream
@@ -100,7 +100,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream {
uint8_t* GetBuffer() const override;
void AttachBuffer(uint8_t* pBuffer,
size_t nSize,
- bool bTakeOver = FALSE) override;
+ bool bTakeOver = false) override;
void DetachBuffer() override;
protected:
@@ -111,7 +111,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream {
size_t m_nCurPos;
size_t m_nGrowSize;
uint32_t m_dwFlags;
- FX_BOOL ExpandBlocks(size_t size);
+ bool ExpandBlocks(size_t size);
};
#ifdef __cplusplus
@@ -125,14 +125,14 @@ extern "C" {
struct FX_MTRANDOMCONTEXT {
FX_MTRANDOMCONTEXT() {
mti = MT_N + 1;
- bHaveSeed = FALSE;
+ bHaveSeed = false;
}
uint32_t mti;
- FX_BOOL bHaveSeed;
+ bool bHaveSeed;
uint32_t mt[MT_N];
};
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-FX_BOOL FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount);
+bool FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount);
#endif
#ifdef __cplusplus
}
diff --git a/core/fxcrt/fx_arabic.cpp b/core/fxcrt/fx_arabic.cpp
index ee04f40ac8..d6b3c6522d 100644
--- a/core/fxcrt/fx_arabic.cpp
+++ b/core/fxcrt/fx_arabic.cpp
@@ -376,7 +376,7 @@ int32_t FX_BidiReorderLevel(int32_t iBaseLevel,
CFX_WideString& wsText,
const CFX_Int32Array& levels,
int32_t iStart,
- FX_BOOL bReverse) {
+ bool bReverse) {
ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
ASSERT(wsText.GetLength() == levels.GetSize());
ASSERT(iStart >= 0 && iStart < wsText.GetLength());
@@ -412,7 +412,7 @@ void FX_BidiReorder(int32_t iBaseLevel,
}
int32_t i = 0;
while (i < iSize) {
- i += FX_BidiReorderLevel(iBaseLevel, wsText, levels, i, FALSE);
+ i += FX_BidiReorderLevel(iBaseLevel, wsText, levels, i, false);
}
}
@@ -435,7 +435,7 @@ class CFX_BidiLineTemplate {
}
}
void FX_BidiSetDeferredRun(CFX_ArrayTemplate<baseType>& chars,
- FX_BOOL bClass,
+ bool bClass,
int32_t iStart,
int32_t iCount,
int32_t iValue) {
@@ -457,7 +457,7 @@ class CFX_BidiLineTemplate {
}
void FX_BidiClassify(CFX_ArrayTemplate<baseType>& chars,
int32_t iCount,
- FX_BOOL bWS) {
+ bool bWS) {
ASSERT(iCount > -1 && iCount <= chars.GetSize());
baseType* pTC;
if (bWS) {
@@ -541,7 +541,7 @@ class CFX_BidiLineTemplate {
iAction = gc_FX_BidiWeakActions[iState][iClsCur];
iClsRun = FX_BidiGetDeferredType(iAction);
if (iClsRun != FX_BIDIWEAKACTION_XX && iNum > 0) {
- FX_BidiSetDeferredRun(chars, TRUE, i, iNum, iClsRun);
+ FX_BidiSetDeferredRun(chars, true, i, iNum, iClsRun);
iNum = 0;
}
iClsNew = FX_BidiGetResolvedType(iAction);
@@ -557,7 +557,7 @@ class CFX_BidiLineTemplate {
iClsCur = FX_BidiDirection(iBaseLevel);
iClsRun = FX_BidiGetDeferredType(gc_FX_BidiWeakActions[iState][iClsCur]);
if (iClsRun != FX_BIDIWEAKACTION_XX) {
- FX_BidiSetDeferredRun(chars, TRUE, i, iNum, iClsRun);
+ FX_BidiSetDeferredRun(chars, true, i, iNum, iClsRun);
}
}
}
@@ -587,7 +587,7 @@ class CFX_BidiLineTemplate {
iAction = gc_FX_BidiNeutralActions[iState][iClsCur];
iClsRun = FX_BidiGetDeferredNeutrals(iAction, iLevel);
if (iClsRun != FX_BIDICLASS_N && iNum > 0) {
- FX_BidiSetDeferredRun(chars, TRUE, i, iNum, iClsRun);
+ FX_BidiSetDeferredRun(chars, true, i, iNum, iClsRun);
iNum = 0;
}
iClsNew = FX_BidiGetResolvedNeutrals(iAction);
@@ -605,7 +605,7 @@ class CFX_BidiLineTemplate {
iClsRun = FX_BidiGetDeferredNeutrals(
gc_FX_BidiNeutralActions[iState][iClsCur], iLevel);
if (iClsRun != FX_BIDICLASS_N) {
- FX_BidiSetDeferredRun(chars, TRUE, i, iNum, iClsRun);
+ FX_BidiSetDeferredRun(chars, true, i, iNum, iClsRun);
}
}
}
@@ -656,7 +656,7 @@ class CFX_BidiLineTemplate {
case FX_BIDICLASS_S:
case FX_BIDICLASS_B:
if (iNum > 0) {
- FX_BidiSetDeferredRun(chars, FALSE, i, iNum, iBaseLevel);
+ FX_BidiSetDeferredRun(chars, false, i, iNum, iBaseLevel);
}
pTC->m_iBidiLevel = (int16_t)iBaseLevel;
iNum = 0;
@@ -668,14 +668,14 @@ class CFX_BidiLineTemplate {
iLevel = pTC->m_iBidiLevel;
}
if (iNum > 0) {
- FX_BidiSetDeferredRun(chars, FALSE, i, iNum, iBaseLevel);
+ FX_BidiSetDeferredRun(chars, false, i, iNum, iBaseLevel);
}
}
int32_t FX_BidiReorderLevel(CFX_ArrayTemplate<baseType>& chars,
int32_t iCount,
int32_t iBaseLevel,
int32_t iStart,
- FX_BOOL bReverse) {
+ bool bReverse) {
ASSERT(iCount > -1 && iCount <= chars.GetSize());
ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
ASSERT(iStart >= 0 && iStart < iCount);
@@ -708,7 +708,7 @@ class CFX_BidiLineTemplate {
ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
int32_t i = 0;
while (i < iCount) {
- i += FX_BidiReorderLevel(chars, iCount, iBaseLevel, i, FALSE);
+ i += FX_BidiReorderLevel(chars, iCount, iBaseLevel, i, false);
}
}
void FX_BidiPosition(CFX_ArrayTemplate<baseType>& chars, int32_t iCount) {
@@ -729,12 +729,12 @@ class CFX_BidiLineTemplate {
if (iCount < 2) {
return;
}
- FX_BidiClassify(chars, iCount, FALSE);
+ FX_BidiClassify(chars, iCount, false);
FX_BidiResolveExplicit(chars, iCount, iBaseLevel);
FX_BidiResolveWeak(chars, iCount, iBaseLevel);
FX_BidiResolveNeutrals(chars, iCount, iBaseLevel);
FX_BidiResolveImplicit(chars, iCount);
- FX_BidiClassify(chars, iCount, TRUE);
+ FX_BidiClassify(chars, iCount, true);
FX_BidiResolveWhitespace(chars, iCount, iBaseLevel);
FX_BidiReorder(chars, iCount, iBaseLevel);
FX_BidiPosition(chars, iCount);
diff --git a/core/fxcrt/fx_arabic.h b/core/fxcrt/fx_arabic.h
index e20a261b00..1f4d38b888 100644
--- a/core/fxcrt/fx_arabic.h
+++ b/core/fxcrt/fx_arabic.h
@@ -36,7 +36,7 @@ void FX_BidiSetDeferredRun(CFX_Int32Array& values,
int32_t iValue);
void FX_BidiClassify(const CFX_WideString& wsText,
CFX_Int32Array& classes,
- FX_BOOL bWS = FALSE);
+ bool bWS = false);
int32_t FX_BidiResolveExplicit(int32_t iBaseLevel,
int32_t iDirection,
CFX_Int32Array& classes,
@@ -180,7 +180,7 @@ int32_t FX_BidiReorderLevel(int32_t iBaseLevel,
CFX_WideString& wsText,
const CFX_Int32Array& levels,
int32_t iStart,
- FX_BOOL bReverse = FALSE);
+ bool bReverse = false);
void FX_BidiReorder(int32_t iBaseLevel,
CFX_WideString& wsText,
const CFX_Int32Array& levels);
diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h
index 6643d33dce..9c8b4e146e 100644
--- a/core/fxcrt/fx_basic.h
+++ b/core/fxcrt/fx_basic.h
@@ -182,12 +182,12 @@ class CFX_BasicArray {
CFX_BasicArray(const CFX_BasicArray&) = delete;
~CFX_BasicArray();
- FX_BOOL SetSize(int nNewSize);
- FX_BOOL Append(const CFX_BasicArray& src);
- FX_BOOL Copy(const CFX_BasicArray& src);
+ bool SetSize(int nNewSize);
+ bool Append(const CFX_BasicArray& src);
+ bool Copy(const CFX_BasicArray& src);
uint8_t* InsertSpaceAt(int nIndex, int nCount);
- FX_BOOL RemoveAt(int nIndex, int nCount);
- FX_BOOL InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray);
+ bool RemoveAt(int nIndex, int nCount);
+ bool InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray);
const void* GetDataPtr(int index) const;
protected:
@@ -206,7 +206,7 @@ class CFX_ArrayTemplate : public CFX_BasicArray {
int GetUpperBound() const { return m_nSize - 1; }
- FX_BOOL SetSize(int nNewSize) { return CFX_BasicArray::SetSize(nNewSize); }
+ bool SetSize(int nNewSize) { return CFX_BasicArray::SetSize(nNewSize); }
void RemoveAll() { SetSize(0); }
@@ -217,12 +217,12 @@ class CFX_ArrayTemplate : public CFX_BasicArray {
return ((const TYPE*)m_pData)[nIndex];
}
- FX_BOOL SetAt(int nIndex, TYPE newElement) {
+ bool SetAt(int nIndex, TYPE newElement) {
if (nIndex < 0 || nIndex >= m_nSize) {
- return FALSE;
+ return false;
}
((TYPE*)m_pData)[nIndex] = newElement;
- return TRUE;
+ return true;
}
TYPE& ElementAt(int nIndex) {
@@ -236,34 +236,32 @@ class CFX_ArrayTemplate : public CFX_BasicArray {
TYPE* GetData() { return (TYPE*)m_pData; }
- FX_BOOL SetAtGrow(int nIndex, TYPE newElement) {
+ bool SetAtGrow(int nIndex, TYPE newElement) {
if (nIndex < 0)
- return FALSE;
+ return false;
if (nIndex >= m_nSize && !SetSize(nIndex + 1))
- return FALSE;
+ return false;
((TYPE*)m_pData)[nIndex] = newElement;
- return TRUE;
+ return true;
}
- FX_BOOL Add(TYPE newElement) {
+ bool Add(TYPE newElement) {
if (m_nSize < m_nMaxSize) {
m_nSize++;
} else if (!SetSize(m_nSize + 1)) {
- return FALSE;
+ return false;
}
((TYPE*)m_pData)[m_nSize - 1] = newElement;
- return TRUE;
+ return true;
}
- FX_BOOL Append(const CFX_ArrayTemplate& src) {
+ bool Append(const CFX_ArrayTemplate& src) {
return CFX_BasicArray::Append(src);
}
- FX_BOOL Copy(const CFX_ArrayTemplate& src) {
- return CFX_BasicArray::Copy(src);
- }
+ bool Copy(const CFX_ArrayTemplate& src) { return CFX_BasicArray::Copy(src); }
TYPE* GetDataPtr(int index) {
return (TYPE*)CFX_BasicArray::GetDataPtr(index);
@@ -289,21 +287,21 @@ class CFX_ArrayTemplate : public CFX_BasicArray {
return ((TYPE*)m_pData)[nIndex];
}
- FX_BOOL InsertAt(int nIndex, TYPE newElement, int nCount = 1) {
+ bool InsertAt(int nIndex, TYPE newElement, int nCount = 1) {
if (!InsertSpaceAt(nIndex, nCount)) {
- return FALSE;
+ return false;
}
while (nCount--) {
((TYPE*)m_pData)[nIndex++] = newElement;
}
- return TRUE;
+ return true;
}
- FX_BOOL RemoveAt(int nIndex, int nCount = 1) {
+ bool RemoveAt(int nIndex, int nCount = 1) {
return CFX_BasicArray::RemoveAt(nIndex, nCount);
}
- FX_BOOL InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray) {
+ bool InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray) {
return CFX_BasicArray::InsertAt(nStartIndex, pNewArray);
}
@@ -463,7 +461,7 @@ class CFX_MapPtrToPtr {
int GetCount() const { return m_nCount; }
bool IsEmpty() const { return m_nCount == 0; }
- FX_BOOL Lookup(void* key, void*& rValue) const;
+ bool Lookup(void* key, void*& rValue) const;
void* GetValueAt(void* key) const;
@@ -471,7 +469,7 @@ class CFX_MapPtrToPtr {
void SetAt(void* key, void* newValue) { (*this)[key] = newValue; }
- FX_BOOL RemoveKey(void* key);
+ bool RemoveKey(void* key);
void RemoveAll();
@@ -485,7 +483,7 @@ class CFX_MapPtrToPtr {
uint32_t GetHashTableSize() const { return m_nHashTableSize; }
- void InitHashTable(uint32_t hashSize, FX_BOOL bAllocNow = TRUE);
+ void InitHashTable(uint32_t hashSize, bool bAllocNow = true);
protected:
CAssoc** m_pHashTable;
@@ -514,13 +512,13 @@ class CFX_MapPtrTemplate : public CFX_MapPtrToPtr {
public:
CFX_MapPtrTemplate() : CFX_MapPtrToPtr(10) {}
- FX_BOOL Lookup(KeyType key, ValueType& rValue) const {
+ bool Lookup(KeyType key, ValueType& rValue) const {
void* pValue = nullptr;
if (!CFX_MapPtrToPtr::Lookup((void*)(uintptr_t)key, pValue)) {
- return FALSE;
+ return false;
}
rValue = (ValueType)(uintptr_t)pValue;
- return TRUE;
+ return true;
}
ValueType& operator[](KeyType key) {
@@ -531,7 +529,7 @@ class CFX_MapPtrTemplate : public CFX_MapPtrToPtr {
CFX_MapPtrToPtr::SetAt((void*)(uintptr_t)key, (void*)(uintptr_t)newValue);
}
- FX_BOOL RemoveKey(KeyType key) {
+ bool RemoveKey(KeyType key) {
return CFX_MapPtrToPtr::RemoveKey((void*)(uintptr_t)key);
}
@@ -629,7 +627,7 @@ class CFX_BitStream {
void ByteAlign();
- FX_BOOL IsEOF() { return m_BitPos >= m_BitSize; }
+ bool IsEOF() { return m_BitPos >= m_BitSize; }
void SkipBits(uint32_t nBits) { m_BitPos += nBits; }
@@ -652,7 +650,7 @@ class CFX_BitStream {
class IFX_Pause {
public:
virtual ~IFX_Pause() {}
- virtual FX_BOOL NeedToPauseNow() = 0;
+ virtual bool NeedToPauseNow() = 0;
};
template <typename T>
diff --git a/core/fxcrt/fx_basic_array.cpp b/core/fxcrt/fx_basic_array.cpp
index 2d1a7bdf31..92df0e00f8 100644
--- a/core/fxcrt/fx_basic_array.cpp
+++ b/core/fxcrt/fx_basic_array.cpp
@@ -18,7 +18,7 @@ CFX_BasicArray::CFX_BasicArray(int unit_size)
CFX_BasicArray::~CFX_BasicArray() {
FX_Free(m_pData);
}
-FX_BOOL CFX_BasicArray::SetSize(int nNewSize) {
+bool CFX_BasicArray::SetSize(int nNewSize) {
if (nNewSize <= 0) {
FX_Free(m_pData);
m_pData = nullptr;
@@ -31,7 +31,7 @@ FX_BOOL CFX_BasicArray::SetSize(int nNewSize) {
totalSize *= m_nUnitSize;
if (!totalSize.IsValid()) {
m_nSize = m_nMaxSize = 0;
- return FALSE;
+ return false;
}
m_pData = FX_Alloc(uint8_t, totalSize.ValueOrDie());
m_nSize = m_nMaxSize = nNewSize;
@@ -46,11 +46,11 @@ FX_BOOL CFX_BasicArray::SetSize(int nNewSize) {
pdfium::base::CheckedNumeric<int> totalSize = nNewMax;
totalSize *= m_nUnitSize;
if (!totalSize.IsValid() || nNewMax < m_nSize) {
- return FALSE;
+ return false;
}
uint8_t* pNewData = FX_Realloc(uint8_t, m_pData, totalSize.ValueOrDie());
if (!pNewData) {
- return FALSE;
+ return false;
}
FXSYS_memset(pNewData + m_nSize * m_nUnitSize, 0,
(nNewMax - m_nSize) * m_nUnitSize);
@@ -58,27 +58,27 @@ FX_BOOL CFX_BasicArray::SetSize(int nNewSize) {
m_nSize = nNewSize;
m_nMaxSize = nNewMax;
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_BasicArray::Append(const CFX_BasicArray& src) {
+bool CFX_BasicArray::Append(const CFX_BasicArray& src) {
int nOldSize = m_nSize;
pdfium::base::CheckedNumeric<int> newSize = m_nSize;
newSize += src.m_nSize;
if (m_nUnitSize != src.m_nUnitSize || !newSize.IsValid() ||
!SetSize(newSize.ValueOrDie())) {
- return FALSE;
+ return false;
}
FXSYS_memcpy(m_pData + nOldSize * m_nUnitSize, src.m_pData,
src.m_nSize * m_nUnitSize);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_BasicArray::Copy(const CFX_BasicArray& src) {
+bool CFX_BasicArray::Copy(const CFX_BasicArray& src) {
if (!SetSize(src.m_nSize)) {
- return FALSE;
+ return false;
}
FXSYS_memcpy(m_pData, src.m_pData, src.m_nSize * m_nUnitSize);
- return TRUE;
+ return true;
}
uint8_t* CFX_BasicArray::InsertSpaceAt(int nIndex, int nCount) {
if (nIndex < 0 || nCount <= 0) {
@@ -100,9 +100,9 @@ uint8_t* CFX_BasicArray::InsertSpaceAt(int nIndex, int nCount) {
}
return m_pData + nIndex * m_nUnitSize;
}
-FX_BOOL CFX_BasicArray::RemoveAt(int nIndex, int nCount) {
+bool CFX_BasicArray::RemoveAt(int nIndex, int nCount) {
if (nIndex < 0 || nCount <= 0 || m_nSize < nIndex + nCount) {
- return FALSE;
+ return false;
}
int nMoveCount = m_nSize - (nIndex + nCount);
if (nMoveCount) {
@@ -111,22 +111,22 @@ FX_BOOL CFX_BasicArray::RemoveAt(int nIndex, int nCount) {
nMoveCount * m_nUnitSize);
}
m_nSize -= nCount;
- return TRUE;
+ return true;
}
-FX_BOOL CFX_BasicArray::InsertAt(int nStartIndex,
- const CFX_BasicArray* pNewArray) {
+bool CFX_BasicArray::InsertAt(int nStartIndex,
+ const CFX_BasicArray* pNewArray) {
if (!pNewArray) {
- return FALSE;
+ return false;
}
if (pNewArray->m_nSize == 0) {
- return TRUE;
+ return true;
}
if (!InsertSpaceAt(nStartIndex, pNewArray->m_nSize)) {
- return FALSE;
+ return false;
}
FXSYS_memcpy(m_pData + nStartIndex * m_nUnitSize, pNewArray->m_pData,
pNewArray->m_nSize * m_nUnitSize);
- return TRUE;
+ return true;
}
const void* CFX_BasicArray::GetDataPtr(int index) const {
if (index < 0 || index >= m_nSize || !m_pData) {
diff --git a/core/fxcrt/fx_basic_bstring.cpp b/core/fxcrt/fx_basic_bstring.cpp
index 23f13c1207..2669474f00 100644
--- a/core/fxcrt/fx_basic_bstring.cpp
+++ b/core/fxcrt/fx_basic_bstring.cpp
@@ -965,9 +965,9 @@ FX_STRSIZE FX_ftoa(FX_FLOAT d, FX_CHAR* buf) {
if (d == 0.0f) {
return 1;
}
- FX_BOOL bNegative = FALSE;
+ bool bNegative = false;
if (d < 0) {
- bNegative = TRUE;
+ bNegative = true;
d = -d;
}
int scale = 1;
diff --git a/core/fxcrt/fx_basic_coords.cpp b/core/fxcrt/fx_basic_coords.cpp
index 1184370fa7..d2bcc2b3ed 100644
--- a/core/fxcrt/fx_basic_coords.cpp
+++ b/core/fxcrt/fx_basic_coords.cpp
@@ -42,18 +42,18 @@ void FX_RECT::Union(const FX_RECT& other_rect) {
bottom = bottom > other.bottom ? bottom : other.bottom;
top = top < other.top ? top : other.top;
}
-FX_BOOL GetIntersection(FX_FLOAT low1,
- FX_FLOAT high1,
- FX_FLOAT low2,
- FX_FLOAT high2,
- FX_FLOAT& interlow,
- FX_FLOAT& interhigh) {
+bool GetIntersection(FX_FLOAT low1,
+ FX_FLOAT high1,
+ FX_FLOAT low2,
+ FX_FLOAT high2,
+ FX_FLOAT& interlow,
+ FX_FLOAT& interhigh) {
if (low1 >= high2 || low2 >= high1) {
- return FALSE;
+ return false;
}
interlow = low1 > low2 ? low1 : low2;
interhigh = high1 > high2 ? high2 : high1;
- return TRUE;
+ return true;
}
extern "C" int FXSYS_round(FX_FLOAT d) {
if (d < (FX_FLOAT)INT_MIN) {
@@ -290,35 +290,35 @@ void CFX_Matrix::Concat(FX_FLOAT a_in,
FX_FLOAT d_in,
FX_FLOAT e_in,
FX_FLOAT f_in,
- FX_BOOL bPrepended) {
+ bool bPrepended) {
CFX_Matrix m;
m.Set(a_in, b_in, c_in, d_in, e_in, f_in);
Concat(m, bPrepended);
}
-void CFX_Matrix::Concat(const CFX_Matrix& m, FX_BOOL bPrepended) {
+void CFX_Matrix::Concat(const CFX_Matrix& m, bool bPrepended) {
if (bPrepended) {
FXCRT_Matrix_Concat(*this, m, *this);
} else {
FXCRT_Matrix_Concat(*this, *this, m);
}
}
-void CFX_Matrix::ConcatInverse(const CFX_Matrix& src, FX_BOOL bPrepended) {
+void CFX_Matrix::ConcatInverse(const CFX_Matrix& src, bool bPrepended) {
CFX_Matrix m;
m.SetReverse(src);
Concat(m, bPrepended);
}
-FX_BOOL CFX_Matrix::IsInvertible() const {
+bool CFX_Matrix::IsInvertible() const {
return FXSYS_fabs(a * d - b * c) >= 0.0001f;
}
-FX_BOOL CFX_Matrix::Is90Rotated() const {
+bool CFX_Matrix::Is90Rotated() const {
return FXSYS_fabs(a * 1000) < FXSYS_fabs(b) &&
FXSYS_fabs(d * 1000) < FXSYS_fabs(c);
}
-FX_BOOL CFX_Matrix::IsScaled() const {
+bool CFX_Matrix::IsScaled() const {
return FXSYS_fabs(b * 1000) < FXSYS_fabs(a) &&
FXSYS_fabs(c * 1000) < FXSYS_fabs(d);
}
-void CFX_Matrix::Translate(FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepended) {
+void CFX_Matrix::Translate(FX_FLOAT x, FX_FLOAT y, bool bPrepended) {
if (bPrepended) {
e += x * a + y * c;
f += y * d + x * b;
@@ -326,7 +326,7 @@ void CFX_Matrix::Translate(FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepended) {
e += x, f += y;
}
}
-void CFX_Matrix::Scale(FX_FLOAT sx, FX_FLOAT sy, FX_BOOL bPrepended) {
+void CFX_Matrix::Scale(FX_FLOAT sx, FX_FLOAT sy, bool bPrepended) {
a *= sx, d *= sy;
if (bPrepended) {
b *= sx;
@@ -338,7 +338,7 @@ void CFX_Matrix::Scale(FX_FLOAT sx, FX_FLOAT sy, FX_BOOL bPrepended) {
f *= sy;
}
}
-void CFX_Matrix::Rotate(FX_FLOAT fRadian, FX_BOOL bPrepended) {
+void CFX_Matrix::Rotate(FX_FLOAT fRadian, bool bPrepended) {
FX_FLOAT cosValue = FXSYS_cos(fRadian);
FX_FLOAT sinValue = FXSYS_sin(fRadian);
CFX_Matrix m;
@@ -352,14 +352,14 @@ void CFX_Matrix::Rotate(FX_FLOAT fRadian, FX_BOOL bPrepended) {
void CFX_Matrix::RotateAt(FX_FLOAT fRadian,
FX_FLOAT dx,
FX_FLOAT dy,
- FX_BOOL bPrepended) {
+ bool bPrepended) {
Translate(dx, dy, bPrepended);
Rotate(fRadian, bPrepended);
Translate(-dx, -dy, bPrepended);
}
void CFX_Matrix::Shear(FX_FLOAT fAlphaRadian,
FX_FLOAT fBetaRadian,
- FX_BOOL bPrepended) {
+ bool bPrepended) {
CFX_Matrix m;
m.Set(1, FXSYS_tan(fAlphaRadian), FXSYS_tan(fBetaRadian), 1, 0, 0);
if (bPrepended) {
diff --git a/core/fxcrt/fx_basic_maps.cpp b/core/fxcrt/fx_basic_maps.cpp
index 48fb97082d..149951aa2e 100644
--- a/core/fxcrt/fx_basic_maps.cpp
+++ b/core/fxcrt/fx_basic_maps.cpp
@@ -58,14 +58,14 @@ void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition,
rKey = pAssocRet->key;
rValue = pAssocRet->value;
}
-FX_BOOL CFX_MapPtrToPtr::Lookup(void* key, void*& rValue) const {
+bool CFX_MapPtrToPtr::Lookup(void* key, void*& rValue) const {
uint32_t nHash;
CAssoc* pAssoc = GetAssocAt(key, nHash);
if (!pAssoc) {
- return FALSE;
+ return false;
}
rValue = pAssoc->value;
- return TRUE;
+ return true;
}
void* CFX_MapPtrToPtr::GetValueAt(void* key) const {
@@ -120,7 +120,7 @@ CFX_MapPtrToPtr::CAssoc* CFX_MapPtrToPtr::NewAssoc() {
pAssoc->value = 0;
return pAssoc;
}
-void CFX_MapPtrToPtr::InitHashTable(uint32_t nHashSize, FX_BOOL bAllocNow) {
+void CFX_MapPtrToPtr::InitHashTable(uint32_t nHashSize, bool bAllocNow) {
ASSERT(m_nCount == 0);
ASSERT(nHashSize > 0);
FX_Free(m_pHashTable);
@@ -130,9 +130,9 @@ void CFX_MapPtrToPtr::InitHashTable(uint32_t nHashSize, FX_BOOL bAllocNow) {
}
m_nHashTableSize = nHashSize;
}
-FX_BOOL CFX_MapPtrToPtr::RemoveKey(void* key) {
+bool CFX_MapPtrToPtr::RemoveKey(void* key) {
if (!m_pHashTable) {
- return FALSE;
+ return false;
}
CAssoc** ppAssocPrev;
ppAssocPrev = &m_pHashTable[HashKey(key) % m_nHashTableSize];
@@ -141,11 +141,11 @@ FX_BOOL CFX_MapPtrToPtr::RemoveKey(void* key) {
if (pAssoc->key == key) {
*ppAssocPrev = pAssoc->pNext;
FreeAssoc(pAssoc);
- return TRUE;
+ return true;
}
ppAssocPrev = &pAssoc->pNext;
}
- return FALSE;
+ return false;
}
void CFX_MapPtrToPtr::FreeAssoc(CFX_MapPtrToPtr::CAssoc* pAssoc) {
pAssoc->pNext = m_pFreeList;
diff --git a/core/fxcrt/fx_basic_util.cpp b/core/fxcrt/fx_basic_util.cpp
index df22d4bf24..e52ff2ecee 100644
--- a/core/fxcrt/fx_basic_util.cpp
+++ b/core/fxcrt/fx_basic_util.cpp
@@ -97,7 +97,7 @@ FX_FLOAT FX_atof(const CFX_ByteStringC& strc) {
if (strc[0] == '+') {
cc++;
} else if (strc[0] == '-') {
- bNegative = TRUE;
+ bNegative = true;
cc++;
}
while (cc < len) {
diff --git a/core/fxcrt/fx_basic_wstring.cpp b/core/fxcrt/fx_basic_wstring.cpp
index 099d0ecd43..e779621e60 100644
--- a/core/fxcrt/fx_basic_wstring.cpp
+++ b/core/fxcrt/fx_basic_wstring.cpp
@@ -952,11 +952,11 @@ FX_FLOAT FX_wtof(const FX_WCHAR* str, int len) {
return 0.0;
}
int cc = 0;
- FX_BOOL bNegative = FALSE;
+ bool bNegative = false;
if (str[0] == '+') {
cc++;
} else if (str[0] == '-') {
- bNegative = TRUE;
+ bNegative = true;
cc++;
}
int integer = 0;
diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h
index d10f7b0c57..19abde1921 100644
--- a/core/fxcrt/fx_coordinates.h
+++ b/core/fxcrt/fx_coordinates.h
@@ -300,8 +300,8 @@ class CFX_RTemplate {
void Deflate(const FXT_RECT& rt) {
Deflate(rt.left, rt.top, rt.top + rt.width, rt.top + rt.height);
}
- FX_BOOL IsEmpty() const { return width <= 0 || height <= 0; }
- FX_BOOL IsEmpty(FX_FLOAT fEpsilon) const {
+ bool IsEmpty() const { return width <= 0 || height <= 0; }
+ bool IsEmpty(FX_FLOAT fEpsilon) const {
return width <= fEpsilon || height <= fEpsilon;
}
void Empty() { width = height = 0; }
@@ -410,12 +410,12 @@ class CFX_RTemplate {
width = r - left;
height = b - top;
}
- FX_BOOL IntersectWith(const FXT_RECT& rt) const {
+ bool IntersectWith(const FXT_RECT& rt) const {
FXT_RECT rect = rt;
rect.Intersect(*this);
return !rect.IsEmpty();
}
- FX_BOOL IntersectWith(const FXT_RECT& rt, FX_FLOAT fEpsilon) const {
+ bool IntersectWith(const FXT_RECT& rt, FX_FLOAT fEpsilon) const {
FXT_RECT rect = rt;
rect.Intersect(*this);
return !rect.IsEmpty(fEpsilon);
@@ -588,33 +588,33 @@ class CFX_Matrix {
FX_FLOAT d,
FX_FLOAT e,
FX_FLOAT f,
- FX_BOOL bPrepended = FALSE);
- void Concat(const CFX_Matrix& m, FX_BOOL bPrepended = FALSE);
- void ConcatInverse(const CFX_Matrix& m, FX_BOOL bPrepended = FALSE);
+ bool bPrepended = false);
+ void Concat(const CFX_Matrix& m, bool bPrepended = false);
+ void ConcatInverse(const CFX_Matrix& m, bool bPrepended = false);
- FX_BOOL IsIdentity() const {
+ bool IsIdentity() const {
return a == 1 && b == 0 && c == 0 && d == 1 && e == 0 && f == 0;
}
- FX_BOOL IsInvertible() const;
- FX_BOOL Is90Rotated() const;
- FX_BOOL IsScaled() const;
+ bool IsInvertible() const;
+ bool Is90Rotated() const;
+ bool IsScaled() const;
- void Translate(FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepended = FALSE);
- void TranslateI(int32_t x, int32_t y, FX_BOOL bPrepended = FALSE) {
+ void Translate(FX_FLOAT x, FX_FLOAT y, bool bPrepended = false);
+ void TranslateI(int32_t x, int32_t y, bool bPrepended = false) {
Translate((FX_FLOAT)x, (FX_FLOAT)y, bPrepended);
}
- void Scale(FX_FLOAT sx, FX_FLOAT sy, FX_BOOL bPrepended = FALSE);
- void Rotate(FX_FLOAT fRadian, FX_BOOL bPrepended = FALSE);
+ void Scale(FX_FLOAT sx, FX_FLOAT sy, bool bPrepended = false);
+ void Rotate(FX_FLOAT fRadian, bool bPrepended = false);
void RotateAt(FX_FLOAT fRadian,
FX_FLOAT x,
FX_FLOAT y,
- FX_BOOL bPrepended = FALSE);
+ bool bPrepended = false);
void Shear(FX_FLOAT fAlphaRadian,
FX_FLOAT fBetaRadian,
- FX_BOOL bPrepended = FALSE);
+ bool bPrepended = false);
void MatchRect(const CFX_FloatRect& dest, const CFX_FloatRect& src);
FX_FLOAT GetXUnit() const;
diff --git a/core/fxcrt/fx_ext.h b/core/fxcrt/fx_ext.h
index cca80b1142..b7fd6f67f7 100644
--- a/core/fxcrt/fx_ext.h
+++ b/core/fxcrt/fx_ext.h
@@ -101,7 +101,7 @@ typedef FX_GUID const* FX_LPCGUID;
void FX_GUID_CreateV4(FX_LPGUID pGUID);
void FX_GUID_ToString(FX_LPCGUID pGUID,
CFX_ByteString& bsStr,
- FX_BOOL bSeparator = TRUE);
+ bool bSeparator = true);
#endif // PDF_ENABLE_XFA
template <class baseType>
diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp
index 186d98b858..0a378f32e5 100644
--- a/core/fxcrt/fx_extension.cpp
+++ b/core/fxcrt/fx_extension.cpp
@@ -41,10 +41,10 @@ IFX_SeekableStream* CFX_CRTFileAccess::CreateFileStream(uint32_t dwModes) {
return FX_CreateFileStream(m_path.c_str(), dwModes);
}
-FX_BOOL CFX_CRTFileAccess::Init(const CFX_WideStringC& wsPath) {
+bool CFX_CRTFileAccess::Init(const CFX_WideStringC& wsPath) {
m_path = wsPath;
m_RefCount = 1;
- return TRUE;
+ return true;
}
#endif // PDF_ENABLE_XFA
@@ -54,7 +54,7 @@ CFX_CRTFileStream::CFX_CRTFileStream(std::unique_ptr<IFXCRT_FileAccess> pFA)
CFX_CRTFileStream::~CFX_CRTFileStream() {}
-CFX_MemoryStream::CFX_MemoryStream(FX_BOOL bConsecutive)
+CFX_MemoryStream::CFX_MemoryStream(bool bConsecutive)
: m_dwCount(1),
m_nTotalSize(0),
m_nCurSize(0),
@@ -66,7 +66,7 @@ CFX_MemoryStream::CFX_MemoryStream(FX_BOOL bConsecutive)
CFX_MemoryStream::CFX_MemoryStream(uint8_t* pBuffer,
size_t nSize,
- FX_BOOL bTakeOver)
+ bool bTakeOver)
: m_dwCount(1),
m_nTotalSize(nSize),
m_nCurSize(nSize),
@@ -192,11 +192,11 @@ bool CFX_MemoryStream::WriteBlock(const void* buffer,
FX_SAFE_SIZE_T newPos = size;
newPos += offset;
if (!newPos.IsValid()) {
- return FALSE;
+ return false;
}
if (!ExpandBlocks(newPos.ValueOrDie())) {
- return FALSE;
+ return false;
}
m_nCurPos = newPos.ValueOrDie();
size_t nStartBlock = (size_t)offset / m_nGrowSize;
@@ -212,7 +212,7 @@ bool CFX_MemoryStream::WriteBlock(const void* buffer,
nStartBlock++;
offset = 0;
}
- return TRUE;
+ return true;
}
bool CFX_MemoryStream::Flush() {
@@ -263,12 +263,12 @@ void CFX_MemoryStream::DetachBuffer() {
m_dwFlags = FX_MEMSTREAM_TakeOver;
}
-FX_BOOL CFX_MemoryStream::ExpandBlocks(size_t size) {
+bool CFX_MemoryStream::ExpandBlocks(size_t size) {
if (m_nCurSize < size) {
m_nCurSize = size;
}
if (size <= m_nTotalSize) {
- return TRUE;
+ return true;
}
int32_t iCount = m_Blocks.GetSize();
size = (size - m_nTotalSize + m_nGrowSize - 1) / m_nGrowSize;
@@ -278,7 +278,7 @@ FX_BOOL CFX_MemoryStream::ExpandBlocks(size_t size) {
m_Blocks.SetAt(iCount++, pBlock);
m_nTotalSize += m_nGrowSize;
}
- return TRUE;
+ return true;
}
IFX_SeekableStream* CFX_CRTFileStream::Retain() {
@@ -394,10 +394,10 @@ FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr,
return 0.0f;
}
int32_t iUsedLen = 0;
- FX_BOOL bNegtive = FALSE;
+ bool bNegtive = false;
switch (pwsStr[iUsedLen]) {
case '-':
- bNegtive = TRUE;
+ bNegtive = true;
case '+':
iUsedLen++;
break;
@@ -496,7 +496,7 @@ void* FX_Random_MT_Start(uint32_t dwSeed) {
for (i = 1; i < MT_N; i++) {
pBuf[i] = (1812433253UL * (pBuf[i - 1] ^ (pBuf[i - 1] >> 30)) + i);
}
- pContext->bHaveSeed = TRUE;
+ pContext->bHaveSeed = true;
return pContext;
}
uint32_t FX_Random_MT_Generate(void* pContext) {
@@ -575,15 +575,15 @@ void FX_Random_GenerateBase(uint32_t* pBuffer, int32_t iCount) {
}
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-FX_BOOL FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount) {
+bool FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount) {
HCRYPTPROV hCP = 0;
if (!::CryptAcquireContext(&hCP, nullptr, nullptr, PROV_RSA_FULL, 0) ||
!hCP) {
- return FALSE;
+ return false;
}
::CryptGenRandom(hCP, iCount * sizeof(uint32_t), (uint8_t*)pBuffer);
::CryptReleaseContext(hCP, 0);
- return TRUE;
+ return true;
}
#endif
void FX_Random_GenerateCrypto(uint32_t* pBuffer, int32_t iCount) {
@@ -603,7 +603,7 @@ void FX_GUID_CreateV4(FX_LPGUID pGUID) {
const FX_CHAR* gs_FX_pHexChars = "0123456789ABCDEF";
void FX_GUID_ToString(FX_LPCGUID pGUID,
CFX_ByteString& bsStr,
- FX_BOOL bSeparator) {
+ bool bSeparator) {
FX_CHAR* pBuf = bsStr.GetBuffer(40);
uint8_t b;
for (int32_t i = 0; i < 16; i++) {
diff --git a/core/fxcrt/fx_stream.h b/core/fxcrt/fx_stream.h
index 8b1d91f4bc..dc687cf653 100644
--- a/core/fxcrt/fx_stream.h
+++ b/core/fxcrt/fx_stream.h
@@ -143,14 +143,14 @@ class IFX_MemoryStream : public IFX_SeekableStream {
virtual uint8_t* GetBuffer() const = 0;
virtual void AttachBuffer(uint8_t* pBuffer,
size_t nSize,
- bool bTakeOver = FALSE) = 0;
+ bool bTakeOver = false) = 0;
virtual void DetachBuffer() = 0;
};
IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer,
size_t nSize,
- bool bTakeOver = FALSE);
-IFX_MemoryStream* FX_CreateMemoryStream(bool bConsecutive = FALSE);
+ bool bTakeOver = false);
+IFX_MemoryStream* FX_CreateMemoryStream(bool bConsecutive = false);
class IFX_BufferRead : public IFX_ReadStream {
public:
@@ -160,7 +160,7 @@ class IFX_BufferRead : public IFX_ReadStream {
FX_FILESIZE GetPosition() override = 0;
size_t ReadBlock(void* buffer, size_t size) override = 0;
- virtual bool ReadNextBlock(bool bRestart = FALSE) = 0;
+ virtual bool ReadNextBlock(bool bRestart = false) = 0;
virtual const uint8_t* GetBlockBuffer() = 0;
virtual size_t GetBlockSize() = 0;
virtual FX_FILESIZE GetBlockOffset() = 0;
diff --git a/core/fxcrt/fx_ucd.h b/core/fxcrt/fx_ucd.h
index 23bacca0f6..d79693b9fd 100644
--- a/core/fxcrt/fx_ucd.h
+++ b/core/fxcrt/fx_ucd.h
@@ -45,7 +45,7 @@ extern const uint16_t kFXTextLayoutBidiMirror[];
extern const size_t kFXTextLayoutBidiMirrorSize;
uint32_t FX_GetUnicodeProperties(FX_WCHAR wch);
-FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical);
+FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, bool bRTL, bool bVertical);
#ifdef PDF_ENABLE_XFA
enum FX_CHARBREAKPROP {
@@ -111,11 +111,11 @@ inline FX_CHARTYPE GetCharTypeFromProp(uint32_t prop) {
return static_cast<FX_CHARTYPE>(prop & FX_CHARTYPEBITSMASK);
}
-FX_BOOL FX_IsCtrlCode(FX_WCHAR ch);
+bool FX_IsCtrlCode(FX_WCHAR ch);
FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch,
uint32_t dwProps,
- FX_BOOL bRTL,
- FX_BOOL bVertical);
+ bool bRTL,
+ bool bVertical);
class CFX_Char {
public:
CFX_Char()
diff --git a/core/fxcrt/fx_unicode.cpp b/core/fxcrt/fx_unicode.cpp
index cfc24b5a0e..e6f423e2af 100644
--- a/core/fxcrt/fx_unicode.cpp
+++ b/core/fxcrt/fx_unicode.cpp
@@ -14,13 +14,13 @@ uint32_t FX_GetUnicodeProperties(FX_WCHAR wch) {
}
#ifdef PDF_ENABLE_XFA
-FX_BOOL FX_IsCtrlCode(FX_WCHAR ch) {
+bool FX_IsCtrlCode(FX_WCHAR ch) {
uint32_t dwRet = (FX_GetUnicodeProperties(ch) & FX_CHARTYPEBITSMASK);
return dwRet == FX_CHARTYPE_Tab || dwRet == FX_CHARTYPE_Control;
}
#endif // PDF_ENABLE_XFA
-FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) {
+FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, bool bRTL, bool bVertical) {
uint32_t dwProps = FX_GetUnicodeProperties(wch);
uint32_t dwTemp = (dwProps & 0xFF800000);
if (bRTL && dwTemp < 0xFF800000) {
@@ -44,8 +44,8 @@ FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) {
#ifdef PDF_ENABLE_XFA
FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch,
uint32_t dwProps,
- FX_BOOL bRTL,
- FX_BOOL bVertical) {
+ bool bRTL,
+ bool bVertical) {
uint32_t dwTemp = (dwProps & 0xFF800000);
if (bRTL && dwTemp < 0xFF800000) {
size_t idx = dwTemp >> 23;
diff --git a/core/fxcrt/fx_xml.h b/core/fxcrt/fx_xml.h
index 4ab28f66c5..6c6e6178af 100644
--- a/core/fxcrt/fx_xml.h
+++ b/core/fxcrt/fx_xml.h
@@ -40,13 +40,13 @@ class CXML_AttrMap {
class CXML_Content {
public:
- CXML_Content() : m_bCDATA(FALSE), m_Content() {}
- void Set(FX_BOOL bCDATA, const CFX_WideStringC& content) {
+ CXML_Content() : m_bCDATA(false), m_Content() {}
+ void Set(bool bCDATA, const CFX_WideStringC& content) {
m_bCDATA = bCDATA;
m_Content = content;
}
- FX_BOOL m_bCDATA;
+ bool m_bCDATA;
CFX_WideString m_Content;
};
@@ -56,13 +56,13 @@ class CXML_Element {
static CXML_Element* Parse(const void* pBuffer,
size_t size,
- FX_BOOL bSaveSpaceChars = FALSE,
+ bool bSaveSpaceChars = false,
FX_FILESIZE* pParsedSize = nullptr);
static CXML_Element* Parse(IFX_SeekableReadStream* pFile,
- FX_BOOL bSaveSpaceChars = FALSE,
+ bool bSaveSpaceChars = false,
FX_FILESIZE* pParsedSize = nullptr);
static CXML_Element* Parse(IFX_BufferRead* pBuffer,
- FX_BOOL bSaveSpaceChars = FALSE,
+ bool bSaveSpaceChars = false,
FX_FILESIZE* pParsedSize = nullptr);
CXML_Element(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagName);
@@ -71,8 +71,8 @@ class CXML_Element {
~CXML_Element();
void Empty();
- CFX_ByteString GetTagName(FX_BOOL bQualified = FALSE) const;
- CFX_ByteString GetNamespace(FX_BOOL bQualified = FALSE) const;
+ CFX_ByteString GetTagName(bool bQualified = false) const;
+ CFX_ByteString GetNamespace(bool bQualified = false) const;
CFX_ByteString GetNamespaceURI(const CFX_ByteString& qName) const;
CXML_Element* GetParent() const { return m_pParent; }
uint32_t CountAttrs() const { return m_AttrMap.GetSize(); }
@@ -80,18 +80,18 @@ class CXML_Element {
CFX_ByteString& space,
CFX_ByteString& name,
CFX_WideString& value) const;
- FX_BOOL HasAttr(const CFX_ByteStringC& qName) const;
- FX_BOOL GetAttrValue(const CFX_ByteStringC& name,
- CFX_WideString& attribute) const;
+ bool HasAttr(const CFX_ByteStringC& qName) const;
+ bool GetAttrValue(const CFX_ByteStringC& name,
+ CFX_WideString& attribute) const;
CFX_WideString GetAttrValue(const CFX_ByteStringC& name) const {
CFX_WideString attr;
GetAttrValue(name, attr);
return attr;
}
- FX_BOOL GetAttrValue(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
- CFX_WideString& attribute) const;
+ bool GetAttrValue(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& name,
+ CFX_WideString& attribute) const;
CFX_WideString GetAttrValue(const CFX_ByteStringC& space,
const CFX_ByteStringC& name) const {
CFX_WideString attr;
@@ -99,16 +99,16 @@ class CXML_Element {
return attr;
}
- FX_BOOL GetAttrInteger(const CFX_ByteStringC& name, int& attribute) const;
+ bool GetAttrInteger(const CFX_ByteStringC& name, int& attribute) const;
int GetAttrInteger(const CFX_ByteStringC& name) const {
int attr = 0;
GetAttrInteger(name, attr);
return attr;
}
- FX_BOOL GetAttrInteger(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
- int& attribute) const;
+ bool GetAttrInteger(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& name,
+ int& attribute) const;
int GetAttrInteger(const CFX_ByteStringC& space,
const CFX_ByteStringC& name) const {
int attr = 0;
@@ -116,16 +116,16 @@ class CXML_Element {
return attr;
}
- FX_BOOL GetAttrFloat(const CFX_ByteStringC& name, FX_FLOAT& attribute) const;
+ bool GetAttrFloat(const CFX_ByteStringC& name, FX_FLOAT& attribute) const;
FX_FLOAT GetAttrFloat(const CFX_ByteStringC& name) const {
FX_FLOAT attr = 0;
GetAttrFloat(name, attr);
return attr;
}
- FX_BOOL GetAttrFloat(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
- FX_FLOAT& attribute) const;
+ bool GetAttrFloat(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& name,
+ FX_FLOAT& attribute) const;
FX_FLOAT GetAttrFloat(const CFX_ByteStringC& space,
const CFX_ByteStringC& name) const {
FX_FLOAT attr = 0;
diff --git a/core/fxcrt/fx_xml_parser.cpp b/core/fxcrt/fx_xml_parser.cpp
index f6b81dad93..e1a209a701 100644
--- a/core/fxcrt/fx_xml_parser.cpp
+++ b/core/fxcrt/fx_xml_parser.cpp
@@ -170,9 +170,9 @@ FX_FILESIZE CXML_DataStmAcc::GetBlockOffset() {
CXML_Parser::CXML_Parser()
: m_pDataAcc(nullptr),
- m_bOwnedStream(FALSE),
+ m_bOwnedStream(false),
m_nOffset(0),
- m_bSaveSpaceChars(FALSE),
+ m_bSaveSpaceChars(false),
m_pBuffer(nullptr),
m_dwBufferSize(0),
m_nBufferOffset(0),
@@ -426,13 +426,13 @@ void CXML_Parser::GetAttrValue(CFX_WideString& value) {
}
void CXML_Parser::GetTagName(CFX_ByteString& space,
CFX_ByteString& name,
- FX_BOOL& bEndTag,
- FX_BOOL bStartTag) {
+ bool& bEndTag,
+ bool bStartTag) {
m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex;
if (IsEOF()) {
return;
}
- bEndTag = FALSE;
+ bEndTag = false;
uint8_t ch;
int32_t iState = bStartTag ? 1 : 0;
do {
@@ -461,10 +461,10 @@ void CXML_Parser::GetTagName(CFX_ByteString& space,
if (ch == '/') {
m_dwIndex++;
GetName(space, name);
- bEndTag = TRUE;
+ bEndTag = true;
} else {
GetName(space, name);
- bEndTag = FALSE;
+ bEndTag = false;
}
return;
}
@@ -475,14 +475,13 @@ void CXML_Parser::GetTagName(CFX_ByteString& space,
}
} while (ReadNextBlock());
}
-CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent,
- FX_BOOL bStartTag) {
+CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, bool bStartTag) {
m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex;
if (IsEOF()) {
return nullptr;
}
CFX_ByteString tag_name, tag_space;
- FX_BOOL bEndTag;
+ bool bEndTag;
GetTagName(tag_space, tag_name, bEndTag, bStartTag);
if (tag_name.IsEmpty() || bEndTag) {
return nullptr;
@@ -543,7 +542,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent,
}
CFX_UTF8Decoder decoder;
CFX_WideTextBuf content;
- FX_BOOL bCDATA = FALSE;
+ bool bCDATA = false;
int32_t iState = 0;
do {
while (m_dwIndex < m_dwBufferSize) {
@@ -581,10 +580,10 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent,
InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement);
content.Clear();
decoder.Clear();
- bCDATA = FALSE;
+ bCDATA = false;
iState = 0;
m_dwIndex--;
- CXML_Element* pSubElement = ParseElement(pElement, TRUE);
+ CXML_Element* pSubElement = ParseElement(pElement, true);
if (!pSubElement) {
break;
}
@@ -625,10 +624,10 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent,
InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement);
content.Clear();
decoder.Clear();
- bCDATA = FALSE;
+ bCDATA = false;
return pElement;
}
-void CXML_Parser::InsertContentSegment(FX_BOOL bCDATA,
+void CXML_Parser::InsertContentSegment(bool bCDATA,
const CFX_WideStringC& content,
CXML_Element* pElement) {
if (content.IsEmpty()) {
@@ -639,10 +638,10 @@ void CXML_Parser::InsertContentSegment(FX_BOOL bCDATA,
pElement->m_Children.push_back({CXML_Element::Content, pContent});
}
static CXML_Element* XML_ContinueParse(CXML_Parser& parser,
- FX_BOOL bSaveSpaceChars,
+ bool bSaveSpaceChars,
FX_FILESIZE* pParsedSize) {
parser.m_bSaveSpaceChars = bSaveSpaceChars;
- CXML_Element* pElement = parser.ParseElement(nullptr, FALSE);
+ CXML_Element* pElement = parser.ParseElement(nullptr, false);
if (pParsedSize) {
*pParsedSize = parser.m_nOffset;
}
@@ -650,7 +649,7 @@ static CXML_Element* XML_ContinueParse(CXML_Parser& parser,
}
CXML_Element* CXML_Element::Parse(const void* pBuffer,
size_t size,
- FX_BOOL bSaveSpaceChars,
+ bool bSaveSpaceChars,
FX_FILESIZE* pParsedSize) {
CXML_Parser parser;
if (!parser.Init((uint8_t*)pBuffer, size)) {
@@ -659,7 +658,7 @@ CXML_Element* CXML_Element::Parse(const void* pBuffer,
return XML_ContinueParse(parser, bSaveSpaceChars, pParsedSize);
}
CXML_Element* CXML_Element::Parse(IFX_SeekableReadStream* pFile,
- FX_BOOL bSaveSpaceChars,
+ bool bSaveSpaceChars,
FX_FILESIZE* pParsedSize) {
CXML_Parser parser;
if (!parser.Init(pFile)) {
@@ -668,7 +667,7 @@ CXML_Element* CXML_Element::Parse(IFX_SeekableReadStream* pFile,
return XML_ContinueParse(parser, bSaveSpaceChars, pParsedSize);
}
CXML_Element* CXML_Element::Parse(IFX_BufferRead* pBuffer,
- FX_BOOL bSaveSpaceChars,
+ bool bSaveSpaceChars,
FX_FILESIZE* pParsedSize) {
CXML_Parser parser;
if (!parser.Init(pBuffer)) {
@@ -705,7 +704,7 @@ void CXML_Element::RemoveChildren() {
}
m_Children.clear();
}
-CFX_ByteString CXML_Element::GetTagName(FX_BOOL bQualified) const {
+CFX_ByteString CXML_Element::GetTagName(bool bQualified) const {
if (!bQualified || m_QSpaceName.IsEmpty()) {
return m_TagName;
}
@@ -715,7 +714,7 @@ CFX_ByteString CXML_Element::GetTagName(FX_BOOL bQualified) const {
return bsTag;
}
-CFX_ByteString CXML_Element::GetNamespace(FX_BOOL bQualified) const {
+CFX_ByteString CXML_Element::GetNamespace(bool bQualified) const {
return bQualified ? m_QSpaceName : GetNamespaceURI(m_QSpaceName);
}
@@ -748,32 +747,32 @@ void CXML_Element::GetAttrByIndex(int index,
name = item.m_AttrName;
value = item.m_Value;
}
-FX_BOOL CXML_Element::HasAttr(const CFX_ByteStringC& name) const {
+bool CXML_Element::HasAttr(const CFX_ByteStringC& name) const {
CFX_ByteStringC bsSpace;
CFX_ByteStringC bsName;
FX_XML_SplitQualifiedName(name, bsSpace, bsName);
return !!m_AttrMap.Lookup(CFX_ByteString(bsSpace), CFX_ByteString(bsName));
}
-FX_BOOL CXML_Element::GetAttrValue(const CFX_ByteStringC& name,
- CFX_WideString& attribute) const {
+bool CXML_Element::GetAttrValue(const CFX_ByteStringC& name,
+ CFX_WideString& attribute) const {
CFX_ByteStringC bsSpace;
CFX_ByteStringC bsName;
FX_XML_SplitQualifiedName(name, bsSpace, bsName);
return GetAttrValue(bsSpace, bsName, attribute);
}
-FX_BOOL CXML_Element::GetAttrValue(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
- CFX_WideString& attribute) const {
+bool CXML_Element::GetAttrValue(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& name,
+ CFX_WideString& attribute) const {
const CFX_WideString* pValue =
m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name));
if (pValue) {
attribute = *pValue;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CXML_Element::GetAttrInteger(const CFX_ByteStringC& name,
- int& attribute) const {
+bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& name,
+ int& attribute) const {
CFX_ByteStringC bsSpace;
CFX_ByteStringC bsName;
FX_XML_SplitQualifiedName(name, bsSpace, bsName);
@@ -781,37 +780,37 @@ FX_BOOL CXML_Element::GetAttrInteger(const CFX_ByteStringC& name,
m_AttrMap.Lookup(CFX_ByteString(bsSpace), CFX_ByteString(bsName));
if (pwsValue) {
attribute = pwsValue->GetInteger();
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CXML_Element::GetAttrInteger(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
- int& attribute) const {
+bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& name,
+ int& attribute) const {
const CFX_WideString* pwsValue =
m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name));
if (pwsValue) {
attribute = pwsValue->GetInteger();
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CXML_Element::GetAttrFloat(const CFX_ByteStringC& name,
- FX_FLOAT& attribute) const {
+bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& name,
+ FX_FLOAT& attribute) const {
CFX_ByteStringC bsSpace, bsName;
FX_XML_SplitQualifiedName(name, bsSpace, bsName);
return GetAttrFloat(bsSpace, bsName, attribute);
}
-FX_BOOL CXML_Element::GetAttrFloat(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
- FX_FLOAT& attribute) const {
+bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& name,
+ FX_FLOAT& attribute) const {
const CFX_WideString* pValue =
m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name));
if (pValue) {
attribute = pValue->GetFloat();
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
CXML_Element::ChildType CXML_Element::GetChildType(uint32_t index) const {
return index < m_Children.size() ? m_Children[index].type : Invalid;
diff --git a/core/fxcrt/fxcrt_stream.cpp b/core/fxcrt/fxcrt_stream.cpp
index 48b8a79379..3afe6323b2 100644
--- a/core/fxcrt/fxcrt_stream.cpp
+++ b/core/fxcrt/fxcrt_stream.cpp
@@ -11,7 +11,7 @@ bool IFX_SeekableWriteStream::WriteBlock(const void* pData, size_t size) {
}
bool IFX_SeekableReadStream::IsEOF() {
- return FALSE;
+ return false;
}
FX_FILESIZE IFX_SeekableReadStream::GetPosition() {
diff --git a/core/fxcrt/fxcrt_windows.cpp b/core/fxcrt/fxcrt_windows.cpp
index 87bbe96a5c..638338706e 100644
--- a/core/fxcrt/fxcrt_windows.cpp
+++ b/core/fxcrt/fxcrt_windows.cpp
@@ -50,7 +50,7 @@ CFXCRT_FileAccess_Win64::~CFXCRT_FileAccess_Win64() {
bool CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName,
uint32_t dwMode) {
if (m_hFile)
- return FALSE;
+ return false;
uint32_t dwAccess, dwShare, dwCreation;
FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation);
@@ -65,7 +65,7 @@ bool CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName,
bool CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName,
uint32_t dwMode) {
if (m_hFile)
- return FALSE;
+ return false;
uint32_t dwAccess, dwShare, dwCreation;
FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation);
diff --git a/core/fxcrt/xml_int.h b/core/fxcrt/xml_int.h
index bc9ea3dd48..d65fdad58c 100644
--- a/core/fxcrt/xml_int.h
+++ b/core/fxcrt/xml_int.h
@@ -24,7 +24,7 @@ class CXML_DataBufAcc : public IFX_BufferRead {
bool IsEOF() override;
FX_FILESIZE GetPosition() override;
size_t ReadBlock(void* buffer, size_t size) override;
- bool ReadNextBlock(bool bRestart = FALSE) override;
+ bool ReadNextBlock(bool bRestart = false) override;
const uint8_t* GetBlockBuffer() override;
size_t GetBlockSize() override;
FX_FILESIZE GetBlockOffset() override;
@@ -45,7 +45,7 @@ class CXML_DataStmAcc : public IFX_BufferRead {
bool IsEOF() override;
FX_FILESIZE GetPosition() override;
size_t ReadBlock(void* buffer, size_t size) override;
- bool ReadNextBlock(bool bRestart = FALSE) override;
+ bool ReadNextBlock(bool bRestart = false) override;
const uint8_t* GetBlockBuffer() override;
size_t GetBlockSize() override;
FX_FILESIZE GetBlockOffset() override;
@@ -75,11 +75,11 @@ class CXML_Parser {
uint32_t GetCharRef();
void GetTagName(CFX_ByteString& space,
CFX_ByteString& name,
- FX_BOOL& bEndTag,
- FX_BOOL bStartTag = FALSE);
+ bool& bEndTag,
+ bool bStartTag = false);
void SkipLiterals(const CFX_ByteStringC& str);
- CXML_Element* ParseElement(CXML_Element* pParent, FX_BOOL bStartTag = FALSE);
- void InsertContentSegment(FX_BOOL bCDATA,
+ CXML_Element* ParseElement(CXML_Element* pParent, bool bStartTag = false);
+ void InsertContentSegment(bool bCDATA,
const CFX_WideStringC& content,
CXML_Element* pElement);
void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXML_Element* pElement);
@@ -87,7 +87,7 @@ class CXML_Parser {
IFX_BufferRead* m_pDataAcc;
bool m_bOwnedStream;
FX_FILESIZE m_nOffset;
- FX_BOOL m_bSaveSpaceChars;
+ bool m_bSaveSpaceChars;
const uint8_t* m_pBuffer;
size_t m_dwBufferSize;
FX_FILESIZE m_nBufferOffset;
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index ed6410b4c3..3634d96d91 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -70,7 +70,7 @@ void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap,
int src_g = FXARGB_G(argb);
int src_b = FXARGB_B(argb);
int Bpp = pBitmap->GetBPP() / 8;
- FX_BOOL bAlpha = pBitmap->HasAlpha();
+ bool bAlpha = pBitmap->HasAlpha();
int dib_argb = FXARGB_TOBGRORDERDIB(argb);
uint8_t* pBuffer = pBitmap->GetBuffer();
if (src_alpha == 255) {
@@ -189,7 +189,7 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap,
}
}
} else {
- ASSERT(FALSE);
+ ASSERT(false);
}
return;
}
@@ -224,7 +224,7 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap,
return;
}
- ASSERT(FALSE);
+ ASSERT(false);
}
FX_ARGB DefaultCMYK2ARGB(FX_CMYK cmyk, uint8_t alpha) {
@@ -234,13 +234,13 @@ FX_ARGB DefaultCMYK2ARGB(FX_CMYK cmyk, uint8_t alpha) {
return ArgbEncode(alpha, r, g, b);
}
-FX_BOOL DibSetPixel(CFX_DIBitmap* pDevice,
- int x,
- int y,
- uint32_t color,
- int alpha_flag,
- void* pIccTransform) {
- FX_BOOL bObjCMYK = !!FXGETFLAG_COLORTYPE(alpha_flag);
+bool DibSetPixel(CFX_DIBitmap* pDevice,
+ int x,
+ int y,
+ uint32_t color,
+ int alpha_flag,
+ void* pIccTransform) {
+ bool bObjCMYK = !!FXGETFLAG_COLORTYPE(alpha_flag);
int alpha = bObjCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color);
if (pIccTransform) {
CCodec_IccModule* pIccModule =
@@ -255,7 +255,7 @@ FX_BOOL DibSetPixel(CFX_DIBitmap* pDevice,
} else {
if (pDevice->IsCmykImage()) {
if (!bObjCMYK)
- return FALSE;
+ return false;
} else {
if (bObjCMYK)
color = DefaultCMYK2ARGB(color, alpha);
@@ -265,7 +265,7 @@ FX_BOOL DibSetPixel(CFX_DIBitmap* pDevice,
if (pDevice->m_pAlphaMask) {
pDevice->m_pAlphaMask->SetPixel(x, y, alpha << 24);
}
- return TRUE;
+ return true;
}
} // namespace
@@ -355,8 +355,8 @@ static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer,
const CFX_Matrix* pObject2Device,
const CFX_GraphStateData* pGraphState,
FX_FLOAT scale = 1.0f,
- FX_BOOL bStrokeAdjust = FALSE,
- FX_BOOL bTextMode = FALSE) {
+ bool bStrokeAdjust = false,
+ bool bTextMode = false) {
agg::line_cap_e cap;
switch (pGraphState->m_LineCap) {
case CFX_GraphStateData::LineCapRound:
@@ -425,9 +425,9 @@ static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer,
}
CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap,
- FX_BOOL bRgbByteOrder,
+ bool bRgbByteOrder,
CFX_DIBitmap* pOriDevice,
- FX_BOOL bGroupKnockout)
+ bool bGroupKnockout)
: m_pBitmap(pBitmap),
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
m_pPlatformGraphics(nullptr),
@@ -452,13 +452,13 @@ void CFX_AggDeviceDriver::InitPlatform() {}
void CFX_AggDeviceDriver::DestroyPlatform() {}
-FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t color) {
- return FALSE;
+bool CFX_AggDeviceDriver::DrawDeviceText(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t color) {
+ return false;
}
#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_
@@ -540,9 +540,9 @@ void CFX_AggDeviceDriver::SetClipMask(agg::rasterizer_scanline_aa& rasterizer) {
m_pClipRgn->IntersectMaskF(path_rect.left, path_rect.top, mask);
}
-FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- int fill_mode) {
+bool CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ int fill_mode) {
m_FillFlags = fill_mode;
if (!m_pClipRgn) {
m_pClipRgn = pdfium::MakeUnique<CFX_ClipRgn>(
@@ -556,7 +556,7 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData,
(FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
FX_RECT rect = rectf.GetOuterRect();
m_pClipRgn->IntersectRect(rect);
- return TRUE;
+ return true;
}
}
CAgg_PathData path_data;
@@ -570,10 +570,10 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData,
? agg::fill_non_zero
: agg::fill_even_odd);
SetClipMask(rasterizer);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_AggDeviceDriver::SetClip_PathStroke(
+bool CFX_AggDeviceDriver::SetClip_PathStroke(
const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device,
const CFX_GraphStateData* pGraphState) {
@@ -590,15 +590,15 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathStroke(
pGraphState);
rasterizer.filling_rule(agg::fill_non_zero);
SetClipMask(rasterizer);
- return TRUE;
+ return true;
}
class CFX_Renderer {
private:
int m_Alpha, m_Red, m_Green, m_Blue, m_Gray;
uint32_t m_Color;
- FX_BOOL m_bFullCover;
- FX_BOOL m_bRgbByteOrder;
+ bool m_bFullCover;
+ bool m_bRgbByteOrder;
CFX_DIBitmap* m_pOriDevice;
FX_RECT m_ClipBox;
const CFX_DIBitmap* m_pClipMask;
@@ -620,7 +620,7 @@ class CFX_Renderer {
void CompositeSpan(uint8_t* dest_scan,
uint8_t* ori_scan,
int Bpp,
- FX_BOOL bDestAlpha,
+ bool bDestAlpha,
int span_left,
int span_len,
uint8_t* cover_scan,
@@ -1251,7 +1251,7 @@ class CFX_Renderer {
ori_scan = m_pOriDevice->GetBuffer() + m_pOriDevice->GetPitch() * y;
}
int Bpp = m_pDevice->GetBPP() / 8;
- FX_BOOL bDestAlpha = m_pDevice->HasAlpha() || m_pDevice->IsAlphaMask();
+ bool bDestAlpha = m_pDevice->HasAlpha() || m_pDevice->IsAlphaMask();
unsigned num_spans = sl.num_spans();
typename Scanline::const_iterator span = sl.begin();
while (1) {
@@ -1290,14 +1290,14 @@ class CFX_Renderer {
}
}
- FX_BOOL Init(CFX_DIBitmap* pDevice,
- CFX_DIBitmap* pOriDevice,
- const CFX_ClipRgn* pClipRgn,
- uint32_t color,
- FX_BOOL bFullCover,
- FX_BOOL bRgbByteOrder,
- int alpha_flag = 0,
- void* pIccTransform = nullptr) {
+ bool Init(CFX_DIBitmap* pDevice,
+ CFX_DIBitmap* pOriDevice,
+ const CFX_ClipRgn* pClipRgn,
+ uint32_t color,
+ bool bFullCover,
+ bool bRgbByteOrder,
+ int alpha_flag = 0,
+ void* pIccTransform = nullptr) {
m_pDevice = pDevice;
m_pClipRgn = pClipRgn;
composite_span = nullptr;
@@ -1315,8 +1315,8 @@ class CFX_Renderer {
m_pClipMask = m_pClipRgn->GetMask().GetObject();
}
m_bFullCover = bFullCover;
- FX_BOOL bObjectCMYK = !!FXGETFLAG_COLORTYPE(alpha_flag);
- FX_BOOL bDeviceCMYK = pDevice->IsCmykImage();
+ bool bObjectCMYK = !!FXGETFLAG_COLORTYPE(alpha_flag);
+ bool bDeviceCMYK = pDevice->IsCmykImage();
m_Alpha = bObjectCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color);
CCodec_IccModule* pIccModule = nullptr;
if (!CFX_GEModule::Get()->GetCodecModule() ||
@@ -1350,7 +1350,7 @@ class CFX_Renderer {
}
}
}
- return TRUE;
+ return true;
}
if (bDeviceCMYK) {
ASSERT(!m_bRgbByteOrder);
@@ -1363,7 +1363,7 @@ class CFX_Renderer {
}
} else {
if (!pIccTransform) {
- return FALSE;
+ return false;
}
color = FXARGB_TODIB(color);
pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color,
@@ -1417,7 +1417,7 @@ class CFX_Renderer {
if (m_pDevice->GetBPP() == 1) {
composite_span = &CFX_Renderer::CompositeSpan1bpp;
}
- return TRUE;
+ return true;
}
};
@@ -1425,37 +1425,37 @@ int CFX_AggDeviceDriver::GetDriverType() const {
return 1;
}
-FX_BOOL CFX_AggDeviceDriver::RenderRasterizer(
+bool CFX_AggDeviceDriver::RenderRasterizer(
agg::rasterizer_scanline_aa& rasterizer,
uint32_t color,
- FX_BOOL bFullCover,
- FX_BOOL bGroupKnockout,
+ bool bFullCover,
+ bool bGroupKnockout,
int alpha_flag,
void* pIccTransform) {
CFX_DIBitmap* pt = bGroupKnockout ? m_pOriDevice : nullptr;
CFX_Renderer render;
if (!render.Init(m_pBitmap, pt, m_pClipRgn.get(), color, bFullCover,
m_bRgbByteOrder, alpha_flag, pIccTransform)) {
- return FALSE;
+ return false;
}
agg::scanline_u8 scanline;
agg::render_scanlines(rasterizer, scanline, render,
(m_FillFlags & FXFILL_NOPATHSMOOTH) != 0);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- int fill_mode,
- int blend_type) {
+bool CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ int fill_mode,
+ int blend_type) {
if (blend_type != FXDIB_BLEND_NORMAL)
- return FALSE;
+ return false;
if (!GetBuffer())
- return TRUE;
+ return true;
m_FillFlags = fill_mode;
if ((fill_mode & 3) && fill_color) {
@@ -1469,14 +1469,14 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData,
? agg::fill_non_zero
: agg::fill_even_odd);
if (!RenderRasterizer(rasterizer, fill_color,
- !!(fill_mode & FXFILL_FULLCOVER), FALSE, 0,
+ !!(fill_mode & FXFILL_FULLCOVER), false, 0,
nullptr)) {
- return FALSE;
+ return false;
}
}
int stroke_alpha = FXARGB_A(stroke_color);
if (!pGraphState || !stroke_alpha)
- return TRUE;
+ return true;
if (fill_mode & FX_ZEROAREA_FILL) {
CAgg_PathData path_data;
@@ -1485,7 +1485,7 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData,
rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
(FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
RasterizeStroke(rasterizer, path_data.m_PathData, nullptr, pGraphState, 1,
- FALSE, !!(fill_mode & FX_STROKE_TEXT_MODE));
+ false, !!(fill_mode & FX_STROKE_TEXT_MODE));
return RenderRasterizer(rasterizer, stroke_color,
!!(fill_mode & FXFILL_FULLCOVER), m_bGroupKnockout,
0, nullptr);
@@ -1510,52 +1510,52 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData,
rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
(FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
RasterizeStroke(rasterizer, path_data.m_PathData, &matrix2, pGraphState,
- matrix1.a, FALSE, !!(fill_mode & FX_STROKE_TEXT_MODE));
+ matrix1.a, false, !!(fill_mode & FX_STROKE_TEXT_MODE));
return RenderRasterizer(rasterizer, stroke_color,
!!(fill_mode & FXFILL_FULLCOVER), m_bGroupKnockout, 0,
nullptr);
}
-FX_BOOL CFX_AggDeviceDriver::SetPixel(int x, int y, uint32_t color) {
+bool CFX_AggDeviceDriver::SetPixel(int x, int y, uint32_t color) {
if (!m_pBitmap->GetBuffer())
- return TRUE;
+ return true;
if (!m_pClipRgn) {
if (!m_bRgbByteOrder)
return DibSetPixel(m_pBitmap, x, y, color, 0, nullptr);
RgbByteOrderSetPixel(m_pBitmap, x, y, color);
- return TRUE;
+ return true;
}
if (!m_pClipRgn->GetBox().Contains(x, y))
- return TRUE;
+ return true;
if (m_pClipRgn->GetType() == CFX_ClipRgn::RectI) {
if (!m_bRgbByteOrder)
return DibSetPixel(m_pBitmap, x, y, color, 0, nullptr);
RgbByteOrderSetPixel(m_pBitmap, x, y, color);
- return TRUE;
+ return true;
}
if (m_pClipRgn->GetType() != CFX_ClipRgn::MaskF)
- return TRUE;
+ return true;
const CFX_DIBitmap* pMask = m_pClipRgn->GetMask().GetObject();
int new_alpha = FXARGB_A(color) * pMask->GetScanline(y)[x] / 255;
color = (color & 0xffffff) | (new_alpha << 24);
if (m_bRgbByteOrder) {
RgbByteOrderSetPixel(m_pBitmap, x, y, color);
- return TRUE;
+ return true;
}
return DibSetPixel(m_pBitmap, x, y, color, 0, nullptr);
}
-FX_BOOL CFX_AggDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
- uint32_t fill_color,
- int blend_type) {
+bool CFX_AggDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) {
if (blend_type != FXDIB_BLEND_NORMAL)
- return FALSE;
+ return false;
if (!m_pBitmap->GetBuffer())
- return TRUE;
+ return true;
FX_RECT clip_rect;
GetClipBox(&clip_rect);
@@ -1563,7 +1563,7 @@ FX_BOOL CFX_AggDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
if (pRect)
draw_rect.Intersect(*pRect);
if (draw_rect.IsEmpty())
- return TRUE;
+ return true;
if (!m_pClipRgn || m_pClipRgn->GetType() == CFX_ClipRgn::RectI) {
if (m_bRgbByteOrder) {
@@ -1574,32 +1574,30 @@ FX_BOOL CFX_AggDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
m_pBitmap->CompositeRect(draw_rect.left, draw_rect.top, draw_rect.Width(),
draw_rect.Height(), fill_color, 0, nullptr);
}
- return TRUE;
+ return true;
}
m_pBitmap->CompositeMask(
draw_rect.left, draw_rect.top, draw_rect.Width(), draw_rect.Height(),
m_pClipRgn->GetMask().GetObject(), fill_color,
draw_rect.left - clip_rect.left, draw_rect.top - clip_rect.top,
FXDIB_BLEND_NORMAL, nullptr, m_bRgbByteOrder, 0, nullptr);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_AggDeviceDriver::GetClipBox(FX_RECT* pRect) {
+bool CFX_AggDeviceDriver::GetClipBox(FX_RECT* pRect) {
if (!m_pClipRgn) {
pRect->left = pRect->top = 0;
pRect->right = GetDeviceCaps(FXDC_PIXEL_WIDTH);
pRect->bottom = GetDeviceCaps(FXDC_PIXEL_HEIGHT);
- return TRUE;
+ return true;
}
*pRect = m_pClipRgn->GetBox();
- return TRUE;
+ return true;
}
-FX_BOOL CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap,
- int left,
- int top) {
+bool CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
if (!m_pBitmap || !m_pBitmap->GetBuffer())
- return TRUE;
+ return true;
FX_RECT rect(left, top, left + pBitmap->GetWidth(),
top + pBitmap->GetHeight());
@@ -1607,17 +1605,17 @@ FX_BOOL CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap,
if (m_pOriDevice) {
pBack = m_pOriDevice->Clone(&rect);
if (!pBack)
- return TRUE;
+ return true;
pBack->CompositeBitmap(0, 0, pBack->GetWidth(), pBack->GetHeight(),
m_pBitmap, 0, 0);
} else {
pBack = m_pBitmap->Clone(&rect);
if (!pBack)
- return TRUE;
+ return true;
}
- FX_BOOL bRet = TRUE;
+ bool bRet = true;
left = std::min(left, 0);
top = std::min(top, 0);
if (m_bRgbByteOrder) {
@@ -1635,14 +1633,14 @@ CFX_DIBitmap* CFX_AggDeviceDriver::GetBackDrop() {
return m_pOriDevice;
}
-FX_BOOL CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
- uint32_t argb,
- const FX_RECT* pSrcRect,
- int left,
- int top,
- int blend_type) {
+bool CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
+ uint32_t argb,
+ const FX_RECT* pSrcRect,
+ int left,
+ int top,
+ int blend_type) {
if (!m_pBitmap->GetBuffer())
- return TRUE;
+ return true;
if (pBitmap->IsAlphaMask()) {
return m_pBitmap->CompositeMask(
@@ -1655,17 +1653,17 @@ FX_BOOL CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
pSrcRect->top, blend_type, m_pClipRgn.get(), m_bRgbByteOrder, nullptr);
}
-FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
- uint32_t argb,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- uint32_t flags,
- int blend_type) {
+bool CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
+ uint32_t argb,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ uint32_t flags,
+ int blend_type) {
if (!m_pBitmap->GetBuffer())
- return TRUE;
+ return true;
if (dest_width == pSource->GetWidth() &&
dest_height == pSource->GetHeight()) {
@@ -1678,36 +1676,36 @@ FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
FX_RECT dest_clip = dest_rect;
dest_clip.Intersect(*pClipRect);
CFX_BitmapComposer composer;
- composer.Compose(m_pBitmap, m_pClipRgn.get(), 255, argb, dest_clip, FALSE,
- FALSE, FALSE, m_bRgbByteOrder, 0, nullptr, blend_type);
+ composer.Compose(m_pBitmap, m_pClipRgn.get(), 255, argb, dest_clip, false,
+ false, false, m_bRgbByteOrder, 0, nullptr, blend_type);
dest_clip.Offset(-dest_rect.left, -dest_rect.top);
CFX_ImageStretcher stretcher(&composer, pSource, dest_width, dest_height,
dest_clip, flags);
if (stretcher.Start())
stretcher.Continue(nullptr);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource,
- int bitmap_alpha,
- uint32_t argb,
- const CFX_Matrix* pMatrix,
- uint32_t render_flags,
- void*& handle,
- int blend_type) {
+bool CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource,
+ int bitmap_alpha,
+ uint32_t argb,
+ const CFX_Matrix* pMatrix,
+ uint32_t render_flags,
+ void*& handle,
+ int blend_type) {
if (!m_pBitmap->GetBuffer())
- return TRUE;
+ return true;
CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer;
pRenderer->Start(m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb,
pMatrix, render_flags, m_bRgbByteOrder, 0, nullptr);
handle = pRenderer;
- return TRUE;
+ return true;
}
-FX_BOOL CFX_AggDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) {
+bool CFX_AggDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) {
if (!m_pBitmap->GetBuffer()) {
- return TRUE;
+ return true;
}
return ((CFX_ImageRenderer*)pHandle)->Continue(pPause);
}
@@ -1721,7 +1719,7 @@ void CFX_AggDeviceDriver::CancelDIBits(void* pHandle) {
#ifndef _SKIA_SUPPORT_
CFX_FxgeDevice::CFX_FxgeDevice() {
- m_bOwnedBitmap = FALSE;
+ m_bOwnedBitmap = false;
}
bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap,
diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h
index 0789d022f3..8da63394a4 100644
--- a/core/fxge/agg/fx_agg_driver.h
+++ b/core/fxge/agg/fx_agg_driver.h
@@ -33,9 +33,9 @@ class CAgg_PathData {
class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
public:
CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap,
- FX_BOOL bRgbByteOrder,
+ bool bRgbByteOrder,
CFX_DIBitmap* pOriDevice,
- FX_BOOL bGroupKnockout);
+ bool bGroupKnockout);
~CFX_AggDeviceDriver() override;
void InitPlatform();
@@ -45,64 +45,64 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
int GetDeviceCaps(int caps_id) const override;
void SaveState() override;
void RestoreState(bool bKeepSaved) override;
- FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- int fill_mode) override;
- FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState) override;
- FX_BOOL DrawPath(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- int fill_mode,
- int blend_type) override;
- FX_BOOL SetPixel(int x, int y, uint32_t color) override;
- FX_BOOL FillRectWithBlend(const FX_RECT* pRect,
- uint32_t fill_color,
- int blend_type) override;
- FX_BOOL GetClipBox(FX_RECT* pRect) override;
- FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override;
+ bool SetClip_PathFill(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ int fill_mode) override;
+ bool SetClip_PathStroke(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState) override;
+ bool DrawPath(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ int fill_mode,
+ int blend_type) override;
+ bool SetPixel(int x, int y, uint32_t color) override;
+ bool FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) override;
+ bool GetClipBox(FX_RECT* pRect) override;
+ bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override;
CFX_DIBitmap* GetBackDrop() override;
- FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
- uint32_t color,
- const FX_RECT* pSrcRect,
- int left,
- int top,
- int blend_type) override;
- FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
- uint32_t color,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- uint32_t flags,
- int blend_type) override;
- FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
- int bitmap_alpha,
- uint32_t color,
- const CFX_Matrix* pMatrix,
- uint32_t flags,
- void*& handle,
- int blend_type) override;
- FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) override;
+ bool SetDIBits(const CFX_DIBSource* pBitmap,
+ uint32_t color,
+ const FX_RECT* pSrcRect,
+ int left,
+ int top,
+ int blend_type) override;
+ bool StretchDIBits(const CFX_DIBSource* pBitmap,
+ uint32_t color,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ uint32_t flags,
+ int blend_type) override;
+ bool StartDIBits(const CFX_DIBSource* pBitmap,
+ int bitmap_alpha,
+ uint32_t color,
+ const CFX_Matrix* pMatrix,
+ uint32_t flags,
+ void*& handle,
+ int blend_type) override;
+ bool ContinueDIBits(void* handle, IFX_Pause* pPause) override;
void CancelDIBits(void* handle) override;
- FX_BOOL DrawDeviceText(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t color) override;
+ bool DrawDeviceText(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t color) override;
int GetDriverType() const override;
- FX_BOOL RenderRasterizer(agg::rasterizer_scanline_aa& rasterizer,
- uint32_t color,
- FX_BOOL bFullCover,
- FX_BOOL bGroupKnockout,
- int alpha_flag,
- void* pIccTransform);
+ bool RenderRasterizer(agg::rasterizer_scanline_aa& rasterizer,
+ uint32_t color,
+ bool bFullCover,
+ bool bGroupKnockout,
+ int alpha_flag,
+ void* pIccTransform);
void SetClipMask(agg::rasterizer_scanline_aa& rasterizer);
@@ -116,9 +116,9 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
void* m_pPlatformGraphics;
#endif
int m_FillFlags;
- FX_BOOL m_bRgbByteOrder;
+ bool m_bRgbByteOrder;
CFX_DIBitmap* m_pOriDevice;
- FX_BOOL m_bGroupKnockout;
+ bool m_bGroupKnockout;
};
#endif // CORE_FXGE_AGG_FX_AGG_DRIVER_H_
diff --git a/core/fxge/android/cfpf_skiafont.cpp b/core/fxge/android/cfpf_skiafont.cpp
index c7cfd4d324..5e11efae9d 100644
--- a/core/fxge/android/cfpf_skiafont.cpp
+++ b/core/fxge/android/cfpf_skiafont.cpp
@@ -87,21 +87,21 @@ int32_t CFPF_SkiaFont::GetDescent() const {
FXFT_Get_Face_Descender(m_Face));
}
-FX_BOOL CFPF_SkiaFont::GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox) {
+bool CFPF_SkiaFont::GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox) {
if (!m_Face)
- return FALSE;
+ return false;
if (FXFT_Is_Face_Tricky(m_Face)) {
if (FXFT_Set_Char_Size(m_Face, 0, 1000 * 64, 72, 72))
- return FALSE;
+ return false;
if (FXFT_Load_Glyph(m_Face, iGlyphIndex,
FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)) {
FXFT_Set_Pixel_Sizes(m_Face, 0, 64);
- return FALSE;
+ return false;
}
FXFT_Glyph glyph;
if (FXFT_Get_Glyph(m_Face->glyph, &glyph)) {
FXFT_Set_Pixel_Sizes(m_Face, 0, 64);
- return FALSE;
+ return false;
}
FXFT_BBox cbox;
FXFT_Glyph_Get_CBox(glyph, FXFT_GLYPH_BBOX_PIXELS, &cbox);
@@ -119,7 +119,7 @@ FX_BOOL CFPF_SkiaFont::GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox) {
if (FXFT_Load_Glyph(
m_Face, iGlyphIndex,
FXFT_LOAD_NO_SCALE | FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)) {
- return FALSE;
+ return false;
}
rtBBox.left = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face),
FXFT_Get_Glyph_HoriBearingX(m_Face));
@@ -131,12 +131,12 @@ FX_BOOL CFPF_SkiaFont::GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox) {
rtBBox.top = FPF_EM_ADJUST(
FXFT_Get_Face_UnitsPerEM(m_Face),
FXFT_Get_Glyph_HoriBearingY(m_Face) - FXFT_Get_Glyph_Height(m_Face));
- return TRUE;
+ return true;
}
-FX_BOOL CFPF_SkiaFont::GetBBox(FX_RECT& rtBBox) {
+bool CFPF_SkiaFont::GetBBox(FX_RECT& rtBBox) {
if (!m_Face) {
- return FALSE;
+ return false;
}
rtBBox.left = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face),
FXFT_Get_Face_xMin(m_Face));
@@ -146,7 +146,7 @@ FX_BOOL CFPF_SkiaFont::GetBBox(FX_RECT& rtBBox) {
FXFT_Get_Face_xMax(m_Face));
rtBBox.bottom = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face),
FXFT_Get_Face_yMax(m_Face));
- return TRUE;
+ return true;
}
int32_t CFPF_SkiaFont::GetHeight() const {
@@ -179,13 +179,13 @@ uint32_t CFPF_SkiaFont::GetFontData(uint32_t dwTable,
return pdfium::base::checked_cast<uint32_t>(ulSize);
}
-FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr* pFontMgr,
- CFPF_SkiaFontDescriptor* pFontDes,
- const CFX_ByteStringC& bsFamily,
- uint32_t dwStyle,
- uint8_t uCharset) {
+bool CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr* pFontMgr,
+ CFPF_SkiaFontDescriptor* pFontDes,
+ const CFX_ByteStringC& bsFamily,
+ uint32_t dwStyle,
+ uint8_t uCharset) {
if (!pFontMgr || !pFontDes)
- return FALSE;
+ return false;
switch (pFontDes->GetType()) {
case FPF_SKIAFONTTYPE_Path: {
@@ -205,15 +205,15 @@ FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr* pFontMgr,
break;
}
default:
- return FALSE;
+ return false;
}
if (!m_Face)
- return FALSE;
+ return false;
m_dwStyle = dwStyle;
m_uCharset = uCharset;
m_pFontMgr = pFontMgr;
m_pFontDes = pFontDes;
m_dwRefCount = 1;
- return TRUE;
+ return true;
}
diff --git a/core/fxge/android/cfpf_skiafont.h b/core/fxge/android/cfpf_skiafont.h
index ad0245d5d6..b72c111177 100644
--- a/core/fxge/android/cfpf_skiafont.h
+++ b/core/fxge/android/cfpf_skiafont.h
@@ -29,17 +29,17 @@ class CFPF_SkiaFont {
int32_t GetGlyphWidth(int32_t iGlyphIndex);
int32_t GetAscent() const;
int32_t GetDescent() const;
- FX_BOOL GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox);
- FX_BOOL GetBBox(FX_RECT& rtBBox);
+ bool GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox);
+ bool GetBBox(FX_RECT& rtBBox);
int32_t GetHeight() const;
int32_t GetItalicAngle() const;
uint32_t GetFontData(uint32_t dwTable, uint8_t* pBuffer, uint32_t dwSize);
- FX_BOOL InitFont(CFPF_SkiaFontMgr* pFontMgr,
- CFPF_SkiaFontDescriptor* pFontDes,
- const CFX_ByteStringC& bsFamily,
- uint32_t dwStyle,
- uint8_t uCharset);
+ bool InitFont(CFPF_SkiaFontMgr* pFontMgr,
+ CFPF_SkiaFontDescriptor* pFontDes,
+ const CFX_ByteStringC& bsFamily,
+ uint32_t dwStyle,
+ uint8_t uCharset);
private:
CFPF_SkiaFontMgr* m_pFontMgr;
diff --git a/core/fxge/android/cfx_androidfontinfo.cpp b/core/fxge/android/cfx_androidfontinfo.cpp
index 6db46e2775..03a7ffbd9e 100644
--- a/core/fxge/android/cfx_androidfontinfo.cpp
+++ b/core/fxge/android/cfx_androidfontinfo.cpp
@@ -13,21 +13,21 @@
CFX_AndroidFontInfo::CFX_AndroidFontInfo() : m_pFontMgr(nullptr) {}
CFX_AndroidFontInfo::~CFX_AndroidFontInfo() {}
-FX_BOOL CFX_AndroidFontInfo::Init(CFPF_SkiaFontMgr* pFontMgr) {
+bool CFX_AndroidFontInfo::Init(CFPF_SkiaFontMgr* pFontMgr) {
if (!pFontMgr)
- return FALSE;
+ return false;
pFontMgr->LoadSystemFonts();
m_pFontMgr = pFontMgr;
- return TRUE;
+ return true;
}
-FX_BOOL CFX_AndroidFontInfo::EnumFontList(CFX_FontMapper* pMapper) {
- return FALSE;
+bool CFX_AndroidFontInfo::EnumFontList(CFX_FontMapper* pMapper) {
+ return false;
}
void* CFX_AndroidFontInfo::MapFont(int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int charset,
int pitch_family,
const FX_CHAR* face,
@@ -63,20 +63,20 @@ uint32_t CFX_AndroidFontInfo::GetFontData(void* hFont,
return static_cast<CFPF_SkiaFont*>(hFont)->GetFontData(table, buffer, size);
}
-FX_BOOL CFX_AndroidFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
+bool CFX_AndroidFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
if (!hFont)
- return FALSE;
+ return false;
name = static_cast<CFPF_SkiaFont*>(hFont)->GetFamilyName();
- return TRUE;
+ return true;
}
-FX_BOOL CFX_AndroidFontInfo::GetFontCharset(void* hFont, int& charset) {
+bool CFX_AndroidFontInfo::GetFontCharset(void* hFont, int& charset) {
if (!hFont)
- return FALSE;
+ return false;
charset = static_cast<CFPF_SkiaFont*>(hFont)->GetCharset();
- return FALSE;
+ return false;
}
void CFX_AndroidFontInfo::DeleteFont(void* hFont) {
diff --git a/core/fxge/android/cfx_androidfontinfo.h b/core/fxge/android/cfx_androidfontinfo.h
index 135a2cdae7..94e1db88ac 100644
--- a/core/fxge/android/cfx_androidfontinfo.h
+++ b/core/fxge/android/cfx_androidfontinfo.h
@@ -19,12 +19,12 @@ class CFX_AndroidFontInfo : public IFX_SystemFontInfo {
CFX_AndroidFontInfo();
~CFX_AndroidFontInfo() override;
- FX_BOOL Init(CFPF_SkiaFontMgr* pFontMgr);
+ bool Init(CFPF_SkiaFontMgr* pFontMgr);
// IFX_SystemFontInfo:
- FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override;
+ bool EnumFontList(CFX_FontMapper* pMapper) override;
void* MapFont(int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int charset,
int pitch_family,
const FX_CHAR* face,
@@ -34,8 +34,8 @@ class CFX_AndroidFontInfo : public IFX_SystemFontInfo {
uint32_t table,
uint8_t* buffer,
uint32_t size) override;
- FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override;
- FX_BOOL GetFontCharset(void* hFont, int& charset) override;
+ bool GetFaceName(void* hFont, CFX_ByteString& name) override;
+ bool GetFontCharset(void* hFont, int& charset) override;
void DeleteFont(void* hFont) override;
protected:
diff --git a/core/fxge/apple/apple_int.h b/core/fxge/apple/apple_int.h
index b85d4a784a..9881e17a88 100644
--- a/core/fxge/apple/apple_int.h
+++ b/core/fxge/apple/apple_int.h
@@ -29,14 +29,14 @@ class CQuartz2D {
void* CreateFont(const uint8_t* pFontData, uint32_t dwFontSize);
void DestroyFont(void* pFont);
void setGraphicsTextMatrix(void* graphics, CFX_Matrix* matrix);
- FX_BOOL drawGraphicsString(void* graphics,
- void* font,
- FX_FLOAT fontSize,
- uint16_t* glyphIndices,
- CGPoint* glyphPositions,
- int32_t chars,
- FX_ARGB argb,
- CFX_Matrix* matrix = nullptr);
+ bool drawGraphicsString(void* graphics,
+ void* font,
+ FX_FLOAT fontSize,
+ uint16_t* glyphIndices,
+ CGPoint* glyphPositions,
+ int32_t chars,
+ FX_ARGB argb,
+ CFX_Matrix* matrix = nullptr);
void saveGraphicsState(void* graphics);
void restoreGraphicsState(void* graphics);
};
@@ -59,58 +59,58 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver {
CFX_Matrix GetCTM() const override;
void SaveState() override;
void RestoreState(bool bKeepSaved) override;
- FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- int fill_mode) override;
- FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState) override;
- FX_BOOL DrawPath(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- int fill_mode,
- int blend_type) override;
- FX_BOOL FillRectWithBlend(const FX_RECT* pRect,
- uint32_t fill_color,
- int blend_type) override;
- FX_BOOL DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- uint32_t color,
- int blend_type) override;
- FX_BOOL GetClipBox(FX_RECT* pRect) override;
- FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override;
- FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
- uint32_t color,
- const FX_RECT* pSrcRect,
- int dest_left,
- int dest_top,
- int blend_type) override;
- FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
+ bool SetClip_PathFill(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ int fill_mode) override;
+ bool SetClip_PathStroke(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState) override;
+ bool DrawPath(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ int fill_mode,
+ int blend_type) override;
+ bool FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) override;
+ bool DrawCosmeticLine(FX_FLOAT x1,
+ FX_FLOAT y1,
+ FX_FLOAT x2,
+ FX_FLOAT y2,
uint32_t color,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- uint32_t flags,
int blend_type) override;
- FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
- int bitmap_alpha,
- uint32_t color,
- const CFX_Matrix* pMatrix,
- uint32_t flags,
- void*& handle,
- int blend_type) override;
- FX_BOOL DrawDeviceText(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t color) override;
+ bool GetClipBox(FX_RECT* pRect) override;
+ bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override;
+ bool SetDIBits(const CFX_DIBSource* pBitmap,
+ uint32_t color,
+ const FX_RECT* pSrcRect,
+ int dest_left,
+ int dest_top,
+ int blend_type) override;
+ bool StretchDIBits(const CFX_DIBSource* pBitmap,
+ uint32_t color,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ uint32_t flags,
+ int blend_type) override;
+ bool StartDIBits(const CFX_DIBSource* pBitmap,
+ int bitmap_alpha,
+ uint32_t color,
+ const CFX_Matrix* pMatrix,
+ uint32_t flags,
+ void*& handle,
+ int blend_type) override;
+ bool DrawDeviceText(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t color) override;
void ClearDriver() override;
protected:
@@ -121,13 +121,13 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver {
void setPathToContext(const CFX_PathData* pathData);
FX_FLOAT getLineWidth(const CFX_GraphStateData* graphState,
CGAffineTransform ctm);
- FX_BOOL CG_DrawGlyphRun(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- const CFX_Matrix* pGlyphMatrix,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t argb);
+ bool CG_DrawGlyphRun(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ const CFX_Matrix* pGlyphMatrix,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t argb);
void CG_SetImageTransform(int dest_left,
int dest_top,
int dest_width,
diff --git a/core/fxge/apple/cfx_quartzdevice.h b/core/fxge/apple/cfx_quartzdevice.h
index 75df61b160..310cef8463 100644
--- a/core/fxge/apple/cfx_quartzdevice.h
+++ b/core/fxge/apple/cfx_quartzdevice.h
@@ -16,15 +16,15 @@ class CFX_QuartzDevice : public CFX_RenderDevice {
CFX_QuartzDevice();
~CFX_QuartzDevice() override;
- FX_BOOL Attach(CGContextRef context, int32_t nDeviceClass = FXDC_DISPLAY);
- FX_BOOL Attach(CFX_DIBitmap* pBitmap);
- FX_BOOL Create(int32_t width, int32_t height, FXDIB_Format format);
+ bool Attach(CGContextRef context, int32_t nDeviceClass = FXDC_DISPLAY);
+ bool Attach(CFX_DIBitmap* pBitmap);
+ bool Create(int32_t width, int32_t height, FXDIB_Format format);
CGContextRef GetContext();
protected:
CGContextRef m_pContext;
- FX_BOOL m_bOwnedBitmap;
+ bool m_bOwnedBitmap;
};
#endif
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp
index 6428c1d9e5..403ed4a12e 100644
--- a/core/fxge/apple/fx_apple_platform.cpp
+++ b/core/fxge/apple/fx_apple_platform.cpp
@@ -28,18 +28,18 @@ namespace {
void DoNothing(void* info, const void* data, size_t size) {}
-FX_BOOL CGDrawGlyphRun(CGContextRef pContext,
- int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t argb) {
+bool CGDrawGlyphRun(CGContextRef pContext,
+ int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t argb) {
if (nChars == 0)
- return TRUE;
+ return true;
CFX_Matrix new_matrix;
- FX_BOOL bNegSize = font_size < 0;
+ bool bNegSize = font_size < 0;
if (bNegSize)
font_size = -font_size;
@@ -53,12 +53,12 @@ FX_BOOL CGDrawGlyphRun(CGContextRef pContext,
->m_quartz2d;
if (!pFont->GetPlatformFont()) {
if (pFont->GetPsName() == "DFHeiStd-W5")
- return FALSE;
+ return false;
pFont->SetPlatformFont(
quartz2d.CreateFont(pFont->GetFontData(), pFont->GetSize()));
if (!pFont->GetPlatformFont())
- return FALSE;
+ return false;
}
CFX_FixedBufGrow<uint16_t, 32> glyph_indices(nChars);
CFX_FixedBufGrow<CGPoint, 32> glyph_positions(nChars);
@@ -103,28 +103,28 @@ void CFX_AggDeviceDriver::DestroyPlatform() {
}
}
-FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t argb) {
+bool CFX_AggDeviceDriver::DrawDeviceText(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t argb) {
if (!pFont)
- return FALSE;
+ return false;
- FX_BOOL bBold = pFont->IsBold();
+ bool bBold = pFont->IsBold();
if (!bBold && pFont->GetSubstFont() &&
pFont->GetSubstFont()->m_Weight >= 500 &&
pFont->GetSubstFont()->m_Weight <= 600) {
- return FALSE;
+ return false;
}
for (int i = 0; i < nChars; i++) {
if (pCharPos[i].m_bGlyphAdjust)
- return FALSE;
+ return false;
}
CGContextRef ctx = CGContextRef(m_pPlatformGraphics);
if (!ctx)
- return FALSE;
+ return false;
CGContextSaveGState(ctx);
CGContextSetTextDrawingMode(ctx, kCGTextFillClip);
@@ -142,7 +142,7 @@ FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars,
CGFloat decode_f[2] = {255.f, 0.f};
pImageCG = CGImageMaskCreate(
pClipMask->GetWidth(), pClipMask->GetHeight(), 8, 8,
- pClipMask->GetPitch(), pClipMaskDataProvider, decode_f, FALSE);
+ pClipMask->GetPitch(), pClipMaskDataProvider, decode_f, false);
CGDataProviderRelease(pClipMaskDataProvider);
}
} else {
@@ -154,8 +154,8 @@ FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars,
else
CGContextClipToRect(ctx, rect_cg);
- FX_BOOL ret = CGDrawGlyphRun(ctx, nChars, pCharPos, pFont, pObject2Device,
- font_size, argb);
+ bool ret = CGDrawGlyphRun(ctx, nChars, pCharPos, pFont, pObject2Device,
+ font_size, argb);
if (pImageCG)
CGImageRelease(pImageCG);
CGContextRestoreGState(ctx);
diff --git a/core/fxge/apple/fx_mac_imp.cpp b/core/fxge/apple/fx_mac_imp.cpp
index 3df88301b1..fa6572084c 100644
--- a/core/fxge/apple/fx_mac_imp.cpp
+++ b/core/fxge/apple/fx_mac_imp.cpp
@@ -38,7 +38,7 @@ class CFX_MacFontInfo : public CFX_FolderFontInfo {
// CFX_FolderFontInfo
void* MapFont(int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int charset,
int pitch_family,
const FX_CHAR* family,
@@ -58,7 +58,7 @@ void GetJapanesePreference(CFX_ByteString* face, int weight, int pitch_family) {
}
void* CFX_MacFontInfo::MapFont(int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int charset,
int pitch_family,
const FX_CHAR* cstr_face,
@@ -67,7 +67,7 @@ void* CFX_MacFontInfo::MapFont(int weight,
for (size_t i = 0; i < FX_ArraySize(g_Base14Substs); ++i) {
if (face == CFX_ByteStringC(g_Base14Substs[i].m_pName)) {
face = g_Base14Substs[i].m_pSubstName;
- iExact = TRUE;
+ iExact = true;
return GetFont(face.c_str());
}
}
diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp
index 74a03649dd..112399d17f 100644
--- a/core/fxge/apple/fx_quartz_device.cpp
+++ b/core/fxge/apple/fx_quartz_device.cpp
@@ -75,16 +75,16 @@ void CQuartz2D::setGraphicsTextMatrix(void* graphics, CFX_Matrix* matrix) {
context, CGAffineTransformMake(matrix->a, matrix->b, matrix->c, matrix->d,
matrix->e, ty));
}
-FX_BOOL CQuartz2D::drawGraphicsString(void* graphics,
- void* font,
- FX_FLOAT fontSize,
- uint16_t* glyphIndices,
- CGPoint* glyphPositions,
- int32_t charsCount,
- FX_ARGB argb,
- CFX_Matrix* matrix) {
+bool CQuartz2D::drawGraphicsString(void* graphics,
+ void* font,
+ FX_FLOAT fontSize,
+ uint16_t* glyphIndices,
+ CGPoint* glyphPositions,
+ int32_t charsCount,
+ FX_ARGB argb,
+ CFX_Matrix* matrix) {
if (!graphics) {
- return FALSE;
+ return false;
}
CGContextRef context = (CGContextRef)graphics;
CGContextSetFont(context, (CGFontRef)font);
@@ -115,7 +115,7 @@ FX_BOOL CQuartz2D::drawGraphicsString(void* graphics,
delete[] glyphPositionsCG;
#endif
CGContextRestoreGState(context);
- return TRUE;
+ return true;
}
void CQuartz2D::saveGraphicsState(void* graphics) {
if (graphics) {
@@ -229,9 +229,9 @@ void CFX_QuartzDeviceDriver::RestoreState(bool isKeepSaved) {
}
}
-FX_BOOL CFX_QuartzDeviceDriver::SetClip_PathFill(const CFX_PathData* pathData,
- const CFX_Matrix* matrix,
- int fillMode) {
+bool CFX_QuartzDeviceDriver::SetClip_PathFill(const CFX_PathData* pathData,
+ const CFX_Matrix* matrix,
+ int fillMode) {
SaveState();
CGAffineTransform m = CGAffineTransformIdentity;
if (matrix) {
@@ -247,7 +247,7 @@ FX_BOOL CFX_QuartzDeviceDriver::SetClip_PathFill(const CFX_PathData* pathData,
} else {
CGContextEOClip(m_context);
}
- return TRUE;
+ return true;
}
FX_FLOAT CFX_QuartzDeviceDriver::getLineWidth(
const CFX_GraphStateData* graphState,
@@ -264,7 +264,7 @@ FX_FLOAT CFX_QuartzDeviceDriver::getLineWidth(
}
return lineWidth;
}
-FX_BOOL CFX_QuartzDeviceDriver::SetClip_PathStroke(
+bool CFX_QuartzDeviceDriver::SetClip_PathStroke(
const CFX_PathData* pathData,
const CFX_Matrix* matrix,
const CFX_GraphStateData* graphState) {
@@ -282,7 +282,7 @@ FX_BOOL CFX_QuartzDeviceDriver::SetClip_PathStroke(
CGContextReplacePathWithStrokedPath(m_context);
RestoreState(false);
CGContextClip(m_context);
- return TRUE;
+ return true;
}
static CGBlendMode GetCGBlendMode(int blend_type) {
CGBlendMode mode = kCGBlendModeNormal;
@@ -342,13 +342,13 @@ static CGBlendMode GetCGBlendMode(int blend_type) {
return mode;
}
-FX_BOOL CFX_QuartzDeviceDriver::DrawPath(const CFX_PathData* pathData,
- const CFX_Matrix* matrix,
- const CFX_GraphStateData* graphState,
- uint32_t fillArgb,
- uint32_t strokeArgb,
- int fillMode,
- int blend_type) {
+bool CFX_QuartzDeviceDriver::DrawPath(const CFX_PathData* pathData,
+ const CFX_Matrix* matrix,
+ const CFX_GraphStateData* graphState,
+ uint32_t fillArgb,
+ uint32_t strokeArgb,
+ int fillMode,
+ int blend_type) {
SaveState();
CGBlendMode mode = GetCGBlendMode(blend_type);
if (mode != kCGBlendModeNormal) {
@@ -392,12 +392,12 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawPath(const CFX_PathData* pathData,
CGContextDrawPath(m_context, kCGPathEOFillStroke);
}
RestoreState(false);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_QuartzDeviceDriver::FillRectWithBlend(const FX_RECT* rect,
- FX_ARGB fillArgb,
- int blend_type) {
+bool CFX_QuartzDeviceDriver::FillRectWithBlend(const FX_RECT* rect,
+ FX_ARGB fillArgb,
+ int blend_type) {
CGBlendMode mode = GetCGBlendMode(blend_type);
if (mode != kCGBlendModeNormal) {
CGContextSetBlendMode(m_context, mode);
@@ -413,15 +413,15 @@ FX_BOOL CFX_QuartzDeviceDriver::FillRectWithBlend(const FX_RECT* rect,
if (mode != kCGBlendModeNormal) {
CGContextSetBlendMode(m_context, kCGBlendModeNormal);
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_QuartzDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- uint32_t argb,
- int blend_type) {
+bool CFX_QuartzDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
+ FX_FLOAT y1,
+ FX_FLOAT x2,
+ FX_FLOAT y2,
+ uint32_t argb,
+ int blend_type) {
CGBlendMode mode = GetCGBlendMode(blend_type);
if (mode != kCGBlendModeNormal) {
CGContextSetBlendMode(m_context, mode);
@@ -443,25 +443,25 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
if (mode != kCGBlendModeNormal) {
CGContextSetBlendMode(m_context, kCGBlendModeNormal);
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_QuartzDeviceDriver::GetClipBox(FX_RECT* rect) {
+bool CFX_QuartzDeviceDriver::GetClipBox(FX_RECT* rect) {
CGRect r = CGContextGetClipBoundingBox(m_context);
r = CGRectApplyAffineTransform(r, m_user2FoxitDevice);
rect->left = FXSYS_floor(r.origin.x);
rect->top = FXSYS_floor(r.origin.y);
rect->right = FXSYS_ceil(r.origin.x + r.size.width);
rect->bottom = FXSYS_ceil(r.origin.y + r.size.height);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap* bitmap,
- int32_t left,
- int32_t top) {
+bool CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap* bitmap,
+ int32_t left,
+ int32_t top) {
if (FXDC_PRINTER == m_deviceClass || bitmap->GetBPP() < 32 ||
!(m_renderCaps | FXRC_GET_BITS)) {
- return FALSE;
+ return false;
}
CGPoint pt = CGPointMake(left, top);
@@ -471,7 +471,7 @@ FX_BOOL CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap* bitmap,
pt.y *= FXSYS_fabs(ctm.d);
CGImageRef image = CGBitmapContextCreateImage(m_context);
if (!image)
- return FALSE;
+ return false;
CGFloat width = (CGFloat)bitmap->GetWidth();
CGFloat height = (CGFloat)bitmap->GetHeight();
@@ -490,7 +490,7 @@ FX_BOOL CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap* bitmap,
CGImageRelease(subImage);
CGImageRelease(image);
if (!bitmap->HasAlpha())
- return TRUE;
+ return true;
for (int row = 0; row < bitmap->GetHeight(); row++) {
uint8_t* pScanline = (uint8_t*)bitmap->GetScanline(row);
@@ -503,15 +503,15 @@ FX_BOOL CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap* bitmap,
pScanline += 4;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
- FX_ARGB argb,
- const FX_RECT* srcRect,
- int dest_left,
- int dest_top,
- int blendType) {
+bool CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
+ FX_ARGB argb,
+ const FX_RECT* srcRect,
+ int dest_left,
+ int dest_top,
+ int blendType) {
SaveState();
CGFloat src_left, src_top, src_width, src_height;
if (srcRect) {
@@ -549,7 +549,7 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
}
if (!pBitmap1) {
RestoreState(false);
- return FALSE;
+ return false;
}
CGDataProviderRef pBitmapProvider = CGDataProviderCreateWithData(
nullptr, pBitmap1->GetBuffer(),
@@ -572,7 +572,7 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
delete pBitmap1;
}
RestoreState(false);
- return TRUE;
+ return true;
}
if (pBitmap->GetBPP() < 32) {
pBitmap1 = pBitmap->CloneConvert(FXDIB_Rgb32);
@@ -585,14 +585,14 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
}
if (!pBitmap1) {
RestoreState(false);
- return FALSE;
+ return false;
}
if (pBitmap1->HasAlpha()) {
if (pBitmap1 == pBitmap) {
pBitmap1 = pBitmap->Clone();
if (!pBitmap1) {
RestoreState(false);
- return FALSE;
+ return false;
}
}
for (int row = 0; row < pBitmap1->GetHeight(); row++) {
@@ -626,18 +626,18 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
delete pBitmap1;
}
RestoreState(false);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
- FX_ARGB argb,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* clipRect,
- uint32_t flags,
- int blend_type) {
+bool CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
+ FX_ARGB argb,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* clipRect,
+ uint32_t flags,
+ int blend_type) {
SaveState();
if (clipRect) {
CGContextBeginPath(m_context);
@@ -665,7 +665,7 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
pBitmap1 = pBitmap->Clone();
if (!pBitmap1) {
RestoreState(false);
- return FALSE;
+ return false;
}
CGDataProviderRef pBitmapProvider = CGDataProviderCreateWithData(
nullptr, pBitmap1->GetBuffer(),
@@ -688,7 +688,7 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
delete pBitmap1;
RestoreState(false);
- return TRUE;
+ return true;
}
if (pBitmap->GetBPP() < 32) {
pBitmap1 = pBitmap->CloneConvert(FXDIB_Rgb32);
@@ -700,14 +700,14 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
}
if (!pBitmap1) {
RestoreState(false);
- return FALSE;
+ return false;
}
if (pBitmap1->HasAlpha()) {
if (pBitmap1 == pBitmap) {
pBitmap1 = pBitmap->Clone();
if (!pBitmap1) {
RestoreState(false);
- return FALSE;
+ return false;
}
}
for (int row = 0; row < pBitmap1->GetHeight(); row++) {
@@ -729,41 +729,40 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
delete pBitmap1;
RestoreState(false);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_QuartzDeviceDriver::StartDIBits(const CFX_DIBSource* pBitmap,
- int bitmap_alpha,
- uint32_t color,
- const CFX_Matrix* pMatrix,
- uint32_t flags,
- void*& handle,
- int blend_type) {
- return FALSE;
+bool CFX_QuartzDeviceDriver::StartDIBits(const CFX_DIBSource* pBitmap,
+ int bitmap_alpha,
+ uint32_t color,
+ const CFX_Matrix* pMatrix,
+ uint32_t flags,
+ void*& handle,
+ int blend_type) {
+ return false;
}
-FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlyphRun(
- int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- const CFX_Matrix* pGlyphMatrix,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t argb) {
+bool CFX_QuartzDeviceDriver::CG_DrawGlyphRun(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ const CFX_Matrix* pGlyphMatrix,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t argb) {
if (nChars == 0)
- return TRUE;
+ return true;
CQuartz2D& quartz2d =
static_cast<CApplePlatform*>(CFX_GEModule::Get()->GetPlatformData())
->m_quartz2d;
if (!pFont->GetPlatformFont()) {
if (pFont->GetPsName() == "DFHeiStd-W5")
- return FALSE;
+ return false;
pFont->SetPlatformFont(
quartz2d.CreateFont(pFont->GetFontData(), pFont->GetSize()));
if (!pFont->GetPlatformFont()) {
- return FALSE;
+ return false;
}
}
CFX_FixedBufGrow<uint16_t, 32> glyph_indices(nChars);
@@ -805,27 +804,27 @@ FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlyphRun(
CGContextShowGlyphsAtPositions(m_context, (CGGlyph*)glyph_indices,
glyph_positions, nChars);
RestoreState(false);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t color) {
+bool CFX_QuartzDeviceDriver::DrawDeviceText(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t color) {
if (!pFont || !m_context)
- return FALSE;
+ return false;
- FX_BOOL bBold = pFont->IsBold();
+ bool bBold = pFont->IsBold();
if (!bBold && pFont->GetSubstFont() &&
pFont->GetSubstFont()->m_Weight >= 500 &&
pFont->GetSubstFont()->m_Weight <= 600) {
- return FALSE;
+ return false;
}
SaveState();
CGContextSetTextDrawingMode(m_context, kCGTextFillClip);
- FX_BOOL ret = FALSE;
+ bool ret = false;
int32_t i = 0;
while (i < nChars) {
if (pCharPos[i].m_bGlyphAdjust || font_size < 0) {
@@ -1001,7 +1000,7 @@ void CFX_QuartzDeviceDriver::ClearDriver() {
}
}
CFX_QuartzDevice::CFX_QuartzDevice() {
- m_bOwnedBitmap = FALSE;
+ m_bOwnedBitmap = false;
m_pContext = nullptr;
}
CFX_QuartzDevice::~CFX_QuartzDevice() {
@@ -1015,7 +1014,7 @@ CFX_QuartzDevice::~CFX_QuartzDevice() {
CGContextRef CFX_QuartzDevice::GetContext() {
return m_pContext;
}
-FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, int32_t nDeviceClass) {
+bool CFX_QuartzDevice::Attach(CGContextRef context, int32_t nDeviceClass) {
if (m_pContext) {
CGContextRelease(m_pContext);
}
@@ -1023,30 +1022,30 @@ FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, int32_t nDeviceClass) {
CGContextRetain(m_pContext);
SetDeviceDriver(
pdfium::MakeUnique<CFX_QuartzDeviceDriver>(m_pContext, nDeviceClass));
- return TRUE;
+ return true;
}
-FX_BOOL CFX_QuartzDevice::Attach(CFX_DIBitmap* pBitmap) {
+bool CFX_QuartzDevice::Attach(CFX_DIBitmap* pBitmap) {
SetBitmap(pBitmap);
m_pContext = createContextWithBitmap(pBitmap);
if (!m_pContext)
- return FALSE;
+ return false;
SetDeviceDriver(
pdfium::MakeUnique<CFX_QuartzDeviceDriver>(m_pContext, FXDC_DISPLAY));
- return TRUE;
+ return true;
}
-FX_BOOL CFX_QuartzDevice::Create(int32_t width,
- int32_t height,
- FXDIB_Format format) {
+bool CFX_QuartzDevice::Create(int32_t width,
+ int32_t height,
+ FXDIB_Format format) {
if ((uint8_t)format < 32) {
- return FALSE;
+ return false;
}
std::unique_ptr<CFX_DIBitmap> pBitmap(new CFX_DIBitmap);
if (!pBitmap->Create(width, height, format))
- return FALSE;
- m_bOwnedBitmap = TRUE;
+ return false;
+ m_bOwnedBitmap = true;
return Attach(pBitmap.release());
}
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
diff --git a/core/fxge/cfx_facecache.h b/core/fxge/cfx_facecache.h
index 98ffe7a928..96fc73b57d 100644
--- a/core/fxge/cfx_facecache.h
+++ b/core/fxge/cfx_facecache.h
@@ -18,7 +18,7 @@ class CFX_FaceCache {
~CFX_FaceCache();
const CFX_GlyphBitmap* LoadGlyphBitmap(const CFX_Font* pFont,
uint32_t glyph_index,
- FX_BOOL bFontStyle,
+ bool bFontStyle,
const CFX_Matrix* pMatrix,
int dest_width,
int anti_alias,
@@ -34,7 +34,7 @@ class CFX_FaceCache {
private:
CFX_GlyphBitmap* RenderGlyph(const CFX_Font* pFont,
uint32_t glyph_index,
- FX_BOOL bFontStyle,
+ bool bFontStyle,
const CFX_Matrix* pMatrix,
int dest_width,
int anti_alias);
@@ -47,7 +47,7 @@ class CFX_FaceCache {
const CFX_Matrix* pMatrix,
const CFX_ByteString& FaceGlyphsKey,
uint32_t glyph_index,
- FX_BOOL bFontStyle,
+ bool bFontStyle,
int dest_width,
int anti_alias);
void InitPlatform();
diff --git a/core/fxge/cfx_fontmapper.h b/core/fxge/cfx_fontmapper.h
index e59966a530..fa3bc02eb0 100644
--- a/core/fxge/cfx_fontmapper.h
+++ b/core/fxge/cfx_fontmapper.h
@@ -26,7 +26,7 @@ class CFX_FontMapper {
void LoadInstalledFonts();
FXFT_Face FindSubstFont(const CFX_ByteString& face_name,
- FX_BOOL bTrueType,
+ bool bTrueType,
uint32_t flags,
int weight,
int italic_angle,
@@ -38,7 +38,7 @@ class CFX_FontMapper {
int weight,
int italic_angle);
#endif // PDF_ENABLE_XFA
- FX_BOOL IsBuiltinFace(const FXFT_Face face) const;
+ bool IsBuiltinFace(const FXFT_Face face) const;
int GetFaceSize() const;
CFX_ByteString GetFaceName(int index) const {
return m_FaceArray[index].name;
@@ -65,7 +65,7 @@ class CFX_FontMapper {
FXFT_Face GetCachedFace(void* hFont,
CFX_ByteString SubstName,
int weight,
- FX_BOOL bItalic,
+ bool bItalic,
uint32_t font_size);
struct FaceData {
@@ -73,7 +73,7 @@ class CFX_FontMapper {
uint32_t charset;
};
- FX_BOOL m_bListLoaded;
+ bool m_bListLoaded;
FXFT_Face m_MMFaces[MM_FACE_COUNT];
CFX_ByteString m_LastFamily;
std::vector<FaceData> m_FaceArray;
diff --git a/core/fxge/cfx_fontmgr.h b/core/fxge/cfx_fontmgr.h
index 67357e4265..432f34b38c 100644
--- a/core/fxge/cfx_fontmgr.h
+++ b/core/fxge/cfx_fontmgr.h
@@ -26,11 +26,11 @@ class CFX_FontMgr {
FXFT_Face GetCachedFace(const CFX_ByteString& face_name,
int weight,
- FX_BOOL bItalic,
+ bool bItalic,
uint8_t*& pFontData);
FXFT_Face AddCachedFace(const CFX_ByteString& face_name,
int weight,
- FX_BOOL bItalic,
+ bool bItalic,
uint8_t* pData,
uint32_t size,
int face_index);
@@ -48,7 +48,7 @@ class CFX_FontMgr {
void ReleaseFace(FXFT_Face face);
void SetSystemFontInfo(std::unique_ptr<IFX_SystemFontInfo> pFontInfo);
FXFT_Face FindSubstFont(const CFX_ByteString& face_name,
- FX_BOOL bTrueType,
+ bool bTrueType,
uint32_t flags,
int weight,
int italic_angle,
diff --git a/core/fxge/cfx_pathdata.h b/core/fxge/cfx_pathdata.h
index e24feb5888..3e0e11c4ee 100644
--- a/core/fxge/cfx_pathdata.h
+++ b/core/fxge/cfx_pathdata.h
@@ -35,12 +35,12 @@ class CFX_PathData {
CFX_FloatRect GetBoundingBox() const;
CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const;
void Transform(const CFX_Matrix* pMatrix);
- FX_BOOL IsRect() const;
- FX_BOOL GetZeroAreaPath(CFX_PathData& NewPath,
- CFX_Matrix* pMatrix,
- FX_BOOL& bThin,
- FX_BOOL bAdjust) const;
- FX_BOOL IsRect(const CFX_Matrix* pMatrix, CFX_FloatRect* rect) const;
+ bool IsRect() const;
+ bool GetZeroAreaPath(CFX_PathData& NewPath,
+ CFX_Matrix* pMatrix,
+ bool& bThin,
+ bool bAdjust) const;
+ bool IsRect(const CFX_Matrix* pMatrix, CFX_FloatRect* rect) const;
void Append(const CFX_PathData* pSrc, const CFX_Matrix* pMatrix);
void AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top);
void SetPoint(int index, FX_FLOAT x, FX_FLOAT y, int flag);
diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h
index 4d7db1235e..d38b2981ba 100644
--- a/core/fxge/cfx_renderdevice.h
+++ b/core/fxge/cfx_renderdevice.h
@@ -102,126 +102,122 @@ class CFX_RenderDevice {
CFX_Matrix GetCTM() const;
CFX_DIBitmap* GetBitmap() const { return m_pBitmap; }
void SetBitmap(CFX_DIBitmap* pBitmap) { m_pBitmap = pBitmap; }
- FX_BOOL CreateCompatibleBitmap(CFX_DIBitmap* pDIB,
- int width,
- int height) const;
+ bool CreateCompatibleBitmap(CFX_DIBitmap* pDIB, int width, int height) const;
const FX_RECT& GetClipBox() const { return m_ClipBox; }
- FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- int fill_mode);
- FX_BOOL SetClip_Rect(const FX_RECT& pRect);
- FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState);
- FX_BOOL DrawPath(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- int fill_mode) {
+ bool SetClip_PathFill(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ int fill_mode);
+ bool SetClip_Rect(const FX_RECT& pRect);
+ bool SetClip_PathStroke(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState);
+ bool DrawPath(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ int fill_mode) {
return DrawPathWithBlend(pPathData, pObject2Device, pGraphState, fill_color,
stroke_color, fill_mode, FXDIB_BLEND_NORMAL);
}
- FX_BOOL DrawPathWithBlend(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- int fill_mode,
- int blend_type);
- FX_BOOL SetPixel(int x, int y, uint32_t color);
- FX_BOOL FillRect(const FX_RECT* pRect, uint32_t color) {
+ bool DrawPathWithBlend(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ int fill_mode,
+ int blend_type);
+ bool SetPixel(int x, int y, uint32_t color);
+ bool FillRect(const FX_RECT* pRect, uint32_t color) {
return FillRectWithBlend(pRect, color, FXDIB_BLEND_NORMAL);
}
- FX_BOOL FillRectWithBlend(const FX_RECT* pRect,
- uint32_t color,
- int blend_type);
- FX_BOOL DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- uint32_t color,
- int fill_mode,
- int blend_type);
-
- FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top);
+ bool FillRectWithBlend(const FX_RECT* pRect, uint32_t color, int blend_type);
+ bool DrawCosmeticLine(FX_FLOAT x1,
+ FX_FLOAT y1,
+ FX_FLOAT x2,
+ FX_FLOAT y2,
+ uint32_t color,
+ int fill_mode,
+ int blend_type);
+
+ bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top);
CFX_DIBitmap* GetBackDrop();
- FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, int left, int top) {
+ bool SetDIBits(const CFX_DIBSource* pBitmap, int left, int top) {
return SetDIBitsWithBlend(pBitmap, left, top, FXDIB_BLEND_NORMAL);
}
- FX_BOOL SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int blend_type);
- FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int dest_width,
- int dest_height) {
+ bool SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
+ int left,
+ int top,
+ int blend_type);
+ bool StretchDIBits(const CFX_DIBSource* pBitmap,
+ int left,
+ int top,
+ int dest_width,
+ int dest_height) {
return StretchDIBitsWithFlagsAndBlend(pBitmap, left, top, dest_width,
dest_height, 0, FXDIB_BLEND_NORMAL);
}
- FX_BOOL StretchDIBitsWithFlagsAndBlend(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int dest_width,
- int dest_height,
- uint32_t flags,
- int blend_type);
- FX_BOOL SetBitMask(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- uint32_t color);
- FX_BOOL StretchBitMask(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int dest_width,
- int dest_height,
- uint32_t color);
- FX_BOOL StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int dest_width,
- int dest_height,
- uint32_t color,
- uint32_t flags);
- FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
- int bitmap_alpha,
- uint32_t color,
- const CFX_Matrix* pMatrix,
- uint32_t flags,
- void*& handle) {
+ bool StretchDIBitsWithFlagsAndBlend(const CFX_DIBSource* pBitmap,
+ int left,
+ int top,
+ int dest_width,
+ int dest_height,
+ uint32_t flags,
+ int blend_type);
+ bool SetBitMask(const CFX_DIBSource* pBitmap,
+ int left,
+ int top,
+ uint32_t color);
+ bool StretchBitMask(const CFX_DIBSource* pBitmap,
+ int left,
+ int top,
+ int dest_width,
+ int dest_height,
+ uint32_t color);
+ bool StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap,
+ int left,
+ int top,
+ int dest_width,
+ int dest_height,
+ uint32_t color,
+ uint32_t flags);
+ bool StartDIBits(const CFX_DIBSource* pBitmap,
+ int bitmap_alpha,
+ uint32_t color,
+ const CFX_Matrix* pMatrix,
+ uint32_t flags,
+ void*& handle) {
return StartDIBitsWithBlend(pBitmap, bitmap_alpha, color, pMatrix, flags,
handle, FXDIB_BLEND_NORMAL);
}
- FX_BOOL StartDIBitsWithBlend(const CFX_DIBSource* pBitmap,
- int bitmap_alpha,
- uint32_t color,
- const CFX_Matrix* pMatrix,
- uint32_t flags,
- void*& handle,
- int blend_type);
- FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause);
+ bool StartDIBitsWithBlend(const CFX_DIBSource* pBitmap,
+ int bitmap_alpha,
+ uint32_t color,
+ const CFX_Matrix* pMatrix,
+ uint32_t flags,
+ void*& handle,
+ int blend_type);
+ bool ContinueDIBits(void* handle, IFX_Pause* pPause);
void CancelDIBits(void* handle);
- FX_BOOL DrawNormalText(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- FX_FLOAT font_size,
- const CFX_Matrix* pText2Device,
- uint32_t fill_color,
- uint32_t text_flags);
- FX_BOOL DrawTextPath(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- FX_FLOAT font_size,
- const CFX_Matrix* pText2User,
- const CFX_Matrix* pUser2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- CFX_PathData* pClippingPath,
- int nFlag);
+ bool DrawNormalText(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ FX_FLOAT font_size,
+ const CFX_Matrix* pText2Device,
+ uint32_t fill_color,
+ uint32_t text_flags);
+ bool DrawTextPath(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ FX_FLOAT font_size,
+ const CFX_Matrix* pText2User,
+ const CFX_Matrix* pUser2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ CFX_PathData* pClippingPath,
+ int nFlag);
#ifdef _SKIA_SUPPORT_
virtual void DebugVerifyBitmapIsPreMultiplied() const;
@@ -237,13 +233,13 @@ class CFX_RenderDevice {
private:
void InitDeviceInfo();
void UpdateClipBox();
- FX_BOOL DrawFillStrokePath(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- int fill_mode,
- int blend_type);
+ bool DrawFillStrokePath(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ int fill_mode,
+ int blend_type);
CFX_DIBitmap* m_pBitmap;
int m_Width;
diff --git a/core/fxge/dib/dib_int.h b/core/fxge/dib/dib_int.h
index aa79b73154..000003a9c6 100644
--- a/core/fxge/dib/dib_int.h
+++ b/core/fxge/dib/dib_int.h
@@ -75,10 +75,10 @@ class CStretchEngine {
int flags);
~CStretchEngine();
- FX_BOOL Continue(IFX_Pause* pPause);
+ bool Continue(IFX_Pause* pPause);
- FX_BOOL StartStretchHorz();
- FX_BOOL ContinueStretchHorz(IFX_Pause* pPause);
+ bool StartStretchHorz();
+ bool ContinueStretchHorz(IFX_Pause* pPause);
void StretchVert();
FXDIB_Format m_DestFormat;
@@ -110,7 +110,7 @@ class CStretchEngine {
FX_RECT FXDIB_SwapClipBox(FX_RECT& clip,
int width,
int height,
- FX_BOOL bFlipX,
- FX_BOOL bFlipY);
+ bool bFlipX,
+ bool bFlipY);
#endif // CORE_FXGE_DIB_DIB_INT_H_
diff --git a/core/fxge/dib/fx_dib_composite.cpp b/core/fxge/dib/fx_dib_composite.cpp
index d180b7a831..e3dc7404f3 100644
--- a/core/fxge/dib/fx_dib_composite.cpp
+++ b/core/fxge/dib/fx_dib_composite.cpp
@@ -307,7 +307,7 @@ void CompositeRow_Argb2Graya(uint8_t* dest_scan,
pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
if (blend_type) {
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
if (src_alpha_scan) {
for (int col = 0; col < pixel_count; col++) {
uint8_t back_alpha = *dst_alpha_scan;
@@ -511,7 +511,7 @@ void CompositeRow_Argb2Gray(uint8_t* dest_scan,
pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
if (blend_type) {
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
if (src_alpha_scan) {
for (int col = 0; col < pixel_count; col++) {
int src_alpha = *src_alpha_scan++;
@@ -607,7 +607,7 @@ void CompositeRow_Rgb2Gray(uint8_t* dest_scan,
pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
}
if (blend_type) {
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
for (int col = 0; col < pixel_count; col++) {
if (pIccTransform) {
pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
@@ -657,7 +657,7 @@ void CompositeRow_Rgb2Graya(uint8_t* dest_scan,
pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
}
if (blend_type) {
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
for (int col = 0; col < pixel_count; col++) {
int back_alpha = *dest_alpha_scan;
if (back_alpha == 0) {
@@ -747,7 +747,7 @@ void CompositeRow_Argb2Argb(uint8_t* dest_scan,
uint8_t* dest_alpha_scan,
const uint8_t* src_alpha_scan) {
int blended_colors[3];
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
if (!dest_alpha_scan) {
if (!src_alpha_scan) {
uint8_t back_alpha = 0;
@@ -970,7 +970,7 @@ void CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan,
int src_Bpp,
uint8_t* dest_alpha_scan) {
int blended_colors[3];
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
int src_gap = src_Bpp - 3;
if (dest_alpha_scan) {
for (int col = 0; col < width; col++) {
@@ -1039,7 +1039,7 @@ void CompositeRow_Rgb2Argb_Blend_Clip(uint8_t* dest_scan,
const uint8_t* clip_scan,
uint8_t* dest_alpha_scan) {
int blended_colors[3];
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
int src_gap = src_Bpp - 3;
if (dest_alpha_scan) {
for (int col = 0; col < width; col++) {
@@ -1222,7 +1222,7 @@ void CompositeRow_Argb2Rgb_Blend(uint8_t* dest_scan,
const uint8_t* clip_scan,
const uint8_t* src_alpha_scan) {
int blended_colors[3];
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
int dest_gap = dest_Bpp - 3;
if (src_alpha_scan) {
for (int col = 0; col < width; col++) {
@@ -1355,7 +1355,7 @@ void CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan,
int dest_Bpp,
int src_Bpp) {
int blended_colors[3];
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
int dest_gap = dest_Bpp - 3;
int src_gap = src_Bpp - 3;
for (int col = 0; col < width; col++) {
@@ -1385,7 +1385,7 @@ void CompositeRow_Rgb2Rgb_Blend_Clip(uint8_t* dest_scan,
int src_Bpp,
const uint8_t* clip_scan) {
int blended_colors[3];
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
int dest_gap = dest_Bpp - 3;
int src_gap = src_Bpp - 3;
for (int col = 0; col < width; col++) {
@@ -1487,7 +1487,7 @@ void CompositeRow_Argb2Argb_Transform(uint8_t* dest_scan,
} else {
if (dest_alpha_scan) {
int blended_colors[3];
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
for (int col = 0; col < pixel_count; col++) {
pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan,
1);
@@ -1673,7 +1673,7 @@ void CompositeRow_Argb2Rgb_Blend_Transform(uint8_t* dest_scan,
width);
} else {
int blended_colors[3];
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
int dest_gap = dest_Bpp - 3;
for (int col = 0; col < width; col++) {
pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1);
@@ -1867,7 +1867,7 @@ void CompositeRow_8bppPal2Gray(uint8_t* dest_scan,
const uint8_t* src_alpha_scan) {
if (src_alpha_scan) {
if (blend_type) {
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
for (int col = 0; col < pixel_count; col++) {
uint8_t gray = pPalette[*src_scan];
int src_alpha = *src_alpha_scan++;
@@ -1904,7 +1904,7 @@ void CompositeRow_8bppPal2Gray(uint8_t* dest_scan,
}
} else {
if (blend_type) {
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
for (int col = 0; col < pixel_count; col++) {
uint8_t gray = pPalette[*src_scan];
if (bNonseparableBlend)
@@ -1944,7 +1944,7 @@ void CompositeRow_8bppPal2Graya(uint8_t* dest_scan,
const uint8_t* src_alpha_scan) {
if (src_alpha_scan) {
if (blend_type) {
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
for (int col = 0; col < pixel_count; col++) {
uint8_t gray = pPalette[*src_scan];
src_scan++;
@@ -2018,7 +2018,7 @@ void CompositeRow_8bppPal2Graya(uint8_t* dest_scan,
}
} else {
if (blend_type) {
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
for (int col = 0; col < pixel_count; col++) {
uint8_t gray = pPalette[*src_scan];
src_scan++;
@@ -2082,7 +2082,7 @@ void CompositeRow_1bppPal2Gray(uint8_t* dest_scan,
int reset_gray = pPalette[0];
int set_gray = pPalette[1];
if (blend_type) {
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
for (int col = 0; col < pixel_count; col++) {
uint8_t gray =
(src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8)))
@@ -2126,7 +2126,7 @@ void CompositeRow_1bppPal2Graya(uint8_t* dest_scan,
int reset_gray = pPalette[0];
int set_gray = pPalette[1];
if (blend_type) {
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
for (int col = 0; col < pixel_count; col++) {
uint8_t gray =
(src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8)))
@@ -2989,7 +2989,7 @@ void CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan,
int blend_type,
const uint8_t* clip_scan) {
int blended_colors[3];
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
for (int col = 0; col < pixel_count; col++) {
uint8_t back_alpha = dest_scan[3];
if (back_alpha == 0) {
@@ -3053,7 +3053,7 @@ void CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan,
int blend_type,
int src_Bpp) {
int blended_colors[3];
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
int src_gap = src_Bpp - 3;
for (int col = 0; col < width; col++) {
uint8_t back_alpha = dest_scan[3];
@@ -3097,7 +3097,7 @@ void CompositeRow_Argb2Rgb_Blend_RgbByteOrder(uint8_t* dest_scan,
int dest_Bpp,
const uint8_t* clip_scan) {
int blended_colors[3];
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
for (int col = 0; col < width; col++) {
uint8_t src_alpha;
if (clip_scan) {
@@ -3154,7 +3154,7 @@ void CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan,
int dest_Bpp,
int src_Bpp) {
int blended_colors[3];
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
int src_gap = src_Bpp - 3;
for (int col = 0; col < width; col++) {
if (bNonseparableBlend) {
@@ -3236,7 +3236,7 @@ void CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan,
int src_Bpp,
const uint8_t* clip_scan) {
int blended_colors[3];
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
int src_gap = src_Bpp - 3;
for (int col = 0; col < width; col++) {
int src_alpha = *clip_scan++;
@@ -3288,7 +3288,7 @@ void CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan,
int src_Bpp,
const uint8_t* clip_scan) {
int blended_colors[3];
- FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
int src_gap = src_Bpp - 3;
for (int col = 0; col < width; col++) {
uint8_t src_alpha = *clip_scan++;
@@ -3802,16 +3802,16 @@ void CompositeRow_BitMask2Rgb_RgbByteOrder(uint8_t* dest_scan,
}
}
-FX_BOOL ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format,
- int alpha_flag,
- uint32_t mask_color,
- int& mask_alpha,
- int& mask_red,
- int& mask_green,
- int& mask_blue,
- int& mask_black,
- CCodec_IccModule* pIccModule,
- void* pIccTransform) {
+bool ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format,
+ int alpha_flag,
+ uint32_t mask_color,
+ int& mask_alpha,
+ int& mask_red,
+ int& mask_green,
+ int& mask_blue,
+ int& mask_black,
+ CCodec_IccModule* pIccModule,
+ void* pIccTransform) {
if (alpha_flag >> 8) {
mask_alpha = alpha_flag & 0xff;
mask_red = FXSYS_GetCValue(mask_color);
@@ -3825,7 +3825,7 @@ FX_BOOL ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format,
mask_blue = FXARGB_B(mask_color);
}
if (dest_format == FXDIB_8bppMask) {
- return TRUE;
+ return true;
}
if ((dest_format & 0xff) == 8) {
if (pIccTransform) {
@@ -3866,7 +3866,7 @@ FX_BOOL ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format,
mask_blue = mask_color_p[0];
}
}
- return TRUE;
+ return true;
}
void ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format,
@@ -3875,8 +3875,8 @@ void ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format,
uint32_t* pSrcPalette,
CCodec_IccModule* pIccModule,
void* pIccTransform) {
- FX_BOOL isSrcCmyk = !!(src_format & 0x0400);
- FX_BOOL isDstCmyk = !!(dest_format & 0x0400);
+ bool isSrcCmyk = !!(src_format & 0x0400);
+ bool isDstCmyk = !!(dest_format & 0x0400);
pDestPalette = nullptr;
if (pIccTransform) {
if (pSrcPalette) {
@@ -4012,7 +4012,7 @@ CFX_ScanlineCompositor::CFX_ScanlineCompositor() {
m_pSrcPalette = nullptr;
m_pCacheScanline = nullptr;
m_CacheSize = 0;
- m_bRgbByteOrder = FALSE;
+ m_bRgbByteOrder = false;
m_BlendType = FXDIB_BLEND_NORMAL;
}
@@ -4021,16 +4021,16 @@ CFX_ScanlineCompositor::~CFX_ScanlineCompositor() {
FX_Free(m_pCacheScanline);
}
-FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format,
- FXDIB_Format src_format,
- int32_t width,
- uint32_t* pSrcPalette,
- uint32_t mask_color,
- int blend_type,
- FX_BOOL bClip,
- FX_BOOL bRgbByteOrder,
- int alpha_flag,
- void* pIccTransform) {
+bool CFX_ScanlineCompositor::Init(FXDIB_Format dest_format,
+ FXDIB_Format src_format,
+ int32_t width,
+ uint32_t* pSrcPalette,
+ uint32_t mask_color,
+ int blend_type,
+ bool bClip,
+ bool bRgbByteOrder,
+ int alpha_flag,
+ void* pIccTransform) {
m_SrcFormat = src_format;
m_DestFormat = dest_format;
m_BlendType = blend_type;
@@ -4044,7 +4044,7 @@ FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format,
}
m_pIccTransform = pIccTransform;
if ((dest_format & 0xff) == 1) {
- return FALSE;
+ return false;
}
if (m_SrcFormat == FXDIB_1bppMask || m_SrcFormat == FXDIB_8bppMask) {
return ScanlineCompositor_InitSourceMask(
@@ -4052,11 +4052,11 @@ FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format,
m_MaskGreen, m_MaskBlue, m_MaskBlack, pIccModule, pIccTransform);
}
if (!pIccTransform && (~src_format & 0x0400) && (dest_format & 0x0400)) {
- return FALSE;
+ return false;
}
if ((m_SrcFormat & 0xff) <= 8) {
if (dest_format == FXDIB_8bppMask) {
- return TRUE;
+ return true;
}
ScanlineCompositor_InitSourcePalette(src_format, dest_format, m_pSrcPalette,
pSrcPalette, pIccModule,
@@ -4064,14 +4064,14 @@ FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format,
m_Transparency =
(dest_format == FXDIB_Argb ? 1 : 0) + (dest_format & 0x0200 ? 2 : 0) +
(dest_format & 0x0400 ? 4 : 0) + ((src_format & 0xff) == 1 ? 8 : 0);
- return TRUE;
+ return true;
}
m_Transparency = (src_format & 0x0200 ? 0 : 1) +
(dest_format & 0x0200 ? 0 : 2) +
(blend_type == FXDIB_BLEND_NORMAL ? 4 : 0) +
(bClip ? 8 : 0) + (src_format & 0x0400 ? 16 : 0) +
(dest_format & 0x0400 ? 32 : 0) + (pIccTransform ? 64 : 0);
- return TRUE;
+ return true;
}
void CFX_ScanlineCompositor::CompositeRgbBitmapLine(
@@ -4481,29 +4481,29 @@ void CFX_ScanlineCompositor::CompositeBitMaskLine(uint8_t* dest_scan,
}
}
-FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left,
- int dest_top,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top,
- int blend_type,
- const CFX_ClipRgn* pClipRgn,
- FX_BOOL bRgbByteOrder,
- void* pIccTransform) {
+bool CFX_DIBitmap::CompositeBitmap(int dest_left,
+ int dest_top,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top,
+ int blend_type,
+ const CFX_ClipRgn* pClipRgn,
+ bool bRgbByteOrder,
+ void* pIccTransform) {
if (!m_pBuffer) {
- return FALSE;
+ return false;
}
ASSERT(!pSrcBitmap->IsAlphaMask());
ASSERT(m_bpp >= 8);
if (pSrcBitmap->IsAlphaMask() || m_bpp < 8) {
- return FALSE;
+ return false;
}
GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(),
pSrcBitmap->GetHeight(), src_left, src_top, pClipRgn);
if (width == 0 || height == 0) {
- return TRUE;
+ return true;
}
const CFX_DIBitmap* pClipMask = nullptr;
FX_RECT clip_box;
@@ -4516,11 +4516,11 @@ FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left,
if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width,
pSrcBitmap->GetPalette(), 0, blend_type,
pClipMask != nullptr, bRgbByteOrder, 0, pIccTransform)) {
- return FALSE;
+ return false;
}
int dest_Bpp = m_bpp / 8;
int src_Bpp = pSrcBitmap->GetBPP() / 8;
- FX_BOOL bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage();
+ bool bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage();
CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask;
for (int row = 0; row < height; row++) {
uint8_t* dest_scan =
@@ -4550,39 +4550,39 @@ FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left,
dst_scan_extra_alpha);
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left,
- int dest_top,
- int width,
- int height,
- const CFX_DIBSource* pMask,
- uint32_t color,
- int src_left,
- int src_top,
- int blend_type,
- const CFX_ClipRgn* pClipRgn,
- FX_BOOL bRgbByteOrder,
- int alpha_flag,
- void* pIccTransform) {
+bool CFX_DIBitmap::CompositeMask(int dest_left,
+ int dest_top,
+ int width,
+ int height,
+ const CFX_DIBSource* pMask,
+ uint32_t color,
+ int src_left,
+ int src_top,
+ int blend_type,
+ const CFX_ClipRgn* pClipRgn,
+ bool bRgbByteOrder,
+ int alpha_flag,
+ void* pIccTransform) {
if (!m_pBuffer) {
- return FALSE;
+ return false;
}
ASSERT(pMask->IsAlphaMask());
ASSERT(m_bpp >= 8);
if (!pMask->IsAlphaMask() || m_bpp < 8) {
- return FALSE;
+ return false;
}
GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(),
pMask->GetHeight(), src_left, src_top, pClipRgn);
if (width == 0 || height == 0) {
- return TRUE;
+ return true;
}
int src_alpha =
(uint8_t)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color);
if (src_alpha == 0) {
- return TRUE;
+ return true;
}
const CFX_DIBitmap* pClipMask = nullptr;
FX_RECT clip_box;
@@ -4597,7 +4597,7 @@ FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left,
if (!compositor.Init(GetFormat(), pMask->GetFormat(), width, nullptr, color,
blend_type, pClipMask != nullptr, bRgbByteOrder,
alpha_flag, pIccTransform)) {
- return FALSE;
+ return false;
}
for (int row = 0; row < height; row++) {
uint8_t* dest_scan =
@@ -4621,27 +4621,27 @@ FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left,
clip_scan, dst_scan_extra_alpha);
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_DIBitmap::CompositeRect(int left,
- int top,
- int width,
- int height,
- uint32_t color,
- int alpha_flag,
- void* pIccTransform) {
+bool CFX_DIBitmap::CompositeRect(int left,
+ int top,
+ int width,
+ int height,
+ uint32_t color,
+ int alpha_flag,
+ void* pIccTransform) {
if (!m_pBuffer) {
- return FALSE;
+ return false;
}
int src_alpha = (alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color);
if (src_alpha == 0) {
- return TRUE;
+ return true;
}
FX_RECT rect(left, top, left + width, top + height);
rect.Intersect(0, 0, m_Width, m_Height);
if (rect.IsEmpty()) {
- return TRUE;
+ return true;
}
width = rect.Width();
uint32_t dst_color;
@@ -4684,7 +4684,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left,
}
}
}
- return TRUE;
+ return true;
}
if (m_bpp == 1) {
ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0);
@@ -4723,11 +4723,11 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left,
}
}
}
- return TRUE;
+ return true;
}
ASSERT(m_bpp >= 24);
if (m_bpp < 24) {
- return FALSE;
+ return false;
}
if (pIccTransform && CFX_GEModule::Get()->GetCodecModule()) {
CCodec_IccModule* pIccModule =
@@ -4739,14 +4739,14 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left,
FXSYS_GetYValue(color), FXSYS_GetKValue(color),
color_p[2], color_p[1], color_p[0]);
} else if (!(alpha_flag >> 8) && IsCmykImage()) {
- return FALSE;
+ return false;
}
}
if (!IsCmykImage()) {
color_p[3] = (uint8_t)src_alpha;
}
int Bpp = m_bpp / 8;
- FX_BOOL bAlpha = HasAlpha();
+ bool bAlpha = HasAlpha();
bool bArgb = GetFormat() == FXDIB_Argb;
if (src_alpha == 255) {
for (int row = rect.top; row < rect.bottom; row++) {
@@ -4770,7 +4770,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left,
}
}
}
- return TRUE;
+ return true;
}
for (int row = rect.top; row < rect.bottom; row++) {
uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp;
@@ -4830,7 +4830,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left,
}
}
}
- return TRUE;
+ return true;
}
CFX_BitmapComposer::CFX_BitmapComposer() {
@@ -4838,7 +4838,7 @@ CFX_BitmapComposer::CFX_BitmapComposer() {
m_pScanlineAlphaV = nullptr;
m_pClipScanV = nullptr;
m_pAddClipScan = nullptr;
- m_bRgbByteOrder = FALSE;
+ m_bRgbByteOrder = false;
m_BlendType = FXDIB_BLEND_NORMAL;
}
@@ -4854,10 +4854,10 @@ void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest,
int bitmap_alpha,
uint32_t mask_color,
FX_RECT& dest_rect,
- FX_BOOL bVertical,
- FX_BOOL bFlipX,
- FX_BOOL bFlipY,
- FX_BOOL bRgbByteOrder,
+ bool bVertical,
+ bool bFlipX,
+ bool bFlipY,
+ bool bRgbByteOrder,
int alpha_flag,
void* pIccTransform,
int blend_type) {
@@ -4881,16 +4881,16 @@ void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest,
m_bRgbByteOrder = bRgbByteOrder;
m_BlendType = blend_type;
}
-FX_BOOL CFX_BitmapComposer::SetInfo(int width,
- int height,
- FXDIB_Format src_format,
- uint32_t* pSrcPalette) {
+bool CFX_BitmapComposer::SetInfo(int width,
+ int height,
+ FXDIB_Format src_format,
+ uint32_t* pSrcPalette) {
m_SrcFormat = src_format;
if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalette,
m_MaskColor, FXDIB_BLEND_NORMAL,
m_pClipMask != nullptr || (m_BitmapAlpha < 255),
m_bRgbByteOrder, m_AlphaFlag, m_pIccTransform)) {
- return FALSE;
+ return false;
}
if (m_bVertical) {
m_pScanlineV = FX_Alloc(uint8_t, m_pBitmap->GetBPP() / 8 * width + 4);
@@ -4903,7 +4903,7 @@ FX_BOOL CFX_BitmapComposer::SetInfo(int width,
m_pAddClipScan = FX_Alloc(
uint8_t, m_bVertical ? m_pBitmap->GetHeight() : m_pBitmap->GetWidth());
}
- return TRUE;
+ return true;
}
void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan,
diff --git a/core/fxge/dib/fx_dib_convert.cpp b/core/fxge/dib/fx_dib_convert.cpp
index e3ee626fff..5eac2ac8e4 100644
--- a/core/fxge/dib/fx_dib_convert.cpp
+++ b/core/fxge/dib/fx_dib_convert.cpp
@@ -12,7 +12,7 @@ class CFX_Palette {
CFX_Palette();
~CFX_Palette();
- FX_BOOL BuildPalette(const CFX_DIBSource* pBitmap);
+ bool BuildPalette(const CFX_DIBSource* pBitmap);
uint32_t* GetPalette() const { return m_pPalette; }
uint32_t* GetColorLut() const { return m_cLut; }
uint32_t* GetAmountLut() const { return m_aLut; }
@@ -96,9 +96,9 @@ CFX_Palette::~CFX_Palette() {
m_lut = 0;
}
-FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap) {
+bool CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap) {
if (!pBitmap) {
- return FALSE;
+ return false;
}
FX_Free(m_pPalette);
m_pPalette = FX_Alloc(uint32_t, 256);
@@ -133,16 +133,16 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap) {
}
_Qsort(m_aLut, m_cLut, 0, m_lut - 1);
_Obtain_Pal(m_aLut, m_cLut, m_pPalette, m_lut);
- return TRUE;
+ return true;
}
-FX_BOOL ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
+bool ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top) {
uint8_t set_gray, reset_gray;
set_gray = 0xff;
reset_gray = 0x00;
@@ -157,31 +157,31 @@ FX_BOOL ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf,
dest_scan++;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
+bool ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top) {
for (int row = 0; row < height; row++) {
uint8_t* dest_scan = dest_buf + row * dest_pitch;
const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left;
FXSYS_memcpy(dest_scan, src_scan, width);
}
- return TRUE;
+ return true;
}
-FX_BOOL ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
+bool ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top) {
uint32_t* src_plt = pSrcBitmap->GetPalette();
uint8_t gray[2];
uint8_t reset_r;
@@ -219,16 +219,16 @@ FX_BOOL ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf,
dest_scan++;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
+bool ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top) {
uint32_t* src_plt = pSrcBitmap->GetPalette();
uint8_t gray[256];
if (pSrcBitmap->IsCmykImage()) {
@@ -255,16 +255,16 @@ FX_BOOL ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf,
*dest_scan++ = gray[*src_scan++];
}
}
- return TRUE;
+ return true;
}
-FX_BOOL ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
+bool ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top) {
int Bpp = pSrcBitmap->GetBPP() / 8;
if (pSrcBitmap->IsCmykImage()) {
for (int row = 0; row < height; row++) {
@@ -292,7 +292,7 @@ FX_BOOL ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf,
}
}
}
- return TRUE;
+ return true;
}
void ConvertBuffer_IndexCopy(uint8_t* dest_buf,
@@ -324,14 +324,14 @@ void ConvertBuffer_IndexCopy(uint8_t* dest_buf,
}
}
-FX_BOOL ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top,
- uint32_t* dst_plt) {
+bool ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top,
+ uint32_t* dst_plt) {
ConvertBuffer_IndexCopy(dest_buf, dest_pitch, width, height, pSrcBitmap,
src_left, src_top);
uint32_t* src_plt = pSrcBitmap->GetPalette();
@@ -349,24 +349,24 @@ FX_BOOL ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf,
} else {
FXSYS_memcpy(dst_plt, src_plt, plt_size * 4);
}
- return TRUE;
+ return true;
}
-FX_BOOL ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top,
- uint32_t* dst_plt) {
+bool ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top,
+ uint32_t* dst_plt) {
int bpp = pSrcBitmap->GetBPP() / 8;
CFX_Palette palette;
palette.BuildPalette(pSrcBitmap);
uint32_t* cLut = palette.GetColorLut();
uint32_t* aLut = palette.GetAmountLut();
if (!cLut || !aLut) {
- return FALSE;
+ return false;
}
int lut = palette.Getlut();
uint32_t* pPalette = palette.GetPalette();
@@ -411,17 +411,17 @@ FX_BOOL ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf,
}
}
FXSYS_memcpy(dst_plt, pPalette, sizeof(uint32_t) * 256);
- return TRUE;
+ return true;
}
-FX_BOOL ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format,
- uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
+bool ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format,
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top) {
int comps = (dst_format & 0xff) / 8;
uint8_t set_gray, reset_gray;
set_gray = 0xff;
@@ -442,17 +442,17 @@ FX_BOOL ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format,
dest_scan += comps;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format,
- uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
+bool ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format,
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top) {
int comps = (dst_format & 0xff) / 8;
for (int row = 0; row < height; row++) {
uint8_t* dest_scan = dest_buf + row * dest_pitch;
@@ -466,17 +466,17 @@ FX_BOOL ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format,
dest_scan += comps - 2;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format,
- uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
+bool ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format,
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top) {
int comps = (dst_format & 0xff) / 8;
uint32_t* src_plt = pSrcBitmap->GetPalette();
uint32_t plt[2];
@@ -518,17 +518,17 @@ FX_BOOL ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format,
dest_scan += comps - 2;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format,
- uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
+bool ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format,
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top) {
int comps = (dst_format & 0xff) / 8;
uint32_t* src_plt = pSrcBitmap->GetPalette();
uint32_t plt[256];
@@ -564,32 +564,32 @@ FX_BOOL ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format,
dest_scan += comps - 2;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
+bool ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top) {
for (int row = 0; row < height; row++) {
uint8_t* dest_scan = dest_buf + row * dest_pitch;
const uint8_t* src_scan =
pSrcBitmap->GetScanline(src_top + row) + src_left * 3;
FXSYS_memcpy(dest_scan, src_scan, width * 3);
}
- return TRUE;
+ return true;
}
-FX_BOOL ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
+bool ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top) {
for (int row = 0; row < height; row++) {
uint8_t* dest_scan = dest_buf + row * dest_pitch;
const uint8_t* src_scan =
@@ -601,16 +601,16 @@ FX_BOOL ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf,
src_scan++;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
+bool ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top) {
int comps = pSrcBitmap->GetBPP() / 8;
for (int row = 0; row < height; row++) {
uint8_t* dest_scan = dest_buf + row * dest_pitch;
@@ -624,16 +624,16 @@ FX_BOOL ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf,
src_scan += comps - 3;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
+bool ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top) {
for (int row = 0; row < height; row++) {
uint8_t* dest_scan = dest_buf + row * dest_pitch;
const uint8_t* src_scan =
@@ -645,26 +645,26 @@ FX_BOOL ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf,
src_scan += 4;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
- uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top,
- std::unique_ptr<uint32_t, FxFreeDeleter>* p_pal) {
+bool ConvertBuffer(FXDIB_Format dest_format,
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top,
+ std::unique_ptr<uint32_t, FxFreeDeleter>* p_pal) {
FXDIB_Format src_format = pSrcBitmap->GetFormat();
switch (dest_format) {
case FXDIB_Invalid:
case FXDIB_1bppCmyk:
case FXDIB_1bppMask:
case FXDIB_1bppRgb:
- ASSERT(FALSE);
- return FALSE;
+ ASSERT(false);
+ return false;
case FXDIB_8bppMask: {
if ((src_format & 0xff) == 1) {
if (pSrcBitmap->GetPalette()) {
@@ -686,7 +686,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
return ConvertBuffer_RgbOrCmyk2Gray(dest_buf, dest_pitch, width, height,
pSrcBitmap, src_left, src_top);
}
- return FALSE;
+ return false;
}
case FXDIB_8bppRgb:
case FXDIB_8bppRgba: {
@@ -706,7 +706,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
pSrcBitmap, src_left, src_top,
p_pal->get());
}
- return FALSE;
+ return false;
}
case FXDIB_Rgb:
case FXDIB_Rgba: {
@@ -738,7 +738,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
return ConvertBuffer_32bppRgb2Rgb24(dest_buf, dest_pitch, width, height,
pSrcBitmap, src_left, src_top);
}
- return FALSE;
+ return false;
}
case FXDIB_Argb:
case FXDIB_Rgb32: {
@@ -771,10 +771,10 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
return ConvertBuffer_Rgb2Rgb32(dest_buf, dest_pitch, width, height,
pSrcBitmap, src_left, src_top);
}
- return FALSE;
+ return false;
}
default:
- return FALSE;
+ return false;
}
}
@@ -793,7 +793,7 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format) const {
return nullptr;
}
- FX_BOOL ret = TRUE;
+ bool ret = true;
if (dest_format & 0x0200) {
if (dest_format == FXDIB_Argb) {
ret = pSrcAlpha ? pClone->LoadChannel(FXDIB_Alpha, pSrcAlpha, FXDIB_Alpha)
@@ -819,15 +819,15 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format) const {
return pClone.release();
}
-FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) {
+bool CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) {
FXDIB_Format src_format = GetFormat();
if (dest_format == src_format)
- return TRUE;
+ return true;
if (dest_format == FXDIB_8bppMask && src_format == FXDIB_8bppRgb &&
!m_pPalette) {
m_AlphaFlag = 1;
- return TRUE;
+ return true;
}
if (dest_format == FXDIB_Argb && src_format == FXDIB_Rgb32) {
m_AlphaFlag = 2;
@@ -838,13 +838,13 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) {
scanline += 4;
}
}
- return TRUE;
+ return true;
}
int dest_bpp = dest_format & 0xff;
int dest_pitch = (dest_bpp * m_Width + 31) / 32 * 4;
uint8_t* dest_buf = FX_TryAlloc(uint8_t, dest_pitch * m_Height + 4);
if (!dest_buf) {
- return FALSE;
+ return false;
}
CFX_DIBitmap* pAlphaMask = nullptr;
if (dest_format == FXDIB_Argb) {
@@ -864,13 +864,13 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) {
pAlphaMask = GetAlphaMask();
if (!pAlphaMask) {
FX_Free(dest_buf);
- return FALSE;
+ return false;
}
} else {
if (!m_pAlphaMask) {
if (!BuildAlphaMask()) {
FX_Free(dest_buf);
- return FALSE;
+ return false;
}
pAlphaMask = m_pAlphaMask;
m_pAlphaMask = nullptr;
@@ -879,7 +879,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) {
}
}
}
- FX_BOOL ret = FALSE;
+ bool ret = false;
std::unique_ptr<uint32_t, FxFreeDeleter> pal_8bpp;
ret = ConvertBuffer(dest_format, dest_buf, dest_pitch, m_Width, m_Height,
this, 0, 0, &pal_8bpp);
@@ -887,7 +887,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) {
if (pAlphaMask != m_pAlphaMask)
delete pAlphaMask;
FX_Free(dest_buf);
- return FALSE;
+ return false;
}
if (m_pAlphaMask && pAlphaMask != m_pAlphaMask)
delete m_pAlphaMask;
@@ -895,10 +895,10 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) {
m_pPalette = std::move(pal_8bpp);
if (!m_bExtBuf)
FX_Free(m_pBuffer);
- m_bExtBuf = FALSE;
+ m_bExtBuf = false;
m_pBuffer = dest_buf;
m_bpp = (uint8_t)dest_format;
m_AlphaFlag = (uint8_t)(dest_format >> 8);
m_Pitch = dest_pitch;
- return TRUE;
+ return true;
}
diff --git a/core/fxge/dib/fx_dib_engine.cpp b/core/fxge/dib/fx_dib_engine.cpp
index 47dcf03259..c004aac538 100644
--- a/core/fxge/dib/fx_dib_engine.cpp
+++ b/core/fxge/dib/fx_dib_engine.cpp
@@ -308,8 +308,7 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap,
m_SrcHeight = pSrcBitmap->GetHeight();
m_SrcPitch = (m_SrcWidth * m_SrcBpp + 31) / 32 * 4;
if ((flags & FXDIB_NOSMOOTH) == 0) {
- FX_BOOL bInterpol =
- flags & FXDIB_INTERPOL || flags & FXDIB_BICUBIC_INTERPOL;
+ bool bInterpol = flags & FXDIB_INTERPOL || flags & FXDIB_BICUBIC_INTERPOL;
if (!bInterpol && FXSYS_abs(dest_width) != 0 &&
FXSYS_abs(dest_height) / 8 < static_cast<long long>(m_SrcWidth) *
m_SrcHeight / FXSYS_abs(dest_width)) {
@@ -382,29 +381,29 @@ CStretchEngine::~CStretchEngine() {
FX_Free(m_pDestMaskScanline);
}
-FX_BOOL CStretchEngine::Continue(IFX_Pause* pPause) {
+bool CStretchEngine::Continue(IFX_Pause* pPause) {
while (m_State == 1) {
if (ContinueStretchHorz(pPause)) {
- return TRUE;
+ return true;
}
m_State = 2;
StretchVert();
}
- return FALSE;
+ return false;
}
-FX_BOOL CStretchEngine::StartStretchHorz() {
+bool CStretchEngine::StartStretchHorz() {
if (m_DestWidth == 0 || m_InterPitch == 0 || !m_pDestScanline)
- return FALSE;
+ return false;
if (m_SrcClip.Height() == 0 ||
m_SrcClip.Height() > (1 << 29) / m_InterPitch) {
- return FALSE;
+ return false;
}
m_pInterBuf = FX_TryAlloc(unsigned char, m_SrcClip.Height() * m_InterPitch);
if (!m_pInterBuf)
- return FALSE;
+ return false;
if (m_pSource && m_bHasAlpha && m_pSource->m_pAlphaMask) {
m_pExtraAlphaBuf =
@@ -412,25 +411,25 @@ FX_BOOL CStretchEngine::StartStretchHorz() {
uint32_t size = (m_DestClip.Width() * 8 + 31) / 32 * 4;
m_pDestMaskScanline = FX_TryAlloc(unsigned char, size);
if (!m_pDestMaskScanline)
- return FALSE;
+ return false;
}
bool ret =
m_WeightTable.Calc(m_DestWidth, m_DestClip.left, m_DestClip.right,
m_SrcWidth, m_SrcClip.left, m_SrcClip.right, m_Flags);
if (!ret)
- return FALSE;
+ return false;
m_CurRow = m_SrcClip.top;
m_State = 1;
- return TRUE;
+ return true;
}
-FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) {
+bool CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) {
if (!m_DestWidth)
- return FALSE;
+ return false;
if (m_pSource->SkipToScanline(m_CurRow, pPause))
- return TRUE;
+ return true;
int Bpp = m_DestBpp / 8;
static const int kStrechPauseRows = 10;
@@ -438,7 +437,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) {
for (; m_CurRow < m_SrcClip.bottom; m_CurRow++) {
if (rows_to_go == 0) {
if (pPause && pPause->NeedToPauseNow())
- return TRUE;
+ return true;
rows_to_go = kStrechPauseRows;
}
@@ -464,7 +463,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) {
int* pWeight =
m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
if (!pWeight)
- return FALSE;
+ return false;
int pixel_weight = *pWeight;
if (src_scan[j / 8] & (1 << (7 - j % 8))) {
@@ -487,7 +486,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) {
int* pWeight =
m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
if (!pWeight)
- return FALSE;
+ return false;
int pixel_weight = *pWeight;
dest_a += pixel_weight * src_scan[j];
@@ -508,7 +507,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) {
int* pWeight =
m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
if (!pWeight)
- return FALSE;
+ return false;
int pixel_weight = *pWeight;
pixel_weight = pixel_weight * src_scan_mask[j] / 255;
@@ -533,7 +532,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) {
int* pWeight =
m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
if (!pWeight)
- return FALSE;
+ return false;
int pixel_weight = *pWeight;
unsigned long argb_cmyk = m_pSrcPalette[src_scan[j]];
@@ -570,7 +569,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) {
int* pWeight =
m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
if (!pWeight)
- return FALSE;
+ return false;
int pixel_weight = *pWeight;
pixel_weight = pixel_weight * src_scan_mask[j] / 255;
@@ -611,7 +610,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) {
int* pWeight =
m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
if (!pWeight)
- return FALSE;
+ return false;
int pixel_weight = *pWeight;
const uint8_t* src_pixel = src_scan + j * Bpp;
@@ -643,7 +642,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) {
int* pWeight =
m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
if (!pWeight)
- return FALSE;
+ return false;
int pixel_weight = *pWeight;
const uint8_t* src_pixel = src_scan + j * Bpp;
@@ -682,7 +681,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) {
}
rows_to_go--;
}
- return FALSE;
+ return false;
}
void CStretchEngine::StretchVert() {
@@ -865,8 +864,8 @@ CFX_ImageStretcher::CFX_ImageStretcher(IFX_ScanlineComposer* pDest,
: m_pDest(pDest),
m_pSource(pSource),
m_Flags(flags),
- m_bFlipX(FALSE),
- m_bFlipY(FALSE),
+ m_bFlipX(false),
+ m_bFlipY(false),
m_DestWidth(dest_width),
m_DestHeight(dest_height),
m_ClipRect(bitmap_rect),
@@ -877,9 +876,9 @@ CFX_ImageStretcher::CFX_ImageStretcher(IFX_ScanlineComposer* pDest,
CFX_ImageStretcher::~CFX_ImageStretcher() {
}
-FX_BOOL CFX_ImageStretcher::Start() {
+bool CFX_ImageStretcher::Start() {
if (m_DestWidth == 0 || m_DestHeight == 0)
- return FALSE;
+ return false;
if (m_pSource->GetFormat() == FXDIB_1bppRgb && m_pSource->GetPalette()) {
FX_ARGB pal[256];
@@ -895,7 +894,7 @@ FX_BOOL CFX_ImageStretcher::Start() {
}
if (!m_pDest->SetInfo(m_ClipRect.Width(), m_ClipRect.Height(), m_DestFormat,
pal)) {
- return FALSE;
+ return false;
}
} else if (m_pSource->GetFormat() == FXDIB_1bppCmyk &&
m_pSource->GetPalette()) {
@@ -912,11 +911,11 @@ FX_BOOL CFX_ImageStretcher::Start() {
}
if (!m_pDest->SetInfo(m_ClipRect.Width(), m_ClipRect.Height(), m_DestFormat,
pal)) {
- return FALSE;
+ return false;
}
} else if (!m_pDest->SetInfo(m_ClipRect.Width(), m_ClipRect.Height(),
m_DestFormat, nullptr)) {
- return FALSE;
+ return false;
}
if (m_Flags & FXDIB_DOWNSAMPLE)
@@ -924,40 +923,40 @@ FX_BOOL CFX_ImageStretcher::Start() {
return StartStretch();
}
-FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause) {
+bool CFX_ImageStretcher::Continue(IFX_Pause* pPause) {
if (m_Flags & FXDIB_DOWNSAMPLE)
return ContinueQuickStretch(pPause);
return ContinueStretch(pPause);
}
-FX_BOOL CFX_ImageStretcher::StartStretch() {
+bool CFX_ImageStretcher::StartStretch() {
m_pStretchEngine = pdfium::MakeUnique<CStretchEngine>(
m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, m_ClipRect, m_pSource,
m_Flags);
m_pStretchEngine->StartStretchHorz();
if (SourceSizeWithinLimit(m_pSource->GetWidth(), m_pSource->GetHeight())) {
m_pStretchEngine->Continue(nullptr);
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) {
+bool CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) {
return m_pStretchEngine && m_pStretchEngine->Continue(pPause);
}
-FX_BOOL CFX_ImageStretcher::StartQuickStretch() {
+bool CFX_ImageStretcher::StartQuickStretch() {
if (m_DestWidth < 0) {
- m_bFlipX = TRUE;
+ m_bFlipX = true;
m_DestWidth = -m_DestWidth;
}
if (m_DestHeight < 0) {
- m_bFlipY = TRUE;
+ m_bFlipY = true;
m_DestHeight = -m_DestHeight;
}
uint32_t size = m_ClipRect.Width();
if (size && m_DestBPP > (int)(INT_MAX / size)) {
- return FALSE;
+ return false;
}
size *= m_DestBPP;
m_pScanline.reset(FX_Alloc(uint8_t, (size / 8 + 3) / 4 * 4));
@@ -966,14 +965,14 @@ FX_BOOL CFX_ImageStretcher::StartQuickStretch() {
if (SourceSizeWithinLimit(m_pSource->GetWidth(), m_pSource->GetHeight())) {
ContinueQuickStretch(nullptr);
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) {
+bool CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) {
if (!m_pScanline)
- return FALSE;
+ return false;
int result_width = m_ClipRect.Width();
int result_height = m_ClipRect.Height();
@@ -992,7 +991,7 @@ FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) {
src_y = std::max(std::min(src_y, src_height - 1), 0);
if (m_pSource->SkipToScanline(src_y, pPause))
- return TRUE;
+ return true;
m_pSource->DownSampleScanline(src_y, m_pScanline.get(), m_DestBPP,
m_DestWidth, m_bFlipX, m_ClipRect.left,
@@ -1004,5 +1003,5 @@ FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) {
}
m_pDest->ComposeScanline(dest_y, m_pScanline.get(), m_pMaskScanline.get());
}
- return FALSE;
+ return false;
}
diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp
index df448a66bd..e593a637af 100644
--- a/core/fxge/dib/fx_dib_main.cpp
+++ b/core/fxge/dib/fx_dib_main.cpp
@@ -55,48 +55,48 @@ uint8_t* CFX_DIBSource::GetBuffer() const {
return nullptr;
}
-FX_BOOL CFX_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const {
- return FALSE;
+bool CFX_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const {
+ return false;
}
CFX_DIBitmap::CFX_DIBitmap() {
- m_bExtBuf = FALSE;
+ m_bExtBuf = false;
m_pBuffer = nullptr;
m_pPalette = nullptr;
}
#define _MAX_OOM_LIMIT_ 12000000
-FX_BOOL CFX_DIBitmap::Create(int width,
- int height,
- FXDIB_Format format,
- uint8_t* pBuffer,
- int pitch) {
+bool CFX_DIBitmap::Create(int width,
+ int height,
+ FXDIB_Format format,
+ uint8_t* pBuffer,
+ int pitch) {
m_pBuffer = nullptr;
m_bpp = (uint8_t)format;
m_AlphaFlag = (uint8_t)(format >> 8);
m_Width = m_Height = m_Pitch = 0;
if (width <= 0 || height <= 0 || pitch < 0) {
- return FALSE;
+ return false;
}
if ((INT_MAX - 31) / width < (format & 0xff)) {
- return FALSE;
+ return false;
}
if (!pitch) {
pitch = (width * (format & 0xff) + 31) / 32 * 4;
}
if ((1 << 30) / pitch < height) {
- return FALSE;
+ return false;
}
if (pBuffer) {
m_pBuffer = pBuffer;
- m_bExtBuf = TRUE;
+ m_bExtBuf = true;
} else {
int size = pitch * height + 4;
int oomlimit = _MAX_OOM_LIMIT_;
if (oomlimit >= 0 && size >= oomlimit) {
m_pBuffer = FX_TryAlloc(uint8_t, size);
if (!m_pBuffer) {
- return FALSE;
+ return false;
}
} else {
m_pBuffer = FX_Alloc(uint8_t, size);
@@ -106,33 +106,33 @@ FX_BOOL CFX_DIBitmap::Create(int width,
m_Height = height;
m_Pitch = pitch;
if (HasAlpha() && format != FXDIB_Argb) {
- FX_BOOL ret = TRUE;
+ bool ret = true;
ret = BuildAlphaMask();
if (!ret) {
if (!m_bExtBuf) {
FX_Free(m_pBuffer);
m_pBuffer = nullptr;
m_Width = m_Height = m_Pitch = 0;
- return FALSE;
+ return false;
}
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_DIBitmap::Copy(const CFX_DIBSource* pSrc) {
+bool CFX_DIBitmap::Copy(const CFX_DIBSource* pSrc) {
if (m_pBuffer) {
- return FALSE;
+ return false;
}
if (!Create(pSrc->GetWidth(), pSrc->GetHeight(), pSrc->GetFormat())) {
- return FALSE;
+ return false;
}
CopyPalette(pSrc->GetPalette());
CopyAlphaMask(pSrc->m_pAlphaMask);
for (int row = 0; row < pSrc->GetHeight(); row++) {
FXSYS_memcpy(m_pBuffer + row * m_Pitch, pSrc->GetScanline(row), m_Pitch);
}
- return TRUE;
+ return true;
}
CFX_DIBitmap::~CFX_DIBitmap() {
@@ -235,19 +235,19 @@ void CFX_DIBSource::BuildPalette() {
}
}
-FX_BOOL CFX_DIBSource::BuildAlphaMask() {
+bool CFX_DIBSource::BuildAlphaMask() {
if (m_pAlphaMask) {
- return TRUE;
+ return true;
}
m_pAlphaMask = new CFX_DIBitmap;
if (!m_pAlphaMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
delete m_pAlphaMask;
m_pAlphaMask = nullptr;
- return FALSE;
+ return false;
}
FXSYS_memset(m_pAlphaMask->GetBuffer(), 0xff,
m_pAlphaMask->GetHeight() * m_pAlphaMask->GetPitch());
- return TRUE;
+ return true;
}
uint32_t CFX_DIBSource::GetPaletteEntry(int index) const {
@@ -397,20 +397,20 @@ void CFX_DIBSource::GetOverlapRect(int& dest_left,
height = dest_rect.bottom - dest_rect.top;
}
-FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left,
- int dest_top,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
+bool CFX_DIBitmap::TransferBitmap(int dest_left,
+ int dest_top,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top) {
if (!m_pBuffer)
- return FALSE;
+ return false;
GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(),
pSrcBitmap->GetHeight(), src_left, src_top, nullptr);
if (width == 0 || height == 0)
- return TRUE;
+ return true;
FXDIB_Format dest_format = GetFormat();
FXDIB_Format src_format = pSrcBitmap->GetFormat();
@@ -442,7 +442,7 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left,
}
} else {
if (m_pPalette)
- return FALSE;
+ return false;
if (m_bpp == 8)
dest_format = FXDIB_8bppMask;
@@ -452,34 +452,34 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left,
std::unique_ptr<uint32_t, FxFreeDeleter> d_plt;
if (!ConvertBuffer(dest_format, dest_buf, m_Pitch, width, height,
pSrcBitmap, src_left, src_top, &d_plt)) {
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_DIBitmap::TransferMask(int dest_left,
- int dest_top,
- int width,
- int height,
- const CFX_DIBSource* pMask,
- uint32_t color,
- int src_left,
- int src_top,
- int alpha_flag,
- void* pIccTransform) {
+bool CFX_DIBitmap::TransferMask(int dest_left,
+ int dest_top,
+ int width,
+ int height,
+ const CFX_DIBSource* pMask,
+ uint32_t color,
+ int src_left,
+ int src_top,
+ int alpha_flag,
+ void* pIccTransform) {
if (!m_pBuffer) {
- return FALSE;
+ return false;
}
ASSERT(HasAlpha() && (m_bpp >= 24));
ASSERT(pMask->IsAlphaMask());
if (!HasAlpha() || !pMask->IsAlphaMask() || m_bpp < 24) {
- return FALSE;
+ return false;
}
GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(),
pMask->GetHeight(), src_left, src_top, nullptr);
if (width == 0 || height == 0) {
- return TRUE;
+ return true;
}
int src_bpp = pMask->GetBPP();
int alpha;
@@ -503,7 +503,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left,
FXSYS_GetYValue(color), FXSYS_GetKValue(color),
color_p[2], color_p[1], color_p[0]);
} else if (!(alpha_flag >> 8) && IsCmykImage()) {
- return FALSE;
+ return false;
}
}
if (!IsCmykImage()) {
@@ -565,7 +565,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left,
}
}
}
- return TRUE;
+ return true;
}
void CFX_DIBSource::CopyPalette(const uint32_t* pSrc) {
@@ -627,10 +627,10 @@ CFX_DIBitmap* CFX_DIBSource::GetAlphaMask(const FX_RECT* pClip) const {
return pMask;
}
-FX_BOOL CFX_DIBSource::CopyAlphaMask(const CFX_DIBSource* pAlphaMask,
- const FX_RECT* pClip) {
+bool CFX_DIBSource::CopyAlphaMask(const CFX_DIBSource* pAlphaMask,
+ const FX_RECT* pClip) {
if (!HasAlpha() || GetFormat() == FXDIB_Argb) {
- return FALSE;
+ return false;
}
if (pAlphaMask) {
FX_RECT rect(0, 0, pAlphaMask->m_Width, pAlphaMask->m_Height);
@@ -638,11 +638,11 @@ FX_BOOL CFX_DIBSource::CopyAlphaMask(const CFX_DIBSource* pAlphaMask,
rect.Intersect(*pClip);
if (rect.IsEmpty() || rect.Width() != m_Width ||
rect.Height() != m_Height) {
- return FALSE;
+ return false;
}
} else {
if (pAlphaMask->m_Width != m_Width || pAlphaMask->m_Height != m_Height) {
- return FALSE;
+ return false;
}
}
for (int row = 0; row < m_Height; row++)
@@ -652,27 +652,27 @@ FX_BOOL CFX_DIBSource::CopyAlphaMask(const CFX_DIBSource* pAlphaMask,
} else {
m_pAlphaMask->Clear(0xff000000);
}
- return TRUE;
+ return true;
}
const int g_ChannelOffset[] = {0, 2, 1, 0, 0, 1, 2, 3, 3};
-FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
- const CFX_DIBSource* pSrcBitmap,
- FXDIB_Channel srcChannel) {
+bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
+ const CFX_DIBSource* pSrcBitmap,
+ FXDIB_Channel srcChannel) {
if (!m_pBuffer) {
- return FALSE;
+ return false;
}
CFX_DIBSource* pSrcClone = (CFX_DIBSource*)pSrcBitmap;
CFX_DIBitmap* pDst = this;
int destOffset, srcOffset;
if (srcChannel == FXDIB_Alpha) {
if (!pSrcBitmap->HasAlpha() && !pSrcBitmap->IsAlphaMask()) {
- return FALSE;
+ return false;
}
if (pSrcBitmap->GetBPP() == 1) {
pSrcClone = pSrcBitmap->CloneConvert(FXDIB_8bppMask);
if (!pSrcClone) {
- return FALSE;
+ return false;
}
}
if (pSrcBitmap->GetFormat() == FXDIB_Argb) {
@@ -682,7 +682,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
}
} else {
if (pSrcBitmap->IsAlphaMask()) {
- return FALSE;
+ return false;
}
if (pSrcBitmap->GetBPP() < 24) {
if (pSrcBitmap->IsCmykImage()) {
@@ -693,7 +693,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
(FXDIB_Format)((pSrcBitmap->GetFormat() & 0xff00) | 0x18));
}
if (!pSrcClone) {
- return FALSE;
+ return false;
}
}
srcOffset = g_ChannelOffset[srcChannel];
@@ -704,7 +704,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
if (pSrcClone != pSrcBitmap) {
delete pSrcClone;
}
- return FALSE;
+ return false;
}
destOffset = 0;
} else {
@@ -713,7 +713,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
if (pSrcClone != pSrcBitmap) {
delete pSrcClone;
}
- return FALSE;
+ return false;
}
if (GetFormat() == FXDIB_Argb) {
destOffset = 3;
@@ -724,7 +724,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
if (pSrcClone != pSrcBitmap) {
delete pSrcClone;
}
- return FALSE;
+ return false;
}
if (GetBPP() < 24) {
if (HasAlpha()) {
@@ -732,7 +732,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
if (pSrcClone != pSrcBitmap) {
delete pSrcClone;
}
- return FALSE;
+ return false;
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
} else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb32)) {
@@ -742,7 +742,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
if (pSrcClone != pSrcBitmap) {
delete pSrcClone;
}
- return FALSE;
+ return false;
}
}
destOffset = g_ChannelOffset[destChannel];
@@ -757,7 +757,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
if (pSrcClone != pSrcBitmap) {
delete pSrcClone;
}
- return FALSE;
+ return false;
}
}
}
@@ -774,7 +774,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
delete pSrcClone;
}
if (!pSrcMatched) {
- return FALSE;
+ return false;
}
pSrcClone = pSrcMatched;
}
@@ -796,24 +796,24 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
if (pSrcClone != pSrcBitmap && pSrcClone != pSrcBitmap->m_pAlphaMask) {
delete pSrcClone;
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) {
+bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) {
if (!m_pBuffer) {
- return FALSE;
+ return false;
}
int destOffset;
if (destChannel == FXDIB_Alpha) {
if (IsAlphaMask()) {
if (!ConvertFormat(FXDIB_8bppMask)) {
- return FALSE;
+ return false;
}
destOffset = 0;
} else {
destOffset = 0;
if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyka : FXDIB_Argb)) {
- return FALSE;
+ return false;
}
if (GetFormat() == FXDIB_Argb) {
destOffset = 3;
@@ -821,19 +821,19 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) {
}
} else {
if (IsAlphaMask()) {
- return FALSE;
+ return false;
}
if (GetBPP() < 24) {
if (HasAlpha()) {
if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyka : FXDIB_Argb)) {
- return FALSE;
+ return false;
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
} else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb)) {
#else
} else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb32)) {
#endif
- return FALSE;
+ return false;
}
}
destOffset = g_ChannelOffset[destChannel];
@@ -841,12 +841,12 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) {
int Bpp = GetBPP() / 8;
if (Bpp == 1) {
FXSYS_memset(m_pBuffer, value, m_Height * m_Pitch);
- return TRUE;
+ return true;
}
if (destChannel == FXDIB_Alpha && m_pAlphaMask) {
FXSYS_memset(m_pAlphaMask->GetBuffer(), value,
m_pAlphaMask->GetHeight() * m_pAlphaMask->GetPitch());
- return TRUE;
+ return true;
}
for (int row = 0; row < m_Height; row++) {
uint8_t* scan_line = m_pBuffer + row * m_Pitch + destOffset;
@@ -855,16 +855,16 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) {
scan_line += Bpp;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) {
+bool CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) {
if (!m_pBuffer) {
- return FALSE;
+ return false;
}
ASSERT(pSrcBitmap->IsAlphaMask());
if (!pSrcBitmap->IsAlphaMask()) {
- return FALSE;
+ return false;
}
if (!IsAlphaMask() && !HasAlpha()) {
return LoadChannel(FXDIB_Alpha, pSrcBitmap, FXDIB_Alpha);
@@ -874,7 +874,7 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) {
pSrcBitmap->GetHeight() != m_Height) {
pSrcClone = pSrcBitmap->StretchTo(m_Width, m_Height);
if (!pSrcClone) {
- return FALSE;
+ return false;
}
}
if (IsAlphaMask()) {
@@ -882,7 +882,7 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) {
if (pSrcClone != pSrcBitmap) {
delete pSrcClone;
}
- return FALSE;
+ return false;
}
for (int row = 0; row < m_Height; row++) {
uint8_t* dest_scan = m_pBuffer + m_Pitch * row;
@@ -906,7 +906,7 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) {
if (pSrcClone != pSrcBitmap) {
delete pSrcClone;
}
- return FALSE;
+ return false;
}
for (int row = 0; row < m_Height; row++) {
uint8_t* dest_scan = m_pBuffer + m_Pitch * row + 3;
@@ -923,17 +923,17 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) {
if (pSrcClone != pSrcBitmap) {
delete pSrcClone;
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) {
+bool CFX_DIBitmap::GetGrayData(void* pIccTransform) {
if (!m_pBuffer) {
- return FALSE;
+ return false;
}
switch (GetFormat()) {
case FXDIB_1bppRgb: {
if (!m_pPalette) {
- return FALSE;
+ return false;
}
uint8_t gray[2];
for (int i = 0; i < 2; i++) {
@@ -945,7 +945,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) {
CFX_DIBitmap* pMask = new CFX_DIBitmap;
if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
delete pMask;
- return FALSE;
+ return false;
}
FXSYS_memset(pMask->GetBuffer(), gray[0], pMask->GetPitch() * m_Height);
for (int row = 0; row < m_Height; row++) {
@@ -964,7 +964,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) {
}
case FXDIB_8bppRgb: {
if (!m_pPalette) {
- return FALSE;
+ return false;
}
uint8_t gray[256];
for (int i = 0; i < 256; i++) {
@@ -976,7 +976,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) {
CFX_DIBitmap* pMask = new CFX_DIBitmap;
if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
delete pMask;
- return FALSE;
+ return false;
}
for (int row = 0; row < m_Height; row++) {
uint8_t* dest_pos = pMask->GetBuffer() + row * pMask->GetPitch();
@@ -993,7 +993,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) {
CFX_DIBitmap* pMask = new CFX_DIBitmap;
if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
delete pMask;
- return FALSE;
+ return false;
}
for (int row = 0; row < m_Height; row++) {
uint8_t* src_pos = m_pBuffer + row * m_Pitch;
@@ -1011,7 +1011,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) {
CFX_DIBitmap* pMask = new CFX_DIBitmap;
if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
delete pMask;
- return FALSE;
+ return false;
}
for (int row = 0; row < m_Height; row++) {
uint8_t* src_pos = m_pBuffer + row * m_Pitch;
@@ -1026,19 +1026,19 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) {
break;
}
default:
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_DIBitmap::MultiplyAlpha(int alpha) {
+bool CFX_DIBitmap::MultiplyAlpha(int alpha) {
if (!m_pBuffer) {
- return FALSE;
+ return false;
}
switch (GetFormat()) {
case FXDIB_1bppMask:
if (!ConvertFormat(FXDIB_8bppMask)) {
- return FALSE;
+ return false;
}
MultiplyAlpha(alpha);
break;
@@ -1066,18 +1066,18 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(int alpha) {
m_pAlphaMask->MultiplyAlpha(alpha);
} else if (IsCmykImage()) {
if (!ConvertFormat((FXDIB_Format)(GetFormat() | 0x0200))) {
- return FALSE;
+ return false;
}
m_pAlphaMask->MultiplyAlpha(alpha);
} else {
if (!ConvertFormat(FXDIB_Argb)) {
- return FALSE;
+ return false;
}
MultiplyAlpha(alpha);
}
break;
}
- return TRUE;
+ return true;
}
uint32_t CFX_DIBitmap::GetPixel(int x, int y) const {
@@ -1189,7 +1189,7 @@ void CFX_DIBitmap::DownSampleScanline(int line,
uint8_t* dest_scan,
int dest_bpp,
int dest_width,
- FX_BOOL bFlipX,
+ bool bFlipX,
int clip_left,
int clip_width) const {
if (!m_pBuffer) {
@@ -1252,11 +1252,10 @@ void CFX_DIBitmap::DownSampleScanline(int line,
// TODO(weili): Split this function into two for handling CMYK and RGB
// colors separately.
-FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor,
- uint32_t backcolor) {
+bool CFX_DIBitmap::ConvertColorScale(uint32_t forecolor, uint32_t backcolor) {
ASSERT(!IsAlphaMask());
if (!m_pBuffer || IsAlphaMask()) {
- return FALSE;
+ return false;
}
// Values used for CMYK colors.
int fc = 0;
@@ -1274,7 +1273,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor,
int br = 0;
int bg = 0;
int bb = 0;
- FX_BOOL isCmykImage = IsCmykImage();
+ bool isCmykImage = IsCmykImage();
if (isCmykImage) {
fc = FXSYS_GetCValue(forecolor);
fm = FXSYS_GetMValue(forecolor);
@@ -1295,10 +1294,10 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor,
if (m_bpp <= 8) {
if (isCmykImage) {
if (forecolor == 0xff && backcolor == 0 && !m_pPalette) {
- return TRUE;
+ return true;
}
} else if (forecolor == 0 && backcolor == 0xffffff && !m_pPalette) {
- return TRUE;
+ return true;
}
if (!m_pPalette) {
BuildPalette();
@@ -1326,7 +1325,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor,
bb + (fb - bb) * gray / 255);
}
}
- return TRUE;
+ return true;
}
if (isCmykImage) {
if (forecolor == 0xff && backcolor == 0x00) {
@@ -1342,7 +1341,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor,
*scanline++ = 255 - FXRGB2GRAY(r, g, b);
}
}
- return TRUE;
+ return true;
}
} else if (forecolor == 0 && backcolor == 0xffffff) {
for (int row = 0; row < m_Height; row++) {
@@ -1356,7 +1355,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor,
scanline += gap;
}
}
- return TRUE;
+ return true;
}
if (isCmykImage) {
for (int row = 0; row < m_Height; row++) {
@@ -1385,10 +1384,10 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor,
}
}
}
- return TRUE;
+ return true;
}
-CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const {
+CFX_DIBitmap* CFX_DIBSource::FlipImage(bool bXFlip, bool bYFlip) const {
CFX_DIBitmap* pFlipped = new CFX_DIBitmap;
if (!pFlipped->Create(m_Width, m_Height, GetFormat())) {
delete pFlipped;
@@ -1485,7 +1484,7 @@ CFX_FilteredDIB::~CFX_FilteredDIB() {
}
}
-void CFX_FilteredDIB::LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc) {
+void CFX_FilteredDIB::LoadSrc(const CFX_DIBSource* pSrc, bool bAutoDropSrc) {
m_pSrc = pSrc;
m_bAutoDropSrc = bAutoDropSrc;
m_Width = pSrc->GetWidth();
@@ -1507,7 +1506,7 @@ void CFX_FilteredDIB::DownSampleScanline(int line,
uint8_t* dest_scan,
int dest_bpp,
int dest_width,
- FX_BOOL bFlipX,
+ bool bFlipX,
int clip_left,
int clip_width) const {
m_pSrc->DownSampleScanline(line, dest_scan, dest_bpp, dest_width, bFlipX,
@@ -1517,23 +1516,23 @@ void CFX_FilteredDIB::DownSampleScanline(int line,
CFX_ImageRenderer::CFX_ImageRenderer() {
m_Status = 0;
- m_bRgbByteOrder = FALSE;
+ m_bRgbByteOrder = false;
m_BlendType = FXDIB_BLEND_NORMAL;
}
CFX_ImageRenderer::~CFX_ImageRenderer() {}
-FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice,
- const CFX_ClipRgn* pClipRgn,
- const CFX_DIBSource* pSource,
- int bitmap_alpha,
- uint32_t mask_color,
- const CFX_Matrix* pMatrix,
- uint32_t dib_flags,
- FX_BOOL bRgbByteOrder,
- int alpha_flag,
- void* pIccTransform,
- int blend_type) {
+bool CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice,
+ const CFX_ClipRgn* pClipRgn,
+ const CFX_DIBSource* pSource,
+ int bitmap_alpha,
+ uint32_t mask_color,
+ const CFX_Matrix* pMatrix,
+ uint32_t dib_flags,
+ bool bRgbByteOrder,
+ int alpha_flag,
+ void* pIccTransform,
+ int blend_type) {
m_Matrix = *pMatrix;
CFX_FloatRect image_rect_f = m_Matrix.GetUnitRect();
FX_RECT image_rect = image_rect_f.GetOuterRect();
@@ -1541,7 +1540,7 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice,
pDevice->GetHeight());
m_ClipBox.Intersect(image_rect);
if (m_ClipBox.IsEmpty())
- return FALSE;
+ return false;
m_pDevice = pDevice;
m_pClipRgn = pClipRgn;
@@ -1566,22 +1565,22 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice,
bitmap_clip = FXDIB_SwapClipBox(bitmap_clip, dest_width, dest_height,
m_Matrix.c > 0, m_Matrix.b < 0);
m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox,
- TRUE, m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder,
+ true, m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder,
alpha_flag, pIccTransform, m_BlendType);
m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
&m_Composer, pSource, dest_height, dest_width, bitmap_clip,
dib_flags);
if (!m_Stretcher->Start())
- return FALSE;
+ return false;
m_Status = 1;
- return TRUE;
+ return true;
}
m_Status = 2;
m_pTransformer.reset(
new CFX_ImageTransformer(pSource, &m_Matrix, dib_flags, &m_ClipBox));
m_pTransformer->Start();
- return TRUE;
+ return true;
}
int dest_width = image_rect.Width();
@@ -1593,12 +1592,12 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice,
dest_height = -dest_height;
if (dest_width == 0 || dest_height == 0)
- return FALSE;
+ return false;
FX_RECT bitmap_clip = m_ClipBox;
bitmap_clip.Offset(-image_rect.left, -image_rect.top);
m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox,
- FALSE, FALSE, FALSE, m_bRgbByteOrder, alpha_flag,
+ false, false, false, m_bRgbByteOrder, alpha_flag,
pIccTransform, m_BlendType);
m_Status = 1;
m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
@@ -1606,17 +1605,17 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice,
return m_Stretcher->Start();
}
-FX_BOOL CFX_ImageRenderer::Continue(IFX_Pause* pPause) {
+bool CFX_ImageRenderer::Continue(IFX_Pause* pPause) {
if (m_Status == 1)
return m_Stretcher->Continue(pPause);
if (m_Status == 2) {
if (m_pTransformer->Continue(pPause))
- return TRUE;
+ return true;
std::unique_ptr<CFX_DIBitmap> pBitmap(m_pTransformer->DetachBitmap());
if (!pBitmap || !pBitmap->GetBuffer())
- return FALSE;
+ return false;
if (pBitmap->IsAlphaMask()) {
if (m_BitmapAlpha != 255) {
@@ -1641,9 +1640,9 @@ FX_BOOL CFX_ImageRenderer::Continue(IFX_Pause* pPause) {
pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap.get(), 0, 0,
m_BlendType, m_pClipRgn, m_bRgbByteOrder, m_pIccTransform);
}
- return FALSE;
+ return false;
}
- return FALSE;
+ return false;
}
CFX_BitmapStorer::CFX_BitmapStorer() {
@@ -1677,16 +1676,16 @@ void CFX_BitmapStorer::ComposeScanline(int line,
}
}
-FX_BOOL CFX_BitmapStorer::SetInfo(int width,
- int height,
- FXDIB_Format src_format,
- uint32_t* pSrcPalette) {
+bool CFX_BitmapStorer::SetInfo(int width,
+ int height,
+ FXDIB_Format src_format,
+ uint32_t* pSrcPalette) {
m_pBitmap = pdfium::MakeUnique<CFX_DIBitmap>();
if (!m_pBitmap->Create(width, height, src_format)) {
m_pBitmap.reset();
- return FALSE;
+ return false;
}
if (pSrcPalette)
m_pBitmap->CopyPalette(pSrcPalette);
- return TRUE;
+ return true;
}
diff --git a/core/fxge/dib/fx_dib_transform.cpp b/core/fxge/dib/fx_dib_transform.cpp
index 559c6e2a38..e2b95237d5 100644
--- a/core/fxge/dib/fx_dib_transform.cpp
+++ b/core/fxge/dib/fx_dib_transform.cpp
@@ -175,8 +175,8 @@ class CFX_BilinearMatrix : public CPDF_FixedMatrix {
y1 /= base;
}
};
-CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip,
- FX_BOOL bYFlip,
+CFX_DIBitmap* CFX_DIBSource::SwapXY(bool bXFlip,
+ bool bYFlip,
const FX_RECT* pDestClip) const {
FX_RECT dest_clip(0, 0, m_Height, m_Width);
if (pDestClip) {
@@ -277,8 +277,8 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip,
FX_RECT FXDIB_SwapClipBox(FX_RECT& clip,
int width,
int height,
- FX_BOOL bFlipX,
- FX_BOOL bFlipY) {
+ bool bFlipX,
+ bool bFlipY) {
FX_RECT rect;
if (bFlipY) {
rect.left = height - clip.top;
@@ -345,7 +345,7 @@ CFX_ImageTransformer::CFX_ImageTransformer(const CFX_DIBSource* pSrc,
CFX_ImageTransformer::~CFX_ImageTransformer() {}
-FX_BOOL CFX_ImageTransformer::Start() {
+bool CFX_ImageTransformer::Start() {
CFX_FloatRect unit_rect = m_pMatrix->GetUnitRect();
FX_RECT result_rect = unit_rect.GetClosestRect();
FX_RECT result_clip = result_rect;
@@ -353,7 +353,7 @@ FX_BOOL CFX_ImageTransformer::Start() {
result_clip.Intersect(*m_pClip);
if (result_clip.IsEmpty())
- return FALSE;
+ return false;
m_result = result_clip;
if (FXSYS_fabs(m_pMatrix->a) < FXSYS_fabs(m_pMatrix->b) / 20 &&
@@ -368,7 +368,7 @@ FX_BOOL CFX_ImageTransformer::Start() {
&m_Storer, m_pSrc, dest_height, dest_width, result_clip, m_Flags);
m_Stretcher->Start();
m_Status = 1;
- return TRUE;
+ return true;
}
if (FXSYS_fabs(m_pMatrix->b) < FIX16_005 &&
FXSYS_fabs(m_pMatrix->c) < FIX16_005) {
@@ -381,7 +381,7 @@ FX_BOOL CFX_ImageTransformer::Start() {
&m_Storer, m_pSrc, dest_width, dest_height, result_clip, m_Flags);
m_Stretcher->Start();
m_Status = 2;
- return TRUE;
+ return true;
}
int stretch_width = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->a, m_pMatrix->b));
int stretch_height = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->c, m_pMatrix->d));
@@ -400,35 +400,35 @@ FX_BOOL CFX_ImageTransformer::Start() {
&m_Storer, m_pSrc, stretch_width, stretch_height, m_StretchClip, m_Flags);
m_Stretcher->Start();
m_Status = 3;
- return TRUE;
+ return true;
}
-FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) {
+bool CFX_ImageTransformer::Continue(IFX_Pause* pPause) {
if (m_Status == 1) {
if (m_Stretcher->Continue(pPause))
- return TRUE;
+ return true;
if (m_Storer.GetBitmap()) {
std::unique_ptr<CFX_DIBitmap> swapped(
m_Storer.GetBitmap()->SwapXY(m_pMatrix->c > 0, m_pMatrix->b < 0));
m_Storer.Replace(std::move(swapped));
}
- return FALSE;
+ return false;
}
if (m_Status == 2)
return m_Stretcher->Continue(pPause);
if (m_Status != 3)
- return FALSE;
+ return false;
if (m_Stretcher->Continue(pPause))
- return TRUE;
+ return true;
int stretch_width = m_StretchClip.Width();
int stretch_height = m_StretchClip.Height();
if (!m_Storer.GetBitmap())
- return FALSE;
+ return false;
const uint8_t* stretch_buf = m_Storer.GetBitmap()->GetBuffer();
const uint8_t* stretch_buf_mask = nullptr;
@@ -439,7 +439,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) {
std::unique_ptr<CFX_DIBitmap> pTransformed(new CFX_DIBitmap);
FXDIB_Format transformF = GetTransformedFormat(m_Stretcher->source());
if (!pTransformed->Create(m_result.Width(), m_result.Height(), transformF))
- return FALSE;
+ return false;
pTransformed->Clear(0);
if (pTransformed->m_pAlphaMask)
@@ -749,7 +749,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) {
}
}
} else {
- FX_BOOL bHasAlpha = m_Storer.GetBitmap()->HasAlpha();
+ bool bHasAlpha = m_Storer.GetBitmap()->HasAlpha();
int destBpp = pTransformed->GetBPP() / 8;
if (!(m_Flags & FXDIB_DOWNSAMPLE) &&
!(m_Flags & FXDIB_BICUBIC_INTERPOL)) {
@@ -947,7 +947,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) {
}
}
m_Storer.Replace(std::move(pTransformed));
- return FALSE;
+ return false;
}
std::unique_ptr<CFX_DIBitmap> CFX_ImageTransformer::DetachBitmap() {
diff --git a/core/fxge/fx_dib.h b/core/fxge/fx_dib.h
index 6ffad8c8c9..c42c964bde 100644
--- a/core/fxge/fx_dib.h
+++ b/core/fxge/fx_dib.h
@@ -158,15 +158,15 @@ FX_ARGB ArgbEncode(int a, FX_COLORREF rgb);
#define FXGETFLAG_COLORTYPE(flag) (uint8_t)((flag) >> 8)
#define FXGETFLAG_ALPHA_FILL(flag) (uint8_t)(flag)
-FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
- uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top,
- std::unique_ptr<uint32_t, FxFreeDeleter>* pal);
+bool ConvertBuffer(FXDIB_Format dest_format,
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top,
+ std::unique_ptr<uint32_t, FxFreeDeleter>* pal);
class CFX_DIBSource {
public:
@@ -174,12 +174,12 @@ class CFX_DIBSource {
virtual uint8_t* GetBuffer() const;
virtual const uint8_t* GetScanline(int line) const = 0;
- virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const;
+ virtual bool SkipToScanline(int line, IFX_Pause* pPause) const;
virtual void DownSampleScanline(int line,
uint8_t* dest_scan,
int dest_bpp,
int dest_width,
- FX_BOOL bFlipX,
+ bool bFlipX,
int clip_left,
int clip_width) const = 0;
@@ -195,7 +195,7 @@ class CFX_DIBSource {
// TODO(thestig): Investigate this. Given the possible values of FXDIB_Format,
// it feels as though this should be implemented as !!(m_AlphaFlag & 1) and
- // IsOpaqueImage() below should never be able to return TRUE.
+ // IsOpaqueImage() below should never be able to return true.
bool IsAlphaMask() const { return m_AlphaFlag == 1; }
bool HasAlpha() const { return !!(m_AlphaFlag & 2); }
bool IsOpaqueImage() const { return !(m_AlphaFlag & 3); }
@@ -229,14 +229,14 @@ class CFX_DIBSource {
const FX_RECT* pClip = nullptr) const;
CFX_DIBitmap* GetAlphaMask(const FX_RECT* pClip = nullptr) const;
- FX_BOOL CopyAlphaMask(const CFX_DIBSource* pAlphaMask,
- const FX_RECT* pClip = nullptr);
+ bool CopyAlphaMask(const CFX_DIBSource* pAlphaMask,
+ const FX_RECT* pClip = nullptr);
- CFX_DIBitmap* SwapXY(FX_BOOL bXFlip,
- FX_BOOL bYFlip,
+ CFX_DIBitmap* SwapXY(bool bXFlip,
+ bool bYFlip,
const FX_RECT* pClip = nullptr) const;
- CFX_DIBitmap* FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const;
+ CFX_DIBitmap* FlipImage(bool bXFlip, bool bYFlip) const;
void GetOverlapRect(int& dest_left,
int& dest_top,
@@ -258,7 +258,7 @@ class CFX_DIBSource {
CFX_DIBSource();
void BuildPalette();
- FX_BOOL BuildAlphaMask();
+ bool BuildAlphaMask();
int FindPalette(uint32_t color) const;
void GetPalette(uint32_t* pal, int alpha) const;
@@ -277,13 +277,13 @@ class CFX_DIBitmap : public CFX_DIBSource {
explicit CFX_DIBitmap(const CFX_DIBitmap& src);
~CFX_DIBitmap() override;
- FX_BOOL Create(int width,
- int height,
- FXDIB_Format format,
- uint8_t* pBuffer = nullptr,
- int pitch = 0);
+ bool Create(int width,
+ int height,
+ FXDIB_Format format,
+ uint8_t* pBuffer = nullptr,
+ int pitch = 0);
- FX_BOOL Copy(const CFX_DIBSource* pSrc);
+ bool Copy(const CFX_DIBSource* pSrc);
// CFX_DIBSource
uint8_t* GetBuffer() const override;
@@ -292,13 +292,13 @@ class CFX_DIBitmap : public CFX_DIBSource {
uint8_t* dest_scan,
int dest_bpp,
int dest_width,
- FX_BOOL bFlipX,
+ bool bFlipX,
int clip_left,
int clip_width) const override;
void TakeOver(CFX_DIBitmap* pSrcBitmap);
- FX_BOOL ConvertFormat(FXDIB_Format format);
+ bool ConvertFormat(FXDIB_Format format);
void Clear(uint32_t color);
@@ -306,76 +306,76 @@ class CFX_DIBitmap : public CFX_DIBSource {
void SetPixel(int x, int y, uint32_t color);
- FX_BOOL LoadChannel(FXDIB_Channel destChannel,
+ bool LoadChannel(FXDIB_Channel destChannel,
+ const CFX_DIBSource* pSrcBitmap,
+ FXDIB_Channel srcChannel);
+
+ bool LoadChannel(FXDIB_Channel destChannel, int value);
+
+ bool MultiplyAlpha(int alpha);
+
+ bool MultiplyAlpha(const CFX_DIBSource* pAlphaMask);
+
+ bool TransferBitmap(int dest_left,
+ int dest_top,
+ int width,
+ int height,
const CFX_DIBSource* pSrcBitmap,
- FXDIB_Channel srcChannel);
-
- FX_BOOL LoadChannel(FXDIB_Channel destChannel, int value);
-
- FX_BOOL MultiplyAlpha(int alpha);
-
- FX_BOOL MultiplyAlpha(const CFX_DIBSource* pAlphaMask);
-
- FX_BOOL TransferBitmap(int dest_left,
- int dest_top,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top);
-
- FX_BOOL CompositeBitmap(int dest_left,
- int dest_top,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top,
- int blend_type = FXDIB_BLEND_NORMAL,
- const CFX_ClipRgn* pClipRgn = nullptr,
- FX_BOOL bRgbByteOrder = FALSE,
- void* pIccTransform = nullptr);
-
- FX_BOOL TransferMask(int dest_left,
+ int src_left,
+ int src_top);
+
+ bool CompositeBitmap(int dest_left,
int dest_top,
int width,
int height,
- const CFX_DIBSource* pMask,
- uint32_t color,
+ const CFX_DIBSource* pSrcBitmap,
int src_left,
int src_top,
- int alpha_flag = 0,
+ int blend_type = FXDIB_BLEND_NORMAL,
+ const CFX_ClipRgn* pClipRgn = nullptr,
+ bool bRgbByteOrder = false,
void* pIccTransform = nullptr);
- FX_BOOL CompositeMask(int dest_left,
- int dest_top,
- int width,
- int height,
- const CFX_DIBSource* pMask,
- uint32_t color,
- int src_left,
- int src_top,
- int blend_type = FXDIB_BLEND_NORMAL,
- const CFX_ClipRgn* pClipRgn = nullptr,
- FX_BOOL bRgbByteOrder = FALSE,
- int alpha_flag = 0,
- void* pIccTransform = nullptr);
-
- FX_BOOL CompositeRect(int dest_left,
- int dest_top,
- int width,
- int height,
- uint32_t color,
- int alpha_flag = 0,
- void* pIccTransform = nullptr);
-
- FX_BOOL ConvertColorScale(uint32_t forecolor, uint32_t backcolor);
+ bool TransferMask(int dest_left,
+ int dest_top,
+ int width,
+ int height,
+ const CFX_DIBSource* pMask,
+ uint32_t color,
+ int src_left,
+ int src_top,
+ int alpha_flag = 0,
+ void* pIccTransform = nullptr);
+
+ bool CompositeMask(int dest_left,
+ int dest_top,
+ int width,
+ int height,
+ const CFX_DIBSource* pMask,
+ uint32_t color,
+ int src_left,
+ int src_top,
+ int blend_type = FXDIB_BLEND_NORMAL,
+ const CFX_ClipRgn* pClipRgn = nullptr,
+ bool bRgbByteOrder = false,
+ int alpha_flag = 0,
+ void* pIccTransform = nullptr);
+
+ bool CompositeRect(int dest_left,
+ int dest_top,
+ int width,
+ int height,
+ uint32_t color,
+ int alpha_flag = 0,
+ void* pIccTransform = nullptr);
+
+ bool ConvertColorScale(uint32_t forecolor, uint32_t backcolor);
protected:
- FX_BOOL GetGrayData(void* pIccTransform = nullptr);
+ bool GetGrayData(void* pIccTransform = nullptr);
uint8_t* m_pBuffer;
- FX_BOOL m_bExtBuf;
+ bool m_bExtBuf;
};
class CFX_DIBExtractor {
@@ -396,7 +396,7 @@ class CFX_FilteredDIB : public CFX_DIBSource {
CFX_FilteredDIB();
~CFX_FilteredDIB() override;
- void LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc = FALSE);
+ void LoadSrc(const CFX_DIBSource* pSrc, bool bAutoDropSrc = false);
virtual FXDIB_Format GetDestFormat() = 0;
@@ -417,12 +417,12 @@ class CFX_FilteredDIB : public CFX_DIBSource {
uint8_t* dest_scan,
int dest_bpp,
int dest_width,
- FX_BOOL bFlipX,
+ bool bFlipX,
int clip_left,
int clip_width) const override;
const CFX_DIBSource* m_pSrc;
- FX_BOOL m_bAutoDropSrc;
+ bool m_bAutoDropSrc;
mutable std::vector<uint8_t> m_Scanline;
};
@@ -434,10 +434,10 @@ class IFX_ScanlineComposer {
const uint8_t* scanline,
const uint8_t* scan_extra_alpha = nullptr) = 0;
- virtual FX_BOOL SetInfo(int width,
- int height,
- FXDIB_Format src_format,
- uint32_t* pSrcPalette) = 0;
+ virtual bool SetInfo(int width,
+ int height,
+ FXDIB_Format src_format,
+ uint32_t* pSrcPalette) = 0;
};
class CFX_ScanlineCompositor {
@@ -446,16 +446,16 @@ class CFX_ScanlineCompositor {
~CFX_ScanlineCompositor();
- FX_BOOL Init(FXDIB_Format dest_format,
- FXDIB_Format src_format,
- int32_t width,
- uint32_t* pSrcPalette,
- uint32_t mask_color,
- int blend_type,
- FX_BOOL bClip,
- FX_BOOL bRgbByteOrder = FALSE,
- int alpha_flag = 0,
- void* pIccTransform = nullptr);
+ bool Init(FXDIB_Format dest_format,
+ FXDIB_Format src_format,
+ int32_t width,
+ uint32_t* pSrcPalette,
+ uint32_t mask_color,
+ int blend_type,
+ bool bClip,
+ bool bRgbByteOrder = false,
+ int alpha_flag = 0,
+ void* pIccTransform = nullptr);
void CompositeRgbBitmapLine(uint8_t* dest_scan,
const uint8_t* src_scan,
@@ -495,7 +495,7 @@ class CFX_ScanlineCompositor {
void* m_pIccTransform;
uint8_t* m_pCacheScanline;
int m_CacheSize;
- FX_BOOL m_bRgbByteOrder;
+ bool m_bRgbByteOrder;
};
class CFX_BitmapComposer : public IFX_ScanlineComposer {
@@ -508,19 +508,19 @@ class CFX_BitmapComposer : public IFX_ScanlineComposer {
int bitmap_alpha,
uint32_t mask_color,
FX_RECT& dest_rect,
- FX_BOOL bVertical,
- FX_BOOL bFlipX,
- FX_BOOL bFlipY,
- FX_BOOL bRgbByteOrder = FALSE,
+ bool bVertical,
+ bool bFlipX,
+ bool bFlipY,
+ bool bRgbByteOrder = false,
int alpha_flag = 0,
void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL);
// IFX_ScanlineComposer
- FX_BOOL SetInfo(int width,
- int height,
- FXDIB_Format src_format,
- uint32_t* pSrcPalette) override;
+ bool SetInfo(int width,
+ int height,
+ FXDIB_Format src_format,
+ uint32_t* pSrcPalette) override;
void ComposeScanline(int line,
const uint8_t* scanline,
@@ -540,10 +540,10 @@ class CFX_BitmapComposer : public IFX_ScanlineComposer {
uint32_t m_MaskColor;
const CFX_DIBitmap* m_pClipMask;
CFX_ScanlineCompositor m_Compositor;
- FX_BOOL m_bVertical, m_bFlipX, m_bFlipY;
+ bool m_bVertical, m_bFlipX, m_bFlipY;
int m_AlphaFlag;
void* m_pIccTransform;
- FX_BOOL m_bRgbByteOrder;
+ bool m_bRgbByteOrder;
int m_BlendType;
void ComposeScanlineV(int line,
const uint8_t* scanline,
@@ -563,10 +563,10 @@ class CFX_BitmapStorer : public IFX_ScanlineComposer {
void ComposeScanline(int line,
const uint8_t* scanline,
const uint8_t* scan_extra_alpha) override;
- FX_BOOL SetInfo(int width,
- int height,
- FXDIB_Format src_format,
- uint32_t* pSrcPalette) override;
+ bool SetInfo(int width,
+ int height,
+ FXDIB_Format src_format,
+ uint32_t* pSrcPalette) override;
CFX_DIBitmap* GetBitmap() { return m_pBitmap.get(); }
std::unique_ptr<CFX_DIBitmap> Detach();
@@ -586,16 +586,16 @@ class CFX_ImageStretcher {
uint32_t flags);
~CFX_ImageStretcher();
- FX_BOOL Start();
- FX_BOOL Continue(IFX_Pause* pPause);
+ bool Start();
+ bool Continue(IFX_Pause* pPause);
const CFX_DIBSource* source() { return m_pSource; }
private:
- FX_BOOL StartQuickStretch();
- FX_BOOL StartStretch();
- FX_BOOL ContinueQuickStretch(IFX_Pause* pPause);
- FX_BOOL ContinueStretch(IFX_Pause* pPause);
+ bool StartQuickStretch();
+ bool StartStretch();
+ bool ContinueQuickStretch(IFX_Pause* pPause);
+ bool ContinueStretch(IFX_Pause* pPause);
IFX_ScanlineComposer* const m_pDest;
const CFX_DIBSource* const m_pSource;
@@ -603,8 +603,8 @@ class CFX_ImageStretcher {
std::unique_ptr<uint8_t, FxFreeDeleter> m_pScanline;
std::unique_ptr<uint8_t, FxFreeDeleter> m_pMaskScanline;
const uint32_t m_Flags;
- FX_BOOL m_bFlipX;
- FX_BOOL m_bFlipY;
+ bool m_bFlipX;
+ bool m_bFlipY;
int m_DestWidth;
int m_DestHeight;
FX_RECT m_ClipRect;
@@ -621,8 +621,8 @@ class CFX_ImageTransformer {
const FX_RECT* pClip);
~CFX_ImageTransformer();
- FX_BOOL Start();
- FX_BOOL Continue(IFX_Pause* pPause);
+ bool Start();
+ bool Continue(IFX_Pause* pPause);
const FX_RECT& result() const { return m_result; }
std::unique_ptr<CFX_DIBitmap> DetachBitmap();
@@ -645,19 +645,19 @@ class CFX_ImageRenderer {
CFX_ImageRenderer();
~CFX_ImageRenderer();
- FX_BOOL Start(CFX_DIBitmap* pDevice,
- const CFX_ClipRgn* pClipRgn,
- const CFX_DIBSource* pSource,
- int bitmap_alpha,
- uint32_t mask_color,
- const CFX_Matrix* pMatrix,
- uint32_t dib_flags,
- FX_BOOL bRgbByteOrder = FALSE,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL);
+ bool Start(CFX_DIBitmap* pDevice,
+ const CFX_ClipRgn* pClipRgn,
+ const CFX_DIBSource* pSource,
+ int bitmap_alpha,
+ uint32_t mask_color,
+ const CFX_Matrix* pMatrix,
+ uint32_t dib_flags,
+ bool bRgbByteOrder = false,
+ int alpha_flag = 0,
+ void* pIccTransform = nullptr,
+ int blend_type = FXDIB_BLEND_NORMAL);
- FX_BOOL Continue(IFX_Pause* pPause);
+ bool Continue(IFX_Pause* pPause);
protected:
CFX_DIBitmap* m_pDevice;
@@ -673,7 +673,7 @@ class CFX_ImageRenderer {
uint32_t m_Flags;
int m_AlphaFlag;
void* m_pIccTransform;
- FX_BOOL m_bRgbByteOrder;
+ bool m_bRgbByteOrder;
int m_BlendType;
};
diff --git a/core/fxge/fx_font.h b/core/fxge/fx_font.h
index a562795784..a1acbfdcf4 100644
--- a/core/fxge/fx_font.h
+++ b/core/fxge/fx_font.h
@@ -98,23 +98,23 @@ class CFX_Font {
~CFX_Font();
void LoadSubst(const CFX_ByteString& face_name,
- FX_BOOL bTrueType,
+ bool bTrueType,
uint32_t flags,
int weight,
int italic_angle,
int CharsetCP,
bool bVertical);
- FX_BOOL LoadEmbedded(const uint8_t* data, uint32_t size);
+ bool LoadEmbedded(const uint8_t* data, uint32_t size);
FXFT_Face GetFace() const { return m_Face; }
CFX_SubstFont* GetSubstFont() const { return m_pSubstFont.get(); }
#ifdef PDF_ENABLE_XFA
- FX_BOOL LoadFile(IFX_SeekableReadStream* pFile,
- int nFaceIndex = 0,
- int* pFaceCount = nullptr);
+ bool LoadFile(IFX_SeekableReadStream* pFile,
+ int nFaceIndex = 0,
+ int* pFaceCount = nullptr);
- FX_BOOL LoadClone(const CFX_Font* pFont);
+ bool LoadClone(const CFX_Font* pFont);
void SetFace(FXFT_Face face);
void SetSubstFont(std::unique_ptr<CFX_SubstFont> subst) {
m_pSubstFont = std::move(subst);
@@ -122,7 +122,7 @@ class CFX_Font {
#endif // PDF_ENABLE_XFA
const CFX_GlyphBitmap* LoadGlyphBitmap(uint32_t glyph_index,
- FX_BOOL bFontStyle,
+ bool bFontStyle,
const CFX_Matrix* pMatrix,
int dest_width,
int anti_alias,
@@ -136,7 +136,7 @@ class CFX_Font {
int GetGlyphWidth(uint32_t glyph_index);
int GetAscent() const;
int GetDescent() const;
- FX_BOOL GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox);
+ bool GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox);
bool IsItalic() const;
bool IsBold() const;
bool IsFixedWidth() const;
@@ -145,12 +145,12 @@ class CFX_Font {
CFX_ByteString GetFamilyName() const;
CFX_ByteString GetFaceName() const;
bool IsTTFont() const;
- FX_BOOL GetBBox(FX_RECT& bbox);
+ bool GetBBox(FX_RECT& bbox);
int GetHeight() const;
int GetULPos() const;
int GetULthickness() const;
int GetMaxAdvanceWidth() const;
- FX_BOOL IsEmbedded() const { return m_bEmbedded; }
+ bool IsEmbedded() const { return m_bEmbedded; }
uint8_t* GetSubData() const { return m_pGsubData; }
void SetSubData(uint8_t* data) { m_pGsubData = data; }
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
diff --git a/core/fxge/ge/cfx_cliprgn.cpp b/core/fxge/ge/cfx_cliprgn.cpp
index ba2605aeca..ea3eb51f18 100644
--- a/core/fxge/ge/cfx_cliprgn.cpp
+++ b/core/fxge/ge/cfx_cliprgn.cpp
@@ -99,5 +99,5 @@ void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) {
m_Mask = new_mask;
return;
}
- ASSERT(FALSE);
+ ASSERT(false);
}
diff --git a/core/fxge/ge/cfx_facecache.cpp b/core/fxge/ge/cfx_facecache.cpp
index c297afb664..e7e6e0e42c 100644
--- a/core/fxge/ge/cfx_facecache.cpp
+++ b/core/fxge/ge/cfx_facecache.cpp
@@ -91,7 +91,7 @@ CFX_FaceCache::~CFX_FaceCache() {
CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(const CFX_Font* pFont,
uint32_t glyph_index,
- FX_BOOL bFontStyle,
+ bool bFontStyle,
const CFX_Matrix* pMatrix,
int dest_width,
int anti_alias) {
@@ -254,7 +254,7 @@ const CFX_PathData* CFX_FaceCache::LoadGlyphPath(const CFX_Font* pFont,
const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont,
uint32_t glyph_index,
- FX_BOOL bFontStyle,
+ bool bFontStyle,
const CFX_Matrix* pMatrix,
int dest_width,
int anti_alias,
@@ -369,7 +369,7 @@ CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap(
const CFX_Matrix* pMatrix,
const CFX_ByteString& FaceGlyphsKey,
uint32_t glyph_index,
- FX_BOOL bFontStyle,
+ bool bFontStyle,
int dest_width,
int anti_alias) {
CFX_SizeGlyphCache* pSizeCache;
diff --git a/core/fxge/ge/cfx_folderfontinfo.cpp b/core/fxge/ge/cfx_folderfontinfo.cpp
index 393f74bbd9..9ccccbc635 100644
--- a/core/fxge/ge/cfx_folderfontinfo.cpp
+++ b/core/fxge/ge/cfx_folderfontinfo.cpp
@@ -76,7 +76,7 @@ uint32_t GetCharset(int charset) {
}
int32_t GetSimilarValue(int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int pitch_family,
uint32_t style) {
int32_t iSimilarValue = 0;
@@ -108,11 +108,11 @@ void CFX_FolderFontInfo::AddPath(const CFX_ByteStringC& path) {
m_PathList.push_back(CFX_ByteString(path));
}
-FX_BOOL CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) {
+bool CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) {
m_pMapper = pMapper;
for (const auto& path : m_PathList)
ScanPath(path);
- return TRUE;
+ return true;
}
void CFX_FolderFontInfo::ScanPath(const CFX_ByteString& path) {
@@ -270,11 +270,11 @@ void* CFX_FolderFontInfo::GetSubstFont(const CFX_ByteString& face) {
}
void* CFX_FolderFontInfo::FindFont(int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int charset,
int pitch_family,
const FX_CHAR* family,
- FX_BOOL bMatchName) {
+ bool bMatchName) {
CFX_FontFaceInfo* pFind = nullptr;
if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH))
return GetFont("Courier New");
@@ -301,7 +301,7 @@ void* CFX_FolderFontInfo::FindFont(int weight,
}
void* CFX_FolderFontInfo::MapFont(int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int charset,
int pitch_family,
const FX_CHAR* family,
@@ -312,7 +312,7 @@ void* CFX_FolderFontInfo::MapFont(int weight,
#ifdef PDF_ENABLE_XFA
void* CFX_FolderFontInfo::MapFontByUnicode(uint32_t dwUnicode,
int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int pitch_family) {
return nullptr;
}
@@ -364,14 +364,14 @@ uint32_t CFX_FolderFontInfo::GetFontData(void* hFont,
}
void CFX_FolderFontInfo::DeleteFont(void* hFont) {}
-FX_BOOL CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
+bool CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
if (!hFont)
- return FALSE;
+ return false;
CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont;
name = pFont->m_FaceName;
- return TRUE;
+ return true;
}
-FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) {
- return FALSE;
+bool CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) {
+ return false;
}
diff --git a/core/fxge/ge/cfx_folderfontinfo.h b/core/fxge/ge/cfx_folderfontinfo.h
index ef4645cf53..d031eef3d0 100644
--- a/core/fxge/ge/cfx_folderfontinfo.h
+++ b/core/fxge/ge/cfx_folderfontinfo.h
@@ -22,9 +22,9 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo {
void AddPath(const CFX_ByteStringC& path);
// IFX_SytemFontInfo:
- FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override;
+ bool EnumFontList(CFX_FontMapper* pMapper) override;
void* MapFont(int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int charset,
int pitch_family,
const FX_CHAR* face,
@@ -32,7 +32,7 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo {
#ifdef PDF_ENABLE_XFA
void* MapFontByUnicode(uint32_t dwUnicode,
int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int pitch_family) override;
#endif // PDF_ENABLE_XFA
void* GetFont(const FX_CHAR* face) override;
@@ -41,8 +41,8 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo {
uint8_t* buffer,
uint32_t size) override;
void DeleteFont(void* hFont) override;
- FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override;
- FX_BOOL GetFontCharset(void* hFont, int& charset) override;
+ bool GetFaceName(void* hFont, CFX_ByteString& name) override;
+ bool GetFontCharset(void* hFont, int& charset) override;
protected:
void ScanPath(const CFX_ByteString& path);
@@ -53,11 +53,11 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo {
uint32_t offset);
void* GetSubstFont(const CFX_ByteString& face);
void* FindFont(int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int charset,
int pitch_family,
const FX_CHAR* family,
- FX_BOOL bMatchName);
+ bool bMatchName);
std::map<CFX_ByteString, CFX_FontFaceInfo*> m_FontList;
std::vector<CFX_ByteString> m_PathList;
diff --git a/core/fxge/ge/cfx_font.cpp b/core/fxge/ge/cfx_font.cpp
index d1c31d0f51..5604e53e40 100644
--- a/core/fxge/ge/cfx_font.cpp
+++ b/core/fxge/ge/cfx_font.cpp
@@ -22,7 +22,7 @@
namespace {
typedef struct {
- FX_BOOL m_bCount;
+ bool m_bCount;
int m_PointCount;
FX_PATHPOINT* m_pPoints;
int m_CurX;
@@ -46,11 +46,11 @@ unsigned long FTStreamRead(FXFT_Stream stream,
void FTStreamClose(FXFT_Stream stream) {}
-FX_BOOL LoadFileImp(FXFT_Library library,
- FXFT_Face* Face,
- IFX_SeekableReadStream* pFile,
- int32_t faceIndex,
- std::unique_ptr<FXFT_StreamRec>* stream) {
+bool LoadFileImp(FXFT_Library library,
+ FXFT_Face* Face,
+ IFX_SeekableReadStream* pFile,
+ int32_t faceIndex,
+ std::unique_ptr<FXFT_StreamRec>* stream) {
std::unique_ptr<FXFT_StreamRec> stream1(new FXFT_StreamRec());
stream1->base = nullptr;
stream1->size = static_cast<unsigned long>(pFile->GetSize());
@@ -62,10 +62,10 @@ FX_BOOL LoadFileImp(FXFT_Library library,
args.flags = FT_OPEN_STREAM;
args.stream = stream1.get();
if (FXFT_Open_Face(library, &args, faceIndex, Face))
- return FALSE;
+ return false;
if (stream)
*stream = std::move(stream1);
- return TRUE;
+ return true;
}
#endif // PDF_ENABLE_XFA
@@ -240,9 +240,9 @@ CFX_Font::CFX_Font()
}
#ifdef PDF_ENABLE_XFA
-FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) {
+bool CFX_Font::LoadClone(const CFX_Font* pFont) {
if (!pFont)
- return FALSE;
+ return false;
m_bShallowCopy = true;
if (pFont->m_pSubstFont) {
@@ -268,7 +268,7 @@ FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) {
#endif
m_pOwnedStream = pFont->m_pOwnedStream;
m_FaceCache = pFont->GetFaceCache();
- return TRUE;
+ return true;
}
void CFX_Font::SetFace(FXFT_Face face) {
@@ -313,7 +313,7 @@ void CFX_Font::DeleteFace() {
}
void CFX_Font::LoadSubst(const CFX_ByteString& face_name,
- FX_BOOL bTrueType,
+ bool bTrueType,
uint32_t flags,
int weight,
int italic_angle,
@@ -332,10 +332,10 @@ void CFX_Font::LoadSubst(const CFX_ByteString& face_name,
}
#ifdef PDF_ENABLE_XFA
-FX_BOOL CFX_Font::LoadFile(IFX_SeekableReadStream* pFile,
- int nFaceIndex,
- int* pFaceCount) {
- m_bEmbedded = FALSE;
+bool CFX_Font::LoadFile(IFX_SeekableReadStream* pFile,
+ int nFaceIndex,
+ int* pFaceCount) {
+ m_bEmbedded = false;
CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr();
pFontMgr->InitFTLibrary();
@@ -343,13 +343,13 @@ FX_BOOL CFX_Font::LoadFile(IFX_SeekableReadStream* pFile,
std::unique_ptr<FXFT_StreamRec> stream;
if (!LoadFileImp(library, &m_Face, pFile, nFaceIndex, &stream))
- return FALSE;
+ return false;
if (pFaceCount)
*pFaceCount = (int)m_Face->num_faces;
m_pOwnedStream = stream.release();
FXFT_Set_Pixel_Sizes(m_Face, 0, 64);
- return TRUE;
+ return true;
}
#endif // PDF_ENABLE_XFA
@@ -368,7 +368,7 @@ int CFX_Font::GetGlyphWidth(uint32_t glyph_index) {
return width;
}
-FX_BOOL CFX_Font::LoadEmbedded(const uint8_t* data, uint32_t size) {
+bool CFX_Font::LoadEmbedded(const uint8_t* data, uint32_t size) {
std::vector<uint8_t> temp(data, data + size);
m_pFontDataAllocation.swap(temp);
m_Face = FT_LoadFont(m_pFontDataAllocation.data(), size);
@@ -398,23 +398,23 @@ int CFX_Font::GetDescent() const {
FXFT_Get_Face_Descender(m_Face));
}
-FX_BOOL CFX_Font::GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox) {
+bool CFX_Font::GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox) {
if (!m_Face)
- return FALSE;
+ return false;
if (FXFT_Is_Face_Tricky(m_Face)) {
int error = FXFT_Set_Char_Size(m_Face, 0, 1000 * 64, 72, 72);
if (error)
- return FALSE;
+ return false;
error = FXFT_Load_Glyph(m_Face, glyph_index,
FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
if (error)
- return FALSE;
+ return false;
FXFT_BBox cbox;
FT_Glyph glyph;
error = FXFT_Get_Glyph(((FXFT_Face)m_Face)->glyph, &glyph);
if (error)
- return FALSE;
+ return false;
FXFT_Glyph_Get_CBox(glyph, FXFT_GLYPH_BBOX_PIXELS, &cbox);
int pixel_size_x = ((FXFT_Face)m_Face)->size->metrics.x_ppem,
pixel_size_y = ((FXFT_Face)m_Face)->size->metrics.y_ppem;
@@ -439,7 +439,7 @@ FX_BOOL CFX_Font::GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox) {
if (FXFT_Load_Glyph(
m_Face, glyph_index,
FXFT_LOAD_NO_SCALE | FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)) {
- return FALSE;
+ return false;
}
int em = FXFT_Get_Face_UnitsPerEM(m_Face);
if (em == 0) {
@@ -457,7 +457,7 @@ FX_BOOL CFX_Font::GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox) {
1000 / em;
bbox.bottom = (FXFT_Get_Glyph_HoriBearingY(m_Face)) * 1000 / em;
}
- return TRUE;
+ return true;
}
bool CFX_Font::IsItalic() const {
@@ -517,9 +517,9 @@ CFX_ByteString CFX_Font::GetFaceName() const {
return m_pSubstFont->m_Family;
}
-FX_BOOL CFX_Font::GetBBox(FX_RECT& bbox) {
+bool CFX_Font::GetBBox(FX_RECT& bbox) {
if (!m_Face)
- return FALSE;
+ return false;
int em = FXFT_Get_Face_UnitsPerEM(m_Face);
if (em == 0) {
bbox.left = FXFT_Get_Face_xMin(m_Face);
@@ -532,7 +532,7 @@ FX_BOOL CFX_Font::GetBBox(FX_RECT& bbox) {
bbox.right = FXFT_Get_Face_xMax(m_Face) * 1000 / em;
bbox.bottom = FXFT_Get_Face_yMax(m_Face) * 1000 / em;
}
- return TRUE;
+ return true;
}
int CFX_Font::GetHeight() const {
@@ -674,14 +674,14 @@ CFX_PathData* CFX_Font::LoadGlyphPathImpl(uint32_t glyph_index,
funcs.shift = 0;
funcs.delta = 0;
OUTLINE_PARAMS params;
- params.m_bCount = TRUE;
+ params.m_bCount = true;
params.m_PointCount = 0;
FXFT_Outline_Decompose(FXFT_Get_Glyph_Outline(m_Face), &funcs, &params);
if (params.m_PointCount == 0)
return nullptr;
CFX_PathData* pPath = new CFX_PathData;
pPath->SetPointCount(params.m_PointCount);
- params.m_bCount = FALSE;
+ params.m_bCount = false;
params.m_PointCount = 0;
params.m_pPoints = pPath->GetPoints();
params.m_CurX = params.m_CurY = 0;
@@ -695,7 +695,7 @@ CFX_PathData* CFX_Font::LoadGlyphPathImpl(uint32_t glyph_index,
}
const CFX_GlyphBitmap* CFX_Font::LoadGlyphBitmap(uint32_t glyph_index,
- FX_BOOL bFontStyle,
+ bool bFontStyle,
const CFX_Matrix* pMatrix,
int dest_width,
int anti_alias,
diff --git a/core/fxge/ge/cfx_fontmapper.cpp b/core/fxge/ge/cfx_fontmapper.cpp
index db40bdbfc7..1b79520373 100644
--- a/core/fxge/ge/cfx_fontmapper.cpp
+++ b/core/fxge/ge/cfx_fontmapper.cpp
@@ -258,12 +258,12 @@ int32_t GetStyleType(const CFX_ByteString& bsStyle, bool bReverse) {
return -1;
}
-FX_BOOL CheckSupportThirdPartFont(CFX_ByteString name, int& PitchFamily) {
+bool CheckSupportThirdPartFont(CFX_ByteString name, int& PitchFamily) {
if (name == "MyriadPro") {
PitchFamily &= ~FXFONT_FF_ROMAN;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void UpdatePitchFamily(uint32_t flags, int& PitchFamily) {
@@ -278,7 +278,7 @@ void UpdatePitchFamily(uint32_t flags, int& PitchFamily) {
} // namespace
CFX_FontMapper::CFX_FontMapper(CFX_FontMgr* mgr)
- : m_bListLoaded(FALSE), m_pFontMgr(mgr) {
+ : m_bListLoaded(false), m_pFontMgr(mgr) {
m_MMFaces[0] = nullptr;
m_MMFaces[1] = nullptr;
FXSYS_memset(m_FoxitFaces, 0, sizeof(m_FoxitFaces));
@@ -328,10 +328,10 @@ void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) {
return;
const uint8_t* ptr = name.raw_str();
- FX_BOOL bLocalized = FALSE;
+ bool bLocalized = false;
for (int i = 0; i < name.GetLength(); i++) {
if (ptr[i] > 0x80) {
- bLocalized = TRUE;
+ bLocalized = true;
break;
}
}
@@ -360,7 +360,7 @@ void CFX_FontMapper::LoadInstalledFonts() {
return;
m_pFontInfo->EnumFontList(this);
- m_bListLoaded = TRUE;
+ m_bListLoaded = true;
}
CFX_ByteString CFX_FontMapper::MatchInstalledFonts(
@@ -422,7 +422,7 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont,
}
FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
- FX_BOOL bTrueType,
+ bool bTrueType,
uint32_t flags,
int weight,
int italic_angle,
@@ -714,7 +714,7 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(uint32_t dwUnicode,
if (!m_pFontInfo)
return nullptr;
- FX_BOOL bItalic = (flags & FXFONT_ITALIC) != 0;
+ bool bItalic = (flags & FXFONT_ITALIC) != 0;
int PitchFamily = 0;
UpdatePitchFamily(flags, PitchFamily);
void* hFont =
@@ -745,16 +745,16 @@ int CFX_FontMapper::GetFaceSize() const {
return pdfium::CollectionSize<int>(m_FaceArray);
}
-FX_BOOL CFX_FontMapper::IsBuiltinFace(const FXFT_Face face) const {
+bool CFX_FontMapper::IsBuiltinFace(const FXFT_Face face) const {
for (size_t i = 0; i < MM_FACE_COUNT; ++i) {
if (m_MMFaces[i] == face)
- return TRUE;
+ return true;
}
for (size_t i = 0; i < FOXIT_FACE_COUNT; ++i) {
if (m_FoxitFaces[i] == face)
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
FXFT_Face CFX_FontMapper::GetCachedTTCFace(void* hFont,
@@ -783,7 +783,7 @@ FXFT_Face CFX_FontMapper::GetCachedTTCFace(void* hFont,
FXFT_Face CFX_FontMapper::GetCachedFace(void* hFont,
CFX_ByteString SubstName,
int weight,
- FX_BOOL bItalic,
+ bool bItalic,
uint32_t font_size) {
FXFT_Face face;
uint8_t* pFontData;
diff --git a/core/fxge/ge/cfx_fontmgr.cpp b/core/fxge/ge/cfx_fontmgr.cpp
index 981a9be288..1d1ebca4a4 100644
--- a/core/fxge/ge/cfx_fontmgr.cpp
+++ b/core/fxge/ge/cfx_fontmgr.cpp
@@ -45,7 +45,7 @@ const BuiltinFont g_MMFonts[2] = {
CFX_ByteString KeyNameFromFace(const CFX_ByteString& face_name,
int weight,
- FX_BOOL bItalic) {
+ bool bItalic) {
CFX_ByteString key(face_name);
key += ',';
key += CFX_ByteString::FormatInteger(weight);
@@ -110,7 +110,7 @@ void CFX_FontMgr::SetSystemFontInfo(
}
FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name,
- FX_BOOL bTrueType,
+ bool bTrueType,
uint32_t flags,
int weight,
int italic_angle,
@@ -123,7 +123,7 @@ FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name,
FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name,
int weight,
- FX_BOOL bItalic,
+ bool bItalic,
uint8_t*& pFontData) {
auto it = m_FaceMap.find(KeyNameFromFace(face_name, weight, bItalic));
if (it == m_FaceMap.end())
@@ -137,7 +137,7 @@ FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name,
FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name,
int weight,
- FX_BOOL bItalic,
+ bool bItalic,
uint8_t* pData,
uint32_t size,
int face_index) {
@@ -224,14 +224,14 @@ FXFT_Face CFX_FontMgr::GetFileFace(const FX_CHAR* filename, int face_index) {
void CFX_FontMgr::ReleaseFace(FXFT_Face face) {
if (!face)
return;
- FX_BOOL bNeedFaceDone = TRUE;
+ bool bNeedFaceDone = true;
auto it = m_FaceMap.begin();
while (it != m_FaceMap.end()) {
auto temp = it++;
int nRet = temp->second->ReleaseFace(face);
if (nRet == -1)
continue;
- bNeedFaceDone = FALSE;
+ bNeedFaceDone = false;
if (nRet == 0)
m_FaceMap.erase(temp);
break;
diff --git a/core/fxge/ge/cfx_pathdata.cpp b/core/fxge/ge/cfx_pathdata.cpp
index 73476bf271..19e8bdb013 100644
--- a/core/fxge/ge/cfx_pathdata.cpp
+++ b/core/fxge/ge/cfx_pathdata.cpp
@@ -160,8 +160,8 @@ static void _UpdateLineJoinPoints(CFX_FloatRect& rect,
FX_FLOAT miter_limit) {
FX_FLOAT start_k = 0, start_c = 0, end_k = 0, end_c = 0, start_len = 0,
start_dc = 0, end_len = 0, end_dc = 0;
- FX_BOOL bStartVert = FXSYS_fabs(start_x - middle_x) < 1.0f / 20;
- FX_BOOL bEndVert = FXSYS_fabs(middle_x - end_x) < 1.0f / 20;
+ bool bStartVert = FXSYS_fabs(start_x - middle_x) < 1.0f / 20;
+ bool bEndVert = FXSYS_fabs(middle_x - end_x) < 1.0f / 20;
if (bStartVert && bEndVert) {
int start_dir = middle_y > start_y ? 1 : -1;
FX_FLOAT point_y = middle_y + half_width * start_dir;
@@ -251,12 +251,12 @@ CFX_FloatRect CFX_PathData::GetBoundingBox(FX_FLOAT line_width,
int iStartPoint = 0;
int iEndPoint = 0;
int iMiddlePoint = 0;
- FX_BOOL bJoin;
+ bool bJoin;
while (iPoint < m_PointCount) {
if (m_pPoints[iPoint].m_Flag == FXPT_MOVETO) {
iStartPoint = iPoint + 1;
iEndPoint = iPoint;
- bJoin = FALSE;
+ bJoin = false;
} else {
if (m_pPoints[iPoint].m_Flag == FXPT_BEZIERTO) {
rect.UpdateRect(m_pPoints[iPoint].m_PointX, m_pPoints[iPoint].m_PointY);
@@ -268,12 +268,12 @@ CFX_FloatRect CFX_PathData::GetBoundingBox(FX_FLOAT line_width,
m_pPoints[iPoint + 1].m_Flag == FXPT_MOVETO) {
iStartPoint = iPoint - 1;
iEndPoint = iPoint;
- bJoin = FALSE;
+ bJoin = false;
} else {
iStartPoint = iPoint - 1;
iMiddlePoint = iPoint;
iEndPoint = iPoint + 1;
- bJoin = TRUE;
+ bJoin = true;
}
}
FX_FLOAT start_x = m_pPoints[iStartPoint].m_PointX;
@@ -302,12 +302,12 @@ void CFX_PathData::Transform(const CFX_Matrix* pMatrix) {
}
}
-FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath,
- CFX_Matrix* pMatrix,
- FX_BOOL& bThin,
- FX_BOOL bAdjust) const {
+bool CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath,
+ CFX_Matrix* pMatrix,
+ bool& bThin,
+ bool bAdjust) const {
if (m_PointCount < 3) {
- return FALSE;
+ return false;
}
if (m_PointCount == 3 && (m_pPoints[0].m_Flag & FXPT_TYPE) == FXPT_MOVETO &&
(m_pPoints[1].m_Flag & FXPT_TYPE) == FXPT_LINETO &&
@@ -344,13 +344,13 @@ FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath,
}
if (m_pPoints[0].m_PointX != m_pPoints[1].m_PointX &&
m_pPoints[0].m_PointY != m_pPoints[1].m_PointY) {
- bThin = TRUE;
+ bThin = true;
}
- return TRUE;
+ return true;
}
if (((m_PointCount > 3) && (m_PointCount % 2))) {
int mid = m_PointCount / 2;
- FX_BOOL bZeroArea = FALSE;
+ bool bZeroArea = false;
CFX_PathData t_path;
for (int i = 0; i < mid; i++) {
if (!(m_pPoints[mid - i - 1].m_PointX ==
@@ -359,7 +359,7 @@ FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath,
m_pPoints[mid + i + 1].m_PointY &&
((m_pPoints[mid - i - 1].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO &&
(m_pPoints[mid + i + 1].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO))) {
- bZeroArea = TRUE;
+ bZeroArea = true;
break;
}
int new_count = t_path.GetPointCount();
@@ -371,8 +371,8 @@ FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath,
}
if (!bZeroArea) {
NewPath.Append(&t_path, nullptr);
- bThin = TRUE;
- return TRUE;
+ bThin = true;
+ return true;
}
}
int stratPoint = 0;
@@ -430,7 +430,7 @@ FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath,
m_pPoints[i - 1].m_PointY, FXPT_MOVETO);
NewPath.SetPoint(new_count + 1, m_pPoints[i].m_PointX,
m_pPoints[i].m_PointY, FXPT_LINETO);
- bThin = TRUE;
+ bThin = true;
}
}
} else if (point_type == FXPT_BEZIERTO) {
@@ -439,17 +439,17 @@ FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath,
}
}
if (m_PointCount > 3 && NewPath.GetPointCount()) {
- bThin = TRUE;
+ bThin = true;
}
if (NewPath.GetPointCount() == 0) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_PathData::IsRect() const {
+bool CFX_PathData::IsRect() const {
if (m_PointCount != 5 && m_PointCount != 4) {
- return FALSE;
+ return false;
}
if ((m_PointCount == 5 && (m_pPoints[0].m_PointX != m_pPoints[4].m_PointX ||
m_pPoints[0].m_PointY != m_pPoints[4].m_PointY)) ||
@@ -457,29 +457,29 @@ FX_BOOL CFX_PathData::IsRect() const {
m_pPoints[0].m_PointY == m_pPoints[2].m_PointY) ||
(m_pPoints[1].m_PointX == m_pPoints[3].m_PointX &&
m_pPoints[1].m_PointY == m_pPoints[3].m_PointY)) {
- return FALSE;
+ return false;
}
if (m_pPoints[0].m_PointX != m_pPoints[3].m_PointX &&
m_pPoints[0].m_PointY != m_pPoints[3].m_PointY) {
- return FALSE;
+ return false;
}
for (int i = 1; i < 4; i++) {
if ((m_pPoints[i].m_Flag & FXPT_TYPE) != FXPT_LINETO) {
- return FALSE;
+ return false;
}
if (m_pPoints[i].m_PointX != m_pPoints[i - 1].m_PointX &&
m_pPoints[i].m_PointY != m_pPoints[i - 1].m_PointY) {
- return FALSE;
+ return false;
}
}
return m_PointCount == 5 || (m_pPoints[3].m_Flag & FXPT_CLOSEFIGURE);
}
-FX_BOOL CFX_PathData::IsRect(const CFX_Matrix* pMatrix,
- CFX_FloatRect* pRect) const {
+bool CFX_PathData::IsRect(const CFX_Matrix* pMatrix,
+ CFX_FloatRect* pRect) const {
if (!pMatrix) {
if (!IsRect()) {
- return FALSE;
+ return false;
}
if (pRect) {
pRect->left = m_pPoints[0].m_PointX;
@@ -488,20 +488,20 @@ FX_BOOL CFX_PathData::IsRect(const CFX_Matrix* pMatrix,
pRect->top = m_pPoints[2].m_PointY;
pRect->Normalize();
}
- return TRUE;
+ return true;
}
if (m_PointCount != 5 && m_PointCount != 4) {
- return FALSE;
+ return false;
}
if ((m_PointCount == 5 && (m_pPoints[0].m_PointX != m_pPoints[4].m_PointX ||
m_pPoints[0].m_PointY != m_pPoints[4].m_PointY)) ||
(m_pPoints[1].m_PointX == m_pPoints[3].m_PointX &&
m_pPoints[1].m_PointY == m_pPoints[3].m_PointY)) {
- return FALSE;
+ return false;
}
if (m_PointCount == 4 && m_pPoints[0].m_PointX != m_pPoints[3].m_PointX &&
m_pPoints[0].m_PointY != m_pPoints[3].m_PointY) {
- return FALSE;
+ return false;
}
FX_FLOAT x[5], y[5];
for (int i = 0; i < m_PointCount; i++) {
@@ -509,10 +509,10 @@ FX_BOOL CFX_PathData::IsRect(const CFX_Matrix* pMatrix,
y[i]);
if (i) {
if ((m_pPoints[i].m_Flag & FXPT_TYPE) != FXPT_LINETO) {
- return FALSE;
+ return false;
}
if (x[i] != x[i - 1] && y[i] != y[i - 1]) {
- return FALSE;
+ return false;
}
}
}
@@ -523,7 +523,7 @@ FX_BOOL CFX_PathData::IsRect(const CFX_Matrix* pMatrix,
pRect->top = y[2];
pRect->Normalize();
}
- return TRUE;
+ return true;
}
void CFX_PathData::Copy(const CFX_PathData& src) {
diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp
index 1c3611ed9b..c6b046b898 100644
--- a/core/fxge/ge/cfx_renderdevice.cpp
+++ b/core/fxge/ge/cfx_renderdevice.cpp
@@ -393,9 +393,9 @@ CFX_Matrix CFX_RenderDevice::GetCTM() const {
return m_pDeviceDriver->GetCTM();
}
-FX_BOOL CFX_RenderDevice::CreateCompatibleBitmap(CFX_DIBitmap* pDIB,
- int width,
- int height) const {
+bool CFX_RenderDevice::CreateCompatibleBitmap(CFX_DIBitmap* pDIB,
+ int width,
+ int height) const {
if (m_RenderCaps & FXRC_CMYK_OUTPUT) {
return pDIB->Create(width, height, m_RenderCaps & FXRC_ALPHA_OUTPUT
? FXDIB_Cmyka
@@ -413,37 +413,37 @@ FX_BOOL CFX_RenderDevice::CreateCompatibleBitmap(CFX_DIBitmap* pDIB,
#endif
}
-FX_BOOL CFX_RenderDevice::SetClip_PathFill(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- int fill_mode) {
+bool CFX_RenderDevice::SetClip_PathFill(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ int fill_mode) {
if (!m_pDeviceDriver->SetClip_PathFill(pPathData, pObject2Device,
fill_mode)) {
- return FALSE;
+ return false;
}
UpdateClipBox();
- return TRUE;
+ return true;
}
-FX_BOOL CFX_RenderDevice::SetClip_PathStroke(
+bool CFX_RenderDevice::SetClip_PathStroke(
const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device,
const CFX_GraphStateData* pGraphState) {
if (!m_pDeviceDriver->SetClip_PathStroke(pPathData, pObject2Device,
pGraphState)) {
- return FALSE;
+ return false;
}
UpdateClipBox();
- return TRUE;
+ return true;
}
-FX_BOOL CFX_RenderDevice::SetClip_Rect(const FX_RECT& rect) {
+bool CFX_RenderDevice::SetClip_Rect(const FX_RECT& rect) {
CFX_PathData path;
path.AppendRect(rect.left, rect.bottom, rect.right, rect.top);
if (!SetClip_PathFill(&path, nullptr, FXFILL_WINDING))
- return FALSE;
+ return false;
UpdateClipBox();
- return TRUE;
+ return true;
}
void CFX_RenderDevice::UpdateClipBox() {
@@ -455,14 +455,13 @@ void CFX_RenderDevice::UpdateClipBox() {
m_ClipBox.bottom = m_Height;
}
-FX_BOOL CFX_RenderDevice::DrawPathWithBlend(
- const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- int fill_mode,
- int blend_type) {
+bool CFX_RenderDevice::DrawPathWithBlend(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ int fill_mode,
+ int blend_type) {
uint8_t stroke_alpha = pGraphState ? FXARGB_A(stroke_color) : 0;
uint8_t fill_alpha = (fill_mode & 3) ? FXARGB_A(fill_color) : 0;
if (stroke_alpha == 0 && pPathData->GetPointCount() == 2) {
@@ -480,7 +479,7 @@ FX_BOOL CFX_RenderDevice::DrawPathWithBlend(
y2 = pPoints[1].m_PointY;
}
DrawCosmeticLine(x1, y1, x2, y2, fill_color, fill_mode, blend_type);
- return TRUE;
+ return true;
}
if ((pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) &&
stroke_alpha == 0) {
@@ -493,7 +492,7 @@ FX_BOOL CFX_RenderDevice::DrawPathWithBlend(
// possible to overflow the Width() and Height() calculations. Check that
// the rect will have valid dimension before continuing.
if (!rect_i.Valid())
- return FALSE;
+ return false;
int width = (int)FXSYS_ceil(rect_f.right - rect_f.left);
if (width < 1) {
@@ -524,13 +523,13 @@ FX_BOOL CFX_RenderDevice::DrawPathWithBlend(
}
}
if (FillRectWithBlend(&rect_i, fill_color, blend_type))
- return TRUE;
+ return true;
}
}
if ((fill_mode & 3) && stroke_alpha == 0 && !(fill_mode & FX_FILL_STROKE) &&
!(fill_mode & FX_FILL_TEXT_MODE)) {
CFX_PathData newPath;
- FX_BOOL bThin = FALSE;
+ bool bThin = false;
if (pPathData->GetZeroAreaPath(newPath, (CFX_Matrix*)pObject2Device, bThin,
!!m_pDeviceDriver->GetDriverType())) {
CFX_GraphStateData graphState;
@@ -564,16 +563,15 @@ FX_BOOL CFX_RenderDevice::DrawPathWithBlend(
}
// This can be removed once PDFium entirely relies on Skia
-FX_BOOL CFX_RenderDevice::DrawFillStrokePath(
- const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- int fill_mode,
- int blend_type) {
+bool CFX_RenderDevice::DrawFillStrokePath(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ int fill_mode,
+ int blend_type) {
if (!(m_RenderCaps & FXRC_GET_BITS))
- return FALSE;
+ return false;
CFX_FloatRect bbox;
if (pGraphState) {
bbox = pPathData->GetBoundingBox(pGraphState->m_LineWidth,
@@ -590,14 +588,14 @@ FX_BOOL CFX_RenderDevice::DrawFillStrokePath(
CFX_DIBitmap bitmap, Backdrop;
if (!CreateCompatibleBitmap(&bitmap, FXSYS_round(rect.Width() * fScaleX),
FXSYS_round(rect.Height() * fScaleY))) {
- return FALSE;
+ return false;
}
if (bitmap.HasAlpha()) {
bitmap.Clear(0);
Backdrop.Copy(&bitmap);
} else {
if (!m_pDeviceDriver->GetDIBits(&bitmap, rect.left, rect.top))
- return FALSE;
+ return false;
Backdrop.Copy(&bitmap);
}
CFX_FxgeDevice bitmap_device;
@@ -610,7 +608,7 @@ FX_BOOL CFX_RenderDevice::DrawFillStrokePath(
if (!bitmap_device.GetDeviceDriver()->DrawPath(
pPathData, &matrix, pGraphState, fill_color, stroke_color, fill_mode,
blend_type)) {
- return FALSE;
+ return false;
}
FX_RECT src_rect(0, 0, FXSYS_round(rect.Width() * fScaleX),
FXSYS_round(rect.Height() * fScaleY));
@@ -618,50 +616,50 @@ FX_BOOL CFX_RenderDevice::DrawFillStrokePath(
FXDIB_BLEND_NORMAL);
}
-FX_BOOL CFX_RenderDevice::SetPixel(int x, int y, uint32_t color) {
+bool CFX_RenderDevice::SetPixel(int x, int y, uint32_t color) {
if (m_pDeviceDriver->SetPixel(x, y, color))
- return TRUE;
+ return true;
FX_RECT rect(x, y, x + 1, y + 1);
return FillRectWithBlend(&rect, color, FXDIB_BLEND_NORMAL);
}
-FX_BOOL CFX_RenderDevice::FillRectWithBlend(const FX_RECT* pRect,
- uint32_t fill_color,
- int blend_type) {
+bool CFX_RenderDevice::FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) {
if (m_pDeviceDriver->FillRectWithBlend(pRect, fill_color, blend_type))
- return TRUE;
+ return true;
if (!(m_RenderCaps & FXRC_GET_BITS))
- return FALSE;
+ return false;
CFX_DIBitmap bitmap;
if (!CreateCompatibleBitmap(&bitmap, pRect->Width(), pRect->Height()))
- return FALSE;
+ return false;
if (!m_pDeviceDriver->GetDIBits(&bitmap, pRect->left, pRect->top))
- return FALSE;
+ return false;
if (!bitmap.CompositeRect(0, 0, pRect->Width(), pRect->Height(), fill_color,
0, nullptr)) {
- return FALSE;
+ return false;
}
FX_RECT src_rect(0, 0, pRect->Width(), pRect->Height());
m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, pRect->left, pRect->top,
FXDIB_BLEND_NORMAL);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_RenderDevice::DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- uint32_t color,
- int fill_mode,
- int blend_type) {
+bool CFX_RenderDevice::DrawCosmeticLine(FX_FLOAT x1,
+ FX_FLOAT y1,
+ FX_FLOAT x2,
+ FX_FLOAT y2,
+ uint32_t color,
+ int fill_mode,
+ int blend_type) {
if ((color >= 0xff000000) &&
m_pDeviceDriver->DrawCosmeticLine(x1, y1, x2, y2, color, blend_type)) {
- return TRUE;
+ return true;
}
CFX_GraphStateData graph_state;
CFX_PathData path;
@@ -672,9 +670,9 @@ FX_BOOL CFX_RenderDevice::DrawCosmeticLine(FX_FLOAT x1,
fill_mode, blend_type);
}
-FX_BOOL CFX_RenderDevice::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
+bool CFX_RenderDevice::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
if (!(m_RenderCaps & FXRC_GET_BITS))
- return FALSE;
+ return false;
return m_pDeviceDriver->GetDIBits(pBitmap, left, top);
}
@@ -682,10 +680,10 @@ CFX_DIBitmap* CFX_RenderDevice::GetBackDrop() {
return m_pDeviceDriver->GetBackDrop();
}
-FX_BOOL CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int blend_mode) {
+bool CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
+ int left,
+ int top,
+ int blend_mode) {
ASSERT(!pBitmap->IsAlphaMask());
CFX_Matrix ctm = GetCTM();
FX_FLOAT fScaleX = FXSYS_fabs(ctm.a);
@@ -695,7 +693,7 @@ FX_BOOL CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
FXSYS_round(top + pBitmap->GetHeight() / fScaleY));
dest_rect.Intersect(m_ClipBox);
if (dest_rect.IsEmpty())
- return TRUE;
+ return true;
FX_RECT src_rect(dest_rect.left - left, dest_rect.top - top,
dest_rect.left - left + dest_rect.Width(),
dest_rect.top - top + dest_rect.Height());
@@ -706,23 +704,23 @@ FX_BOOL CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
if ((blend_mode != FXDIB_BLEND_NORMAL && !(m_RenderCaps & FXRC_BLEND_MODE)) ||
(pBitmap->HasAlpha() && !(m_RenderCaps & FXRC_ALPHA_IMAGE))) {
if (!(m_RenderCaps & FXRC_GET_BITS))
- return FALSE;
+ return false;
int bg_pixel_width = FXSYS_round(dest_rect.Width() * fScaleX);
int bg_pixel_height = FXSYS_round(dest_rect.Height() * fScaleY);
CFX_DIBitmap background;
if (!background.Create(
bg_pixel_width, bg_pixel_height,
(m_RenderCaps & FXRC_CMYK_OUTPUT) ? FXDIB_Cmyk : FXDIB_Rgb32)) {
- return FALSE;
+ return false;
}
if (!m_pDeviceDriver->GetDIBits(&background, dest_rect.left,
dest_rect.top)) {
- return FALSE;
+ return false;
}
if (!background.CompositeBitmap(0, 0, bg_pixel_width, bg_pixel_height,
pBitmap, src_rect.left, src_rect.top,
- blend_mode, nullptr, FALSE, nullptr)) {
- return FALSE;
+ blend_mode, nullptr, false, nullptr)) {
+ return false;
}
FX_RECT rect(0, 0, bg_pixel_width, bg_pixel_height);
return m_pDeviceDriver->SetDIBits(&background, 0, &rect, dest_rect.left,
@@ -732,7 +730,7 @@ FX_BOOL CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
dest_rect.top, blend_mode);
}
-FX_BOOL CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend(
+bool CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend(
const CFX_DIBSource* pBitmap,
int left,
int top,
@@ -744,38 +742,38 @@ FX_BOOL CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend(
FX_RECT clip_box = m_ClipBox;
clip_box.Intersect(dest_rect);
if (clip_box.IsEmpty())
- return TRUE;
+ return true;
return m_pDeviceDriver->StretchDIBits(pBitmap, 0, left, top, dest_width,
dest_height, &clip_box, flags,
blend_mode);
}
-FX_BOOL CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- uint32_t argb) {
+bool CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap,
+ int left,
+ int top,
+ uint32_t argb) {
FX_RECT src_rect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight());
return m_pDeviceDriver->SetDIBits(pBitmap, argb, &src_rect, left, top,
FXDIB_BLEND_NORMAL);
}
-FX_BOOL CFX_RenderDevice::StretchBitMask(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int dest_width,
- int dest_height,
- uint32_t color) {
+bool CFX_RenderDevice::StretchBitMask(const CFX_DIBSource* pBitmap,
+ int left,
+ int top,
+ int dest_width,
+ int dest_height,
+ uint32_t color) {
return StretchBitMaskWithFlags(pBitmap, left, top, dest_width, dest_height,
color, 0);
}
-FX_BOOL CFX_RenderDevice::StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int dest_width,
- int dest_height,
- uint32_t argb,
- uint32_t flags) {
+bool CFX_RenderDevice::StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap,
+ int left,
+ int top,
+ int dest_width,
+ int dest_height,
+ uint32_t argb,
+ uint32_t flags) {
FX_RECT dest_rect(left, top, left + dest_width, top + dest_height);
FX_RECT clip_box = m_ClipBox;
clip_box.Intersect(dest_rect);
@@ -784,18 +782,18 @@ FX_BOOL CFX_RenderDevice::StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap,
FXDIB_BLEND_NORMAL);
}
-FX_BOOL CFX_RenderDevice::StartDIBitsWithBlend(const CFX_DIBSource* pBitmap,
- int bitmap_alpha,
- uint32_t argb,
- const CFX_Matrix* pMatrix,
- uint32_t flags,
- void*& handle,
- int blend_mode) {
+bool CFX_RenderDevice::StartDIBitsWithBlend(const CFX_DIBSource* pBitmap,
+ int bitmap_alpha,
+ uint32_t argb,
+ const CFX_Matrix* pMatrix,
+ uint32_t flags,
+ void*& handle,
+ int blend_mode) {
return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix,
flags, handle, blend_mode);
}
-FX_BOOL CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) {
+bool CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) {
return m_pDeviceDriver->ContinueDIBits(handle, pPause);
}
@@ -819,29 +817,29 @@ bool CFX_RenderDevice::SetBitsWithMask(const CFX_DIBSource* pBitmap,
}
#endif
-FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- FX_FLOAT font_size,
- const CFX_Matrix* pText2Device,
- uint32_t fill_color,
- uint32_t text_flags) {
+bool CFX_RenderDevice::DrawNormalText(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ FX_FLOAT font_size,
+ const CFX_Matrix* pText2Device,
+ uint32_t fill_color,
+ uint32_t text_flags) {
int nativetext_flags = text_flags;
if (m_DeviceClass != FXDC_DISPLAY) {
if (!(text_flags & FXTEXT_PRINTGRAPHICTEXT)) {
if (ShouldDrawDeviceText(pFont, text_flags) &&
m_pDeviceDriver->DrawDeviceText(nChars, pCharPos, pFont, pText2Device,
font_size, fill_color)) {
- return TRUE;
+ return true;
}
}
if (FXARGB_A(fill_color) < 255)
- return FALSE;
+ return false;
} else if (!(text_flags & FXTEXT_NO_NATIVETEXT)) {
if (ShouldDrawDeviceText(pFont, text_flags) &&
m_pDeviceDriver->DrawDeviceText(nChars, pCharPos, pFont, pText2Device,
font_size, fill_color)) {
- return TRUE;
+ return true;
}
}
CFX_Matrix char2device;
@@ -935,7 +933,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
FXSYS_round((FX_FLOAT)bmp_rect1.bottom / scale_y));
bmp_rect.Intersect(m_ClipBox);
if (bmp_rect.IsEmpty())
- return TRUE;
+ return true;
int pixel_width = FXSYS_round(bmp_rect.Width() * scale_x);
int pixel_height = FXSYS_round(bmp_rect.Height() * scale_y);
int pixel_left = FXSYS_round(bmp_rect.left * scale_x);
@@ -943,7 +941,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
if (anti_alias == FXFT_RENDER_MODE_MONO) {
CFX_DIBitmap bitmap;
if (!bitmap.Create(pixel_width, pixel_height, FXDIB_1bppMask))
- return FALSE;
+ return false;
bitmap.Clear(0);
for (const FXTEXT_GLYPHPOS& glyph : glyphs) {
if (!glyph.m_pGlyph)
@@ -959,15 +957,15 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
CFX_DIBitmap bitmap;
if (m_bpp == 8) {
if (!bitmap.Create(pixel_width, pixel_height, FXDIB_8bppMask))
- return FALSE;
+ return false;
} else {
if (!CreateCompatibleBitmap(&bitmap, pixel_width, pixel_height))
- return FALSE;
+ return false;
}
if (!bitmap.HasAlpha() && !bitmap.IsAlphaMask()) {
bitmap.Clear(0xFFFFFFFF);
if (!GetDIBits(&bitmap, bmp_rect.left, bmp_rect.top))
- return FALSE;
+ return false;
} else {
bitmap.Clear(0);
if (bitmap.m_pAlphaMask)
@@ -989,13 +987,13 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
left += glyph.m_pGlyph->m_Left;
left -= pixel_left;
if (!left.IsValid())
- return FALSE;
+ return false;
pdfium::base::CheckedNumeric<int> top = glyph.m_OriginY;
top -= glyph.m_pGlyph->m_Top;
top -= pixel_top;
if (!top.IsValid())
- return FALSE;
+ return false;
const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap;
int ncols = pGlyph->GetWidth();
@@ -1003,9 +1001,9 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
if (anti_alias == FXFT_RENDER_MODE_NORMAL) {
if (!bitmap.CompositeMask(left.ValueOrDie(), top.ValueOrDie(), ncols,
nrows, pGlyph, fill_color, 0, 0,
- FXDIB_BLEND_NORMAL, nullptr, FALSE, 0,
+ FXDIB_BLEND_NORMAL, nullptr, false, 0,
nullptr)) {
- return FALSE;
+ return false;
}
continue;
}
@@ -1016,7 +1014,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
pdfium::base::CheckedNumeric<int> end_col_safe = left;
end_col_safe += ncols;
if (!end_col_safe.IsValid())
- return FALSE;
+ return false;
int end_col = std::min(end_col_safe.ValueOrDie(), dest_width);
if (start_col >= end_col)
@@ -1030,20 +1028,20 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
SetBitMask(&bitmap, bmp_rect.left, bmp_rect.top, fill_color);
else
SetDIBits(&bitmap, bmp_rect.left, bmp_rect.top);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_RenderDevice::DrawTextPath(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- FX_FLOAT font_size,
- const CFX_Matrix* pText2User,
- const CFX_Matrix* pUser2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- FX_ARGB stroke_color,
- CFX_PathData* pClippingPath,
- int nFlag) {
+bool CFX_RenderDevice::DrawTextPath(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ FX_FLOAT font_size,
+ const CFX_Matrix* pText2User,
+ const CFX_Matrix* pUser2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ FX_ARGB stroke_color,
+ CFX_PathData* pClippingPath,
+ int nFlag) {
for (int iChar = 0; iChar < nChars; iChar++) {
const FXTEXT_CHARPOS& charpos = pCharPos[iChar];
CFX_Matrix matrix;
@@ -1068,11 +1066,11 @@ FX_BOOL CFX_RenderDevice::DrawTextPath(int nChars,
if (!DrawPathWithBlend(&TransformedPath, pUser2Device, pGraphState,
fill_color, stroke_color, fill_mode,
FXDIB_BLEND_NORMAL)) {
- return FALSE;
+ return false;
}
}
if (pClippingPath)
pClippingPath->Append(&TransformedPath, pUser2Device);
}
- return TRUE;
+ return true;
}
diff --git a/core/fxge/ge/fx_ge_fontmap.cpp b/core/fxge/ge/fx_ge_fontmap.cpp
index eed5d929b9..f8c36d8f07 100644
--- a/core/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/fxge/ge/fx_ge_fontmap.cpp
@@ -52,7 +52,7 @@ CFX_ByteString GetNameFromTT(const uint8_t* name_table,
#ifdef PDF_ENABLE_XFA
void* IFX_SystemFontInfo::MapFontByUnicode(uint32_t dwUnicode,
int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int pitch_family) {
return nullptr;
}
diff --git a/core/fxge/ge/fx_ge_linux.cpp b/core/fxge/ge/fx_ge_linux.cpp
index 47cee34766..0319dd8ef5 100644
--- a/core/fxge/ge/fx_ge_linux.cpp
+++ b/core/fxge/ge/fx_ge_linux.cpp
@@ -21,12 +21,12 @@ namespace {
class CFX_LinuxFontInfo : public CFX_FolderFontInfo {
public:
void* MapFont(int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int charset,
int pitch_family,
const FX_CHAR* family,
int& iExact) override;
- FX_BOOL ParseFontCfg(const char** pUserPaths);
+ bool ParseFontCfg(const char** pUserPaths);
};
const size_t kLinuxGpNameSize = 6;
@@ -82,7 +82,7 @@ size_t GetJapanesePreference(const FX_CHAR* facearr,
} // namespace
void* CFX_LinuxFontInfo::MapFont(int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int charset,
int pitch_family,
const FX_CHAR* cstr_face,
@@ -92,7 +92,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight,
iExact = 1;
return font;
}
- FX_BOOL bCJK = TRUE;
+ bool bCJK = true;
switch (charset) {
case FXFONT_SHIFTJIS_CHARSET: {
size_t index = GetJapanesePreference(cstr_face, weight, pitch_family);
@@ -133,7 +133,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight,
break;
}
default:
- bCJK = FALSE;
+ bCJK = false;
break;
}
return FindFont(weight, bItalic, charset, pitch_family, cstr_face, !bCJK);
@@ -151,13 +151,13 @@ std::unique_ptr<IFX_SystemFontInfo> IFX_SystemFontInfo::CreateDefault(
return std::unique_ptr<IFX_SystemFontInfo>(pInfo);
}
-FX_BOOL CFX_LinuxFontInfo::ParseFontCfg(const char** pUserPaths) {
+bool CFX_LinuxFontInfo::ParseFontCfg(const char** pUserPaths) {
if (!pUserPaths)
- return FALSE;
+ return false;
for (const char** pPath = pUserPaths; *pPath; ++pPath)
AddPath(*pPath);
- return TRUE;
+ return true;
}
void CFX_GEModule::InitPlatform() {
diff --git a/core/fxge/ifx_renderdevicedriver.cpp b/core/fxge/ifx_renderdevicedriver.cpp
index 6ae1432a11..07a4c27277 100644
--- a/core/fxge/ifx_renderdevicedriver.cpp
+++ b/core/fxge/ifx_renderdevicedriver.cpp
@@ -16,62 +16,61 @@ CFX_Matrix IFX_RenderDeviceDriver::GetCTM() const {
return CFX_Matrix();
}
-FX_BOOL IFX_RenderDeviceDriver::StartRendering() {
- return TRUE;
+bool IFX_RenderDeviceDriver::StartRendering() {
+ return true;
}
void IFX_RenderDeviceDriver::EndRendering() {}
-FX_BOOL IFX_RenderDeviceDriver::SetClip_PathStroke(
+bool IFX_RenderDeviceDriver::SetClip_PathStroke(
const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device,
const CFX_GraphStateData* pGraphState) {
- return FALSE;
+ return false;
}
-FX_BOOL IFX_RenderDeviceDriver::SetPixel(int x, int y, uint32_t color) {
- return FALSE;
+bool IFX_RenderDeviceDriver::SetPixel(int x, int y, uint32_t color) {
+ return false;
}
-FX_BOOL IFX_RenderDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
- uint32_t fill_color,
- int blend_type) {
- return FALSE;
+bool IFX_RenderDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) {
+ return false;
}
-FX_BOOL IFX_RenderDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- uint32_t color,
- int blend_type) {
- return FALSE;
+bool IFX_RenderDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
+ FX_FLOAT y1,
+ FX_FLOAT x2,
+ FX_FLOAT y2,
+ uint32_t color,
+ int blend_type) {
+ return false;
}
-FX_BOOL IFX_RenderDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap,
- int left,
- int top) {
- return FALSE;
+bool IFX_RenderDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap,
+ int left,
+ int top) {
+ return false;
}
CFX_DIBitmap* IFX_RenderDeviceDriver::GetBackDrop() {
return nullptr;
}
-FX_BOOL IFX_RenderDeviceDriver::ContinueDIBits(void* handle,
- IFX_Pause* pPause) {
- return FALSE;
+bool IFX_RenderDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) {
+ return false;
}
void IFX_RenderDeviceDriver::CancelDIBits(void* handle) {}
-FX_BOOL IFX_RenderDeviceDriver::DrawDeviceText(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t color) {
- return FALSE;
+bool IFX_RenderDeviceDriver::DrawDeviceText(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t color) {
+ return false;
}
void* IFX_RenderDeviceDriver::GetPlatformSurface() const {
@@ -84,11 +83,11 @@ int IFX_RenderDeviceDriver::GetDriverType() const {
void IFX_RenderDeviceDriver::ClearDriver() {}
-FX_BOOL IFX_RenderDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern,
- const CFX_Matrix* pMatrix,
- const FX_RECT& clip_rect,
- int alpha,
- FX_BOOL bAlphaMode) {
+bool IFX_RenderDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern,
+ const CFX_Matrix* pMatrix,
+ const FX_RECT& clip_rect,
+ int alpha,
+ bool bAlphaMode) {
return false;
}
diff --git a/core/fxge/ifx_renderdevicedriver.h b/core/fxge/ifx_renderdevicedriver.h
index 84e3ebc97b..6a99276eba 100644
--- a/core/fxge/ifx_renderdevicedriver.h
+++ b/core/fxge/ifx_renderdevicedriver.h
@@ -27,76 +27,76 @@ class IFX_RenderDeviceDriver {
virtual int GetDeviceCaps(int caps_id) const = 0;
virtual CFX_Matrix GetCTM() const;
- virtual FX_BOOL StartRendering();
+ virtual bool StartRendering();
virtual void EndRendering();
virtual void SaveState() = 0;
virtual void RestoreState(bool bKeepSaved) = 0;
- virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- int fill_mode) = 0;
- virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState);
- virtual FX_BOOL DrawPath(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- int fill_mode,
- int blend_type) = 0;
- virtual FX_BOOL SetPixel(int x, int y, uint32_t color);
- virtual FX_BOOL FillRectWithBlend(const FX_RECT* pRect,
- uint32_t fill_color,
- int blend_type);
- virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- uint32_t color,
- int blend_type);
+ virtual bool SetClip_PathFill(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ int fill_mode) = 0;
+ virtual bool SetClip_PathStroke(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState);
+ virtual bool DrawPath(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ int fill_mode,
+ int blend_type) = 0;
+ virtual bool SetPixel(int x, int y, uint32_t color);
+ virtual bool FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type);
+ virtual bool DrawCosmeticLine(FX_FLOAT x1,
+ FX_FLOAT y1,
+ FX_FLOAT x2,
+ FX_FLOAT y2,
+ uint32_t color,
+ int blend_type);
- virtual FX_BOOL GetClipBox(FX_RECT* pRect) = 0;
- virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top);
+ virtual bool GetClipBox(FX_RECT* pRect) = 0;
+ virtual bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top);
virtual CFX_DIBitmap* GetBackDrop();
- virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
- uint32_t color,
- const FX_RECT* pSrcRect,
- int dest_left,
- int dest_top,
- int blend_type) = 0;
- virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
- uint32_t color,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- uint32_t flags,
- int blend_type) = 0;
- virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
- int bitmap_alpha,
- uint32_t color,
- const CFX_Matrix* pMatrix,
- uint32_t flags,
- void*& handle,
- int blend_type) = 0;
- virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause);
+ virtual bool SetDIBits(const CFX_DIBSource* pBitmap,
+ uint32_t color,
+ const FX_RECT* pSrcRect,
+ int dest_left,
+ int dest_top,
+ int blend_type) = 0;
+ virtual bool StretchDIBits(const CFX_DIBSource* pBitmap,
+ uint32_t color,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ uint32_t flags,
+ int blend_type) = 0;
+ virtual bool StartDIBits(const CFX_DIBSource* pBitmap,
+ int bitmap_alpha,
+ uint32_t color,
+ const CFX_Matrix* pMatrix,
+ uint32_t flags,
+ void*& handle,
+ int blend_type) = 0;
+ virtual bool ContinueDIBits(void* handle, IFX_Pause* pPause);
virtual void CancelDIBits(void* handle);
- virtual FX_BOOL DrawDeviceText(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t color);
+ virtual bool DrawDeviceText(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t color);
virtual void* GetPlatformSurface() const;
virtual int GetDriverType() const;
virtual void ClearDriver();
- virtual FX_BOOL DrawShading(const CPDF_ShadingPattern* pPattern,
- const CFX_Matrix* pMatrix,
- const FX_RECT& clip_rect,
- int alpha,
- FX_BOOL bAlphaMode);
+ virtual bool DrawShading(const CPDF_ShadingPattern* pPattern,
+ const CFX_Matrix* pMatrix,
+ const FX_RECT& clip_rect,
+ int alpha,
+ bool bAlphaMode);
virtual bool SetBitsWithMask(const CFX_DIBSource* pBitmap,
const CFX_DIBSource* pMask,
int left,
diff --git a/core/fxge/ifx_systemfontinfo.h b/core/fxge/ifx_systemfontinfo.h
index 5eb3147c54..640a11a57b 100644
--- a/core/fxge/ifx_systemfontinfo.h
+++ b/core/fxge/ifx_systemfontinfo.h
@@ -20,9 +20,9 @@ class IFX_SystemFontInfo {
virtual ~IFX_SystemFontInfo() {}
- virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0;
+ virtual bool EnumFontList(CFX_FontMapper* pMapper) = 0;
virtual void* MapFont(int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int charset,
int pitch_family,
const FX_CHAR* face,
@@ -31,7 +31,7 @@ class IFX_SystemFontInfo {
#ifdef PDF_ENABLE_XFA
virtual void* MapFontByUnicode(uint32_t dwUnicode,
int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int pitch_family);
#endif // PDF_ENABLE_XFA
@@ -40,8 +40,8 @@ class IFX_SystemFontInfo {
uint32_t table,
uint8_t* buffer,
uint32_t size) = 0;
- virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0;
- virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0;
+ virtual bool GetFaceName(void* hFont, CFX_ByteString& name) = 0;
+ virtual bool GetFontCharset(void* hFont, int& charset) = 0;
virtual int GetFaceIndex(void* hFont);
virtual void DeleteFont(void* hFont) = 0;
};
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index f3349c906a..5e91fbd8c3 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -942,9 +942,9 @@ void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint,
}
CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap,
- FX_BOOL bRgbByteOrder,
+ bool bRgbByteOrder,
CFX_DIBitmap* pOriDevice,
- FX_BOOL bGroupKnockout)
+ bool bGroupKnockout)
: m_pBitmap(pBitmap),
m_pOriDevice(pOriDevice),
m_pRecorder(nullptr),
@@ -969,7 +969,7 @@ CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(int size_x, int size_y)
m_pOriDevice(nullptr),
m_pRecorder(new SkPictureRecorder),
m_pCache(new SkiaState),
- m_bGroupKnockout(FALSE) {
+ m_bGroupKnockout(false) {
m_pRecorder->beginRecording(SkIntToScalar(size_x), SkIntToScalar(size_y));
m_pCanvas = m_pRecorder->getRecordingCanvas();
}
@@ -979,7 +979,7 @@ CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(SkPictureRecorder* recorder)
m_pOriDevice(nullptr),
m_pRecorder(recorder),
m_pCache(new SkiaState),
- m_bGroupKnockout(FALSE) {
+ m_bGroupKnockout(false) {
m_pCanvas = m_pRecorder->getRecordingCanvas();
}
@@ -994,15 +994,15 @@ void CFX_SkiaDeviceDriver::Flush() {
m_pCache->FlushCommands(this);
}
-FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t color) {
+bool CFX_SkiaDeviceDriver::DrawDeviceText(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t color) {
if (m_pCache->DrawText(nChars, pCharPos, pFont, pObject2Device, font_size,
color, this)) {
- return TRUE;
+ return true;
}
sk_sp<SkTypeface> typeface(SkSafeRef(pFont->GetDeviceCache()));
SkPaint paint;
@@ -1028,7 +1028,7 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars,
}
m_pCanvas->drawPosText(glyphs.begin(), nChars * 2, positions.begin(), paint);
m_pCanvas->restore();
- return TRUE;
+ return true;
}
int CFX_SkiaDeviceDriver::GetDeviceCaps(int caps_id) const {
@@ -1064,7 +1064,7 @@ void CFX_SkiaDeviceDriver::RestoreState(bool bKeepSaved) {
SaveState();
}
-FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill(
+bool CFX_SkiaDeviceDriver::SetClip_PathFill(
const CFX_PathData* pPathData, // path info
const CFX_Matrix* pObject2Device, // flips object's y-axis
int fill_mode // fill mode, WINDING or ALTERNATE
@@ -1072,7 +1072,7 @@ FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill(
CFX_Matrix identity;
const CFX_Matrix* deviceMatrix = pObject2Device ? pObject2Device : &identity;
if (m_pCache->SetClipFill(pPathData, deviceMatrix, fill_mode, this))
- return TRUE;
+ return true;
if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) {
CFX_FloatRect rectf;
if (pPathData->IsRect(deviceMatrix, &rectf)) {
@@ -1084,7 +1084,7 @@ FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill(
SkRect::MakeLTRB(rectf.left, rectf.bottom, rectf.right, rectf.top);
DebugDrawSkiaClipRect(m_pCanvas, skClipRect);
m_pCanvas->clipRect(skClipRect, SkCanvas::kIntersect_Op, true);
- return TRUE;
+ return true;
}
}
SkPath skClipPath = BuildPath(pPathData);
@@ -1097,16 +1097,16 @@ FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill(
DebugDrawSkiaClipPath(m_pCanvas, skClipPath);
m_pCanvas->clipPath(skClipPath, SkCanvas::kIntersect_Op, true);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathStroke(
+bool CFX_SkiaDeviceDriver::SetClip_PathStroke(
const CFX_PathData* pPathData, // path info
const CFX_Matrix* pObject2Device, // optional transformation
const CFX_GraphStateData* pGraphState // graphic state, for pen attributes
) {
if (m_pCache->SetClipStroke(pPathData, pObject2Device, pGraphState, this))
- return TRUE;
+ return true;
// build path data
SkPath skPath = BuildPath(pPathData);
SkMatrix skMatrix = ToSkMatrix(*pObject2Device);
@@ -1117,10 +1117,10 @@ FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathStroke(
dst_path.transform(skMatrix);
DebugDrawSkiaClipPath(m_pCanvas, dst_path);
m_pCanvas->clipPath(dst_path, SkCanvas::kIntersect_Op, true);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_SkiaDeviceDriver::DrawPath(
+bool CFX_SkiaDeviceDriver::DrawPath(
const CFX_PathData* pPathData, // path info
const CFX_Matrix* pObject2Device, // optional transformation
const CFX_GraphStateData* pGraphState, // graphic state, for pen attributes
@@ -1130,7 +1130,7 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawPath(
int blend_type) {
if (m_pCache->DrawPath(pPathData, pObject2Device, pGraphState, fill_color,
stroke_color, fill_mode, blend_type, this)) {
- return TRUE;
+ return true;
}
SkIRect rect;
rect.set(0, 0, GetDeviceCaps(FXDC_PIXEL_WIDTH),
@@ -1177,21 +1177,21 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawPath(
m_pCanvas->drawPath(skPath, skPaint);
}
m_pCanvas->restore();
- return TRUE;
+ return true;
}
-FX_BOOL CFX_SkiaDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- uint32_t color,
- int blend_type) {
- return FALSE;
+bool CFX_SkiaDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
+ FX_FLOAT y1,
+ FX_FLOAT x2,
+ FX_FLOAT y2,
+ uint32_t color,
+ int blend_type) {
+ return false;
}
-FX_BOOL CFX_SkiaDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
- uint32_t fill_color,
- int blend_type) {
+bool CFX_SkiaDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) {
SkPaint spaint;
spaint.setAntiAlias(true);
spaint.setColor(fill_color);
@@ -1200,14 +1200,14 @@ FX_BOOL CFX_SkiaDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
m_pCanvas->drawRect(
SkRect::MakeLTRB(pRect->left, pRect->top, pRect->right, pRect->bottom),
spaint);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern,
- const CFX_Matrix* pMatrix,
- const FX_RECT& clip_rect,
- int alpha,
- FX_BOOL bAlphaMode) {
+bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern,
+ const CFX_Matrix* pMatrix,
+ const FX_RECT& clip_rect,
+ int alpha,
+ bool bAlphaMode) {
if (kAxialShading != pPattern->GetShadingType() &&
kRadialShading != pPattern->GetShadingType()) {
// TODO(caryclark) more types
@@ -1341,24 +1341,22 @@ uint8_t* CFX_SkiaDeviceDriver::GetBuffer() const {
return m_pBitmap->GetBuffer();
}
-FX_BOOL CFX_SkiaDeviceDriver::GetClipBox(FX_RECT* pRect) {
+bool CFX_SkiaDeviceDriver::GetClipBox(FX_RECT* pRect) {
// TODO(caryclark) call m_canvas->getClipDeviceBounds() instead
pRect->left = 0;
pRect->top = 0;
const SkImageInfo& canvasSize = m_pCanvas->imageInfo();
pRect->right = canvasSize.width();
pRect->bottom = canvasSize.height();
- return TRUE;
+ return true;
}
-FX_BOOL CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap,
- int left,
- int top) {
+bool CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
if (!m_pBitmap)
- return TRUE;
+ return true;
uint8_t* srcBuffer = m_pBitmap->GetBuffer();
if (!srcBuffer)
- return TRUE;
+ return true;
int srcWidth = m_pBitmap->GetWidth();
int srcHeight = m_pBitmap->GetHeight();
int srcRowBytes = srcWidth * sizeof(uint32_t);
@@ -1380,21 +1378,21 @@ FX_BOOL CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap,
nullptr, nullptr);
SkCanvas canvas(skDstBitmap);
canvas.drawBitmap(skSrcBitmap, left, top, nullptr);
- return TRUE;
+ return true;
}
CFX_DIBitmap* CFX_SkiaDeviceDriver::GetBackDrop() {
return m_pOriDevice;
}
-FX_BOOL CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
- uint32_t argb,
- const FX_RECT* pSrcRect,
- int left,
- int top,
- int blend_type) {
+bool CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
+ uint32_t argb,
+ const FX_RECT* pSrcRect,
+ int left,
+ int top,
+ int blend_type) {
if (!m_pBitmap || !m_pBitmap->GetBuffer())
- return TRUE;
+ return true;
CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), left,
top + pBitmap->GetHeight());
@@ -1402,17 +1400,17 @@ FX_BOOL CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
return StartDIBits(pBitmap, 0xFF, argb, &m, 0, dummy, blend_type);
}
-FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
- uint32_t argb,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- uint32_t flags,
- int blend_type) {
+bool CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
+ uint32_t argb,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ uint32_t flags,
+ int blend_type) {
if (!m_pBitmap->GetBuffer())
- return TRUE;
+ return true;
CFX_Matrix m(dest_width, 0, 0, -dest_height, dest_left,
dest_top + dest_height);
@@ -1421,19 +1419,19 @@ FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
pClipRect->right, pClipRect->top);
m_pCanvas->clipRect(skClipRect, SkCanvas::kIntersect_Op, true);
void* dummy;
- FX_BOOL result = StartDIBits(pSource, 0xFF, argb, &m, 0, dummy, blend_type);
+ bool result = StartDIBits(pSource, 0xFF, argb, &m, 0, dummy, blend_type);
m_pCanvas->restore();
return result;
}
-FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource,
- int bitmap_alpha,
- uint32_t argb,
- const CFX_Matrix* pMatrix,
- uint32_t render_flags,
- void*& handle,
- int blend_type) {
+bool CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource,
+ int bitmap_alpha,
+ uint32_t argb,
+ const CFX_Matrix* pMatrix,
+ uint32_t render_flags,
+ void*& handle,
+ int blend_type) {
DebugValidate(m_pBitmap, m_pOriDevice);
SkColorTable* ct = nullptr;
std::unique_ptr<uint8_t, FxFreeDeleter> dst8Storage;
@@ -1442,7 +1440,7 @@ FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource,
int width, height;
if (!Upsample(pSource, dst8Storage, dst32Storage, &ct, &skBitmap, &width,
&height, false)) {
- return FALSE;
+ return false;
}
m_pCanvas->save();
SkMatrix skMatrix;
@@ -1472,11 +1470,11 @@ FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource,
if (ct)
ct->unref();
DebugValidate(m_pBitmap, m_pOriDevice);
- return TRUE;
+ return true;
}
-FX_BOOL CFX_SkiaDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) {
- return FALSE;
+bool CFX_SkiaDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) {
+ return false;
}
void CFX_SkiaDeviceDriver::PreMultiply(CFX_DIBitmap* pDIBitmap) {
@@ -1573,7 +1571,7 @@ void CFX_SkiaDeviceDriver::DebugVerifyBitmapIsPreMultiplied() const {
}
CFX_FxgeDevice::CFX_FxgeDevice() {
- m_bOwnedBitmap = FALSE;
+ m_bOwnedBitmap = false;
}
void CFX_FxgeDevice::Clear(uint32_t color) {
@@ -1611,7 +1609,7 @@ bool CFX_FxgeDevice::Create(int width,
int height,
FXDIB_Format format,
CFX_DIBitmap* pOriDevice) {
- m_bOwnedBitmap = TRUE;
+ m_bOwnedBitmap = true;
CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
if (!pBitmap->Create(width, height, format)) {
delete pBitmap;
diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h
index eb5063aafb..199e76689a 100644
--- a/core/fxge/skia/fx_skia_device.h
+++ b/core/fxge/skia/fx_skia_device.h
@@ -22,9 +22,9 @@ struct SkIRect;
class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
public:
CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap,
- FX_BOOL bRgbByteOrder,
+ bool bRgbByteOrder,
CFX_DIBitmap* pOriDevice,
- FX_BOOL bGroupKnockout);
+ bool bGroupKnockout);
explicit CFX_SkiaDeviceDriver(SkPictureRecorder* recorder);
CFX_SkiaDeviceDriver(int size_x, int size_y);
~CFX_SkiaDeviceDriver() override;
@@ -37,13 +37,13 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
void RestoreState(bool bKeepSaved) override;
/** Set clipping path using filled region */
- FX_BOOL SetClip_PathFill(
+ bool SetClip_PathFill(
const CFX_PathData* pPathData, // path info
const CFX_Matrix* pObject2Device, // optional transformation
int fill_mode) override; // fill mode, WINDING or ALTERNATE
/** Set clipping path using stroked region */
- FX_BOOL SetClip_PathStroke(
+ bool SetClip_PathStroke(
const CFX_PathData* pPathData, // path info
const CFX_Matrix* pObject2Device, // optional transformation
const CFX_GraphStateData*
@@ -51,64 +51,64 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
override;
/** Draw a path */
- FX_BOOL DrawPath(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- int fill_mode,
- int blend_type) override;
-
- FX_BOOL FillRectWithBlend(const FX_RECT* pRect,
- uint32_t fill_color,
- int blend_type) override;
+ bool DrawPath(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ int fill_mode,
+ int blend_type) override;
+
+ bool FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) override;
/** Draw a single pixel (device dependant) line */
- FX_BOOL DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- uint32_t color,
- int blend_type) override;
+ bool DrawCosmeticLine(FX_FLOAT x1,
+ FX_FLOAT y1,
+ FX_FLOAT x2,
+ FX_FLOAT y2,
+ uint32_t color,
+ int blend_type) override;
- FX_BOOL GetClipBox(FX_RECT* pRect) override;
+ bool GetClipBox(FX_RECT* pRect) override;
/** Load device buffer into a DIB */
- FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override;
+ bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override;
CFX_DIBitmap* GetBackDrop() override;
- FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
- uint32_t color,
- const FX_RECT* pSrcRect,
- int dest_left,
- int dest_top,
- int blend_type) override;
+ bool SetDIBits(const CFX_DIBSource* pBitmap,
+ uint32_t color,
+ const FX_RECT* pSrcRect,
+ int dest_left,
+ int dest_top,
+ int blend_type) override;
bool SetBitsWithMask(const CFX_DIBSource* pBitmap,
const CFX_DIBSource* pMask,
int dest_left,
int dest_top,
int bitmap_alpha,
int blend_type) override;
- FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
- uint32_t color,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- uint32_t flags,
- int blend_type) override;
-
- FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
- int bitmap_alpha,
- uint32_t color,
- const CFX_Matrix* pMatrix,
- uint32_t flags,
- void*& handle,
- int blend_type) override;
+ bool StretchDIBits(const CFX_DIBSource* pBitmap,
+ uint32_t color,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ uint32_t flags,
+ int blend_type) override;
+
+ bool StartDIBits(const CFX_DIBSource* pBitmap,
+ int bitmap_alpha,
+ uint32_t color,
+ const CFX_Matrix* pMatrix,
+ uint32_t flags,
+ void*& handle,
+ int blend_type) override;
- FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) override;
+ bool ContinueDIBits(void* handle, IFX_Pause* pPause) override;
void CancelDIBits(void* handle) override {}
@@ -118,18 +118,18 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
const CFX_Matrix* pMatrix,
int blend_type);
- FX_BOOL DrawDeviceText(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t color) override;
+ bool DrawDeviceText(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t color) override;
- FX_BOOL DrawShading(const CPDF_ShadingPattern* pPattern,
- const CFX_Matrix* pMatrix,
- const FX_RECT& clip_rect,
- int alpha,
- FX_BOOL bAlphaMode) override;
+ bool DrawShading(const CPDF_ShadingPattern* pPattern,
+ const CFX_Matrix* pMatrix,
+ const FX_RECT& clip_rect,
+ int alpha,
+ bool bAlphaMode) override;
virtual uint8_t* GetBuffer() const;
@@ -152,7 +152,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
SkCanvas* m_pCanvas;
SkPictureRecorder* const m_pRecorder;
std::unique_ptr<SkiaState> m_pCache;
- FX_BOOL m_bGroupKnockout;
+ bool m_bGroupKnockout;
};
#endif // defined(_SKIA_SUPPORT_)
diff --git a/core/fxge/win32/dwrite_int.h b/core/fxge/win32/dwrite_int.h
index f49fda44dd..86ead89947 100644
--- a/core/fxge/win32/dwrite_int.h
+++ b/core/fxge/win32/dwrite_int.h
@@ -34,26 +34,26 @@ class CDWriteExt {
void Load();
void Unload();
- FX_BOOL IsAvailable() { return !!m_pDWriteFactory; }
+ bool IsAvailable() { return !!m_pDWriteFactory; }
void* DwCreateFontFaceFromStream(uint8_t* pData,
uint32_t size,
int simulation_style);
- FX_BOOL DwCreateRenderingTarget(CFX_DIBitmap* pSrc, void** renderTarget);
+ bool DwCreateRenderingTarget(CFX_DIBitmap* pSrc, void** renderTarget);
void DwDeleteRenderingTarget(void* renderTarget);
- FX_BOOL DwRendingString(void* renderTarget,
- CFX_ClipRgn* pClipRgn,
- FX_RECT& stringRect,
- CFX_Matrix* pMatrix,
- void* font,
- FX_FLOAT font_size,
- FX_ARGB text_color,
- int glyph_count,
- unsigned short* glyph_indices,
- FX_FLOAT baselineOriginX,
- FX_FLOAT baselineOriginY,
- void* glyph_offsets,
- FX_FLOAT* glyph_advances);
+ bool DwRendingString(void* renderTarget,
+ CFX_ClipRgn* pClipRgn,
+ FX_RECT& stringRect,
+ CFX_Matrix* pMatrix,
+ void* font,
+ FX_FLOAT font_size,
+ FX_ARGB text_color,
+ int glyph_count,
+ unsigned short* glyph_indices,
+ FX_FLOAT baselineOriginX,
+ FX_FLOAT baselineOriginY,
+ void* glyph_offsets,
+ FX_FLOAT* glyph_advances);
void DwDeleteFont(void* pFont);
protected:
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index 900828c3fc..004f344d67 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -319,7 +319,7 @@ unsigned clip_liang_barsky(FX_FLOAT x1,
}
#endif // _SKIA_SUPPORT_
-FX_BOOL MatrixNoScaled(const CFX_Matrix* pMatrix) {
+bool MatrixNoScaled(const CFX_Matrix* pMatrix) {
return pMatrix->GetA() == 1.0f && pMatrix->GetB() == 0 &&
pMatrix->GetC() == 0 && pMatrix->GetD() == 1.0f;
}
@@ -331,7 +331,7 @@ class CFX_Win32FallbackFontInfo final : public CFX_FolderFontInfo {
// CFX_FolderFontInfo:
void* MapFont(int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int charset,
int pitch_family,
const FX_CHAR* family,
@@ -344,9 +344,9 @@ class CFX_Win32FontInfo final : public IFX_SystemFontInfo {
~CFX_Win32FontInfo() override;
// IFX_SystemFontInfo
- FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override;
+ bool EnumFontList(CFX_FontMapper* pMapper) override;
void* MapFont(int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int charset,
int pitch_family,
const FX_CHAR* face,
@@ -356,12 +356,12 @@ class CFX_Win32FontInfo final : public IFX_SystemFontInfo {
uint32_t table,
uint8_t* buffer,
uint32_t size) override;
- FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override;
- FX_BOOL GetFontCharset(void* hFont, int& charset) override;
+ bool GetFaceName(void* hFont, CFX_ByteString& name) override;
+ bool GetFontCharset(void* hFont, int& charset) override;
void DeleteFont(void* hFont) override;
- FX_BOOL IsOpenTypeFromDiv(const LOGFONTA* plf);
- FX_BOOL IsSupportFontFormDiv(const LOGFONTA* plf);
+ bool IsOpenTypeFromDiv(const LOGFONTA* plf);
+ bool IsSupportFontFormDiv(const LOGFONTA* plf);
void AddInstalledFont(const LOGFONTA* plf, uint32_t FontType);
void GetGBPreference(CFX_ByteString& face, int weight, int picth_family);
void GetJapanesePreference(CFX_ByteString& face,
@@ -390,9 +390,9 @@ CFX_Win32FontInfo::~CFX_Win32FontInfo() {
DeleteDC(m_hDC);
}
-FX_BOOL CFX_Win32FontInfo::IsOpenTypeFromDiv(const LOGFONTA* plf) {
+bool CFX_Win32FontInfo::IsOpenTypeFromDiv(const LOGFONTA* plf) {
HFONT hFont = CreateFontIndirectA(plf);
- FX_BOOL ret = FALSE;
+ bool ret = false;
uint32_t font_size = GetFontData(hFont, 0, nullptr, 0);
if (font_size != GDI_ERROR && font_size >= sizeof(uint32_t)) {
uint32_t lVersion = 0;
@@ -404,16 +404,16 @@ FX_BOOL CFX_Win32FontInfo::IsOpenTypeFromDiv(const LOGFONTA* plf) {
if (lVersion == FXBSTR_ID('O', 'T', 'T', 'O') || lVersion == 0x00010000 ||
lVersion == FXBSTR_ID('t', 't', 'c', 'f') ||
lVersion == FXBSTR_ID('t', 'r', 'u', 'e') || lVersion == 0x00020000) {
- ret = TRUE;
+ ret = true;
}
}
DeleteFont(hFont);
return ret;
}
-FX_BOOL CFX_Win32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) {
+bool CFX_Win32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) {
HFONT hFont = CreateFontIndirectA(plf);
- FX_BOOL ret = FALSE;
+ bool ret = false;
uint32_t font_size = GetFontData(hFont, 0, nullptr, 0);
if (font_size != GDI_ERROR && font_size >= sizeof(uint32_t)) {
uint32_t lVersion = 0;
@@ -427,7 +427,7 @@ FX_BOOL CFX_Win32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) {
lVersion == FXBSTR_ID('t', 'r', 'u', 'e') || lVersion == 0x00020000 ||
(lVersion & 0xFFFF0000) == FXBSTR_ID(0x80, 0x01, 0x00, 0x00) ||
(lVersion & 0xFFFF0000) == FXBSTR_ID('%', '!', 0, 0)) {
- ret = TRUE;
+ ret = true;
}
}
DeleteFont(hFont);
@@ -453,7 +453,7 @@ void CFX_Win32FontInfo::AddInstalledFont(const LOGFONTA* plf,
m_LastFamily = name;
}
-FX_BOOL CFX_Win32FontInfo::EnumFontList(CFX_FontMapper* pMapper) {
+bool CFX_Win32FontInfo::EnumFontList(CFX_FontMapper* pMapper) {
m_pMapper = pMapper;
LOGFONTA lf;
FXSYS_memset(&lf, 0, sizeof(LOGFONTA));
@@ -462,7 +462,7 @@ FX_BOOL CFX_Win32FontInfo::EnumFontList(CFX_FontMapper* pMapper) {
lf.lfPitchAndFamily = 0;
EnumFontFamiliesExA(m_hDC, &lf, (FONTENUMPROCA)FontEnumProc, (uintptr_t) this,
0);
- return TRUE;
+ return true;
}
CFX_ByteString CFX_Win32FontInfo::FindFont(const CFX_ByteString& name) {
@@ -483,7 +483,7 @@ CFX_ByteString CFX_Win32FontInfo::FindFont(const CFX_ByteString& name) {
}
void* CFX_Win32FallbackFontInfo::MapFont(int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int charset,
int pitch_family,
const FX_CHAR* cstr_face,
@@ -493,14 +493,14 @@ void* CFX_Win32FallbackFontInfo::MapFont(int weight,
iExact = 1;
return font;
}
- FX_BOOL bCJK = TRUE;
+ bool bCJK = true;
switch (charset) {
case FXFONT_SHIFTJIS_CHARSET:
case FXFONT_GB2312_CHARSET:
case FXFONT_CHINESEBIG5_CHARSET:
case FXFONT_HANGUL_CHARSET:
default:
- bCJK = FALSE;
+ bCJK = false;
break;
}
return FindFont(weight, bItalic, charset, pitch_family, cstr_face, !bCJK);
@@ -575,7 +575,7 @@ void CFX_Win32FontInfo::GetJapanesePreference(CFX_ByteString& face,
}
void* CFX_Win32FontInfo::MapFont(int weight,
- FX_BOOL bItalic,
+ bool bItalic,
int charset,
int pitch_family,
const FX_CHAR* cstr_face,
@@ -587,7 +587,7 @@ void* CFX_Win32FontInfo::MapFont(int weight,
face = g_Base14Substs[iBaseFont].m_pWinName;
weight = g_Base14Substs[iBaseFont].m_bBold ? FW_BOLD : FW_NORMAL;
bItalic = g_Base14Substs[iBaseFont].m_bItalic;
- iExact = TRUE;
+ iExact = true;
break;
}
if (charset == FXFONT_ANSI_CHARSET || charset == FXFONT_SYMBOL_CHARSET) {
@@ -672,25 +672,25 @@ uint32_t CFX_Win32FontInfo::GetFontData(void* hFont,
return size;
}
-FX_BOOL CFX_Win32FontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
+bool CFX_Win32FontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
char facebuf[100];
HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont);
int ret = ::GetTextFaceA(m_hDC, 100, facebuf);
::SelectObject(m_hDC, hOldFont);
if (ret == 0) {
- return FALSE;
+ return false;
}
name = facebuf;
- return TRUE;
+ return true;
}
-FX_BOOL CFX_Win32FontInfo::GetFontCharset(void* hFont, int& charset) {
+bool CFX_Win32FontInfo::GetFontCharset(void* hFont, int& charset) {
TEXTMETRIC tm;
HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont);
::GetTextMetrics(m_hDC, &tm);
::SelectObject(m_hDC, hOldFont);
charset = tm.tmCharSet;
- return TRUE;
+ return true;
}
} // namespace
@@ -787,17 +787,17 @@ void CGdiDeviceDriver::RestoreState(bool bKeepSaved) {
SaveDC(m_hDC);
}
-FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1,
- const FX_RECT* pSrcRect,
- int left,
- int top) {
+bool CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1,
+ const FX_RECT* pSrcRect,
+ int left,
+ int top) {
if (m_DeviceClass == FXDC_PRINTER) {
- std::unique_ptr<CFX_DIBitmap> pBitmap(pBitmap1->FlipImage(FALSE, TRUE));
+ std::unique_ptr<CFX_DIBitmap> pBitmap(pBitmap1->FlipImage(false, true));
if (!pBitmap)
- return FALSE;
+ return false;
if (pBitmap->IsCmykImage() && !pBitmap->ConvertFormat(FXDIB_Rgb))
- return FALSE;
+ return false;
int width = pSrcRect->Width(), height = pSrcRect->Height();
LPBYTE pBuffer = pBitmap->GetBuffer();
@@ -815,7 +815,7 @@ FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1,
if (pBitmap->IsCmykImage()) {
pBitmap = pBitmap->CloneConvert(FXDIB_Rgb);
if (!pBitmap)
- return FALSE;
+ return false;
}
int width = pSrcRect->Width(), height = pSrcRect->Height();
LPBYTE pBuffer = pBitmap->GetBuffer();
@@ -828,21 +828,21 @@ FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1,
delete pBitmap;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(CFX_DIBitmap* pBitmap1,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- uint32_t flags) {
+bool CGdiDeviceDriver::GDI_StretchDIBits(CFX_DIBitmap* pBitmap1,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ uint32_t flags) {
CFX_DIBitmap* pBitmap = pBitmap1;
if (!pBitmap || dest_width == 0 || dest_height == 0)
- return FALSE;
+ return false;
if (pBitmap->IsCmykImage() && !pBitmap->ConvertFormat(FXDIB_Rgb))
- return FALSE;
+ return false;
CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
if ((int64_t)abs(dest_width) * abs(dest_height) <
@@ -869,19 +869,19 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(CFX_DIBitmap* pBitmap1,
SRCCOPY);
if (del)
delete pToStrechBitmap;
- return TRUE;
+ return true;
}
-FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(CFX_DIBitmap* pBitmap1,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- uint32_t bitmap_color,
- uint32_t flags) {
+bool CGdiDeviceDriver::GDI_StretchBitMask(CFX_DIBitmap* pBitmap1,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ uint32_t bitmap_color,
+ uint32_t flags) {
CFX_DIBitmap* pBitmap = pBitmap1;
if (!pBitmap || dest_width == 0 || dest_height == 0)
- return FALSE;
+ return false;
int width = pBitmap->GetWidth(), height = pBitmap->GetHeight();
struct {
@@ -929,10 +929,10 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(CFX_DIBitmap* pBitmap1,
SelectObject(m_hDC, hOld);
DeleteObject(hPattern);
- return TRUE;
+ return true;
}
-FX_BOOL CGdiDeviceDriver::GetClipBox(FX_RECT* pRect) {
+bool CGdiDeviceDriver::GetClipBox(FX_RECT* pRect) {
return !!(::GetClipBox(m_hDC, (RECT*)pRect));
}
@@ -986,15 +986,15 @@ void CGdiDeviceDriver::DrawLine(FX_FLOAT x1,
LineTo(m_hDC, FXSYS_round(x2), FXSYS_round(y2));
}
-FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData,
- const CFX_Matrix* pMatrix,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- int fill_mode,
- int blend_type) {
+bool CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData,
+ const CFX_Matrix* pMatrix,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ int fill_mode,
+ int blend_type) {
if (blend_type != FXDIB_BLEND_NORMAL)
- return FALSE;
+ return false;
CWin32Platform* pPlatform =
(CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
@@ -1018,10 +1018,10 @@ FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData,
}
int fill_alpha = FXARGB_A(fill_color);
int stroke_alpha = FXARGB_A(stroke_color);
- FX_BOOL bDrawAlpha = (fill_alpha > 0 && fill_alpha < 255) ||
- (stroke_alpha > 0 && stroke_alpha < 255 && pGraphState);
+ bool bDrawAlpha = (fill_alpha > 0 && fill_alpha < 255) ||
+ (stroke_alpha > 0 && stroke_alpha < 255 && pGraphState);
if (!pPlatform->m_GdiplusExt.IsAvailable() && bDrawAlpha)
- return FALSE;
+ return false;
if (pPlatform->m_GdiplusExt.IsAvailable()) {
if (bDrawAlpha ||
@@ -1035,7 +1035,7 @@ FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData,
if (pPlatform->m_GdiplusExt.DrawPath(m_hDC, pPathData, pMatrix,
pGraphState, fill_color,
stroke_color, fill_mode)) {
- return TRUE;
+ return true;
}
}
}
@@ -1087,48 +1087,48 @@ FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData,
hBrush = (HBRUSH)SelectObject(m_hDC, hBrush);
DeleteObject(hBrush);
}
- return TRUE;
+ return true;
}
-FX_BOOL CGdiDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
- uint32_t fill_color,
- int blend_type) {
+bool CGdiDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) {
if (blend_type != FXDIB_BLEND_NORMAL)
- return FALSE;
+ return false;
int alpha;
FX_COLORREF rgb;
ArgbDecode(fill_color, alpha, rgb);
if (alpha == 0)
- return TRUE;
+ return true;
if (alpha < 255)
- return FALSE;
+ return false;
HBRUSH hBrush = CreateSolidBrush(rgb);
::FillRect(m_hDC, (RECT*)pRect, hBrush);
DeleteObject(hBrush);
- return TRUE;
+ return true;
}
-FX_BOOL CGdiDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData,
- const CFX_Matrix* pMatrix,
- int fill_mode) {
+bool CGdiDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData,
+ const CFX_Matrix* pMatrix,
+ int fill_mode) {
if (pPathData->GetPointCount() == 5) {
CFX_FloatRect rectf;
if (pPathData->IsRect(pMatrix, &rectf)) {
FX_RECT rect = rectf.GetOuterRect();
IntersectClipRect(m_hDC, rect.left, rect.top, rect.right, rect.bottom);
- return TRUE;
+ return true;
}
}
SetPathToDC(m_hDC, pPathData, pMatrix);
SetPolyFillMode(m_hDC, fill_mode & 3);
SelectClipPath(m_hDC, RGN_AND);
- return TRUE;
+ return true;
}
-FX_BOOL CGdiDeviceDriver::SetClip_PathStroke(
+bool CGdiDeviceDriver::SetClip_PathStroke(
const CFX_PathData* pPathData,
const CFX_Matrix* pMatrix,
const CFX_GraphStateData* pGraphState) {
@@ -1137,26 +1137,26 @@ FX_BOOL CGdiDeviceDriver::SetClip_PathStroke(
SetPathToDC(m_hDC, pPathData, pMatrix);
WidenPath(m_hDC);
SetPolyFillMode(m_hDC, WINDING);
- FX_BOOL ret = !!SelectClipPath(m_hDC, RGN_AND);
+ bool ret = !!SelectClipPath(m_hDC, RGN_AND);
hPen = (HPEN)SelectObject(m_hDC, hPen);
DeleteObject(hPen);
return ret;
}
-FX_BOOL CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- uint32_t color,
- int blend_type) {
+bool CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
+ FX_FLOAT y1,
+ FX_FLOAT x2,
+ FX_FLOAT y2,
+ uint32_t color,
+ int blend_type) {
if (blend_type != FXDIB_BLEND_NORMAL)
- return FALSE;
+ return false;
int a;
FX_COLORREF rgb;
ArgbDecode(color, a, rgb);
if (a == 0)
- return TRUE;
+ return true;
HPEN hPen = CreatePen(PS_SOLID, 1, rgb);
hPen = (HPEN)SelectObject(m_hDC, hPen);
@@ -1164,7 +1164,7 @@ FX_BOOL CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
LineTo(m_hDC, FXSYS_round(x2), FXSYS_round(y2));
hPen = (HPEN)SelectObject(m_hDC, hPen);
DeleteObject(hPen);
- return TRUE;
+ return true;
}
CGdiDisplayDriver::CGdiDisplayDriver(HDC hDC)
@@ -1178,8 +1178,8 @@ CGdiDisplayDriver::CGdiDisplayDriver(HDC hDC)
CGdiDisplayDriver::~CGdiDisplayDriver() {}
-FX_BOOL CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
- FX_BOOL ret = FALSE;
+bool CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
+ bool ret = false;
int width = pBitmap->GetWidth();
int height = pBitmap->GetHeight();
HBITMAP hbmp = CreateCompatibleBitmap(m_hDC, width, height);
@@ -1205,7 +1205,7 @@ FX_BOOL CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
DIB_RGB_COLORS);
ret = pBitmap->TransferBitmap(0, 0, width, height, &bitmap, 0, 0);
} else {
- ret = FALSE;
+ ret = false;
}
}
if (pBitmap->HasAlpha() && ret)
@@ -1216,12 +1216,12 @@ FX_BOOL CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
return ret;
}
-FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource,
- uint32_t color,
- const FX_RECT* pSrcRect,
- int left,
- int top,
- int blend_type) {
+bool CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource,
+ uint32_t color,
+ const FX_RECT* pSrcRect,
+ int left,
+ int top,
+ int blend_type) {
ASSERT(blend_type == FXDIB_BLEND_NORMAL);
if (pSource->IsAlphaMask()) {
int width = pSource->GetWidth(), height = pSource->GetHeight();
@@ -1231,9 +1231,9 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource,
if (!background.Create(width, height, FXDIB_Rgb32) ||
!GetDIBits(&background, left, top) ||
!background.CompositeMask(0, 0, width, height, pSource, color, 0, 0,
- FXDIB_BLEND_NORMAL, nullptr, FALSE, 0,
+ FXDIB_BLEND_NORMAL, nullptr, false, 0,
nullptr)) {
- return FALSE;
+ return false;
}
FX_RECT src_rect(0, 0, width, height);
return SetDIBits(&background, 0, &src_rect, left, top,
@@ -1252,8 +1252,8 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource,
!GetDIBits(&bitmap, left, top) ||
!bitmap.CompositeBitmap(0, 0, width, height, pSource, pSrcRect->left,
pSrcRect->top, FXDIB_BLEND_NORMAL, nullptr,
- FALSE, nullptr)) {
- return FALSE;
+ false, nullptr)) {
+ return false;
}
FX_RECT src_rect(0, 0, width, height);
return SetDIBits(&bitmap, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL);
@@ -1261,18 +1261,18 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource,
CFX_DIBExtractor temp(pSource);
CFX_DIBitmap* pBitmap = temp.GetBitmap();
if (!pBitmap)
- return FALSE;
+ return false;
return GDI_SetDIBits(pBitmap, pSrcRect, left, top);
}
-FX_BOOL CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource,
- uint32_t color,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- int render_flags) {
+bool CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource,
+ uint32_t color,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ int render_flags) {
FX_RECT bitmap_clip = *pClipRect;
if (dest_width < 0)
dest_left += dest_width;
@@ -1284,22 +1284,22 @@ FX_BOOL CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource,
std::unique_ptr<CFX_DIBitmap> pStretched(
pSource->StretchTo(dest_width, dest_height, render_flags, &bitmap_clip));
if (!pStretched)
- return TRUE;
+ return true;
FX_RECT src_rect(0, 0, pStretched->GetWidth(), pStretched->GetHeight());
return SetDIBits(pStretched.get(), color, &src_rect, pClipRect->left,
pClipRect->top, FXDIB_BLEND_NORMAL);
}
-FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource,
- uint32_t color,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- uint32_t flags,
- int blend_type) {
+bool CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource,
+ uint32_t color,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ uint32_t flags,
+ int blend_type) {
ASSERT(pSource && pClipRect);
if (flags || dest_width > 10000 || dest_width < -10000 ||
dest_height > 10000 || dest_height < -10000) {
@@ -1319,7 +1319,7 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource,
std::unique_ptr<CFX_DIBitmap> pStretched(
pSource->StretchTo(dest_width, dest_height, flags, &clip_rect));
if (!pStretched)
- return TRUE;
+ return true;
CFX_DIBitmap background;
if (!background.Create(clip_width, clip_height, FXDIB_Rgb32) ||
@@ -1327,8 +1327,8 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource,
image_rect.top + clip_rect.top) ||
!background.CompositeMask(
0, 0, clip_width, clip_height, pStretched.get(), color, 0, 0,
- FXDIB_BLEND_NORMAL, nullptr, FALSE, 0, nullptr)) {
- return FALSE;
+ FXDIB_BLEND_NORMAL, nullptr, false, 0, nullptr)) {
+ return false;
}
FX_RECT src_rect(0, 0, clip_width, clip_height);
@@ -1343,7 +1343,7 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource,
CFX_DIBExtractor temp(pSource);
CFX_DIBitmap* pBitmap = temp.GetBitmap();
if (!pBitmap)
- return FALSE;
+ return false;
return pPlatform->m_GdiplusExt.StretchDIBits(
m_hDC, pBitmap, dest_left, dest_top, dest_width, dest_height,
pClipRect, flags);
@@ -1354,19 +1354,19 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource,
CFX_DIBExtractor temp(pSource);
CFX_DIBitmap* pBitmap = temp.GetBitmap();
if (!pBitmap)
- return FALSE;
+ return false;
return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width,
dest_height, flags);
}
-FX_BOOL CGdiDisplayDriver::StartDIBits(const CFX_DIBSource* pBitmap,
- int bitmap_alpha,
- uint32_t color,
- const CFX_Matrix* pMatrix,
- uint32_t render_flags,
- void*& handle,
- int blend_type) {
- return FALSE;
+bool CGdiDisplayDriver::StartDIBits(const CFX_DIBSource* pBitmap,
+ int bitmap_alpha,
+ uint32_t color,
+ const CFX_Matrix* pMatrix,
+ uint32_t render_flags,
+ void*& handle,
+ int blend_type) {
+ return false;
}
CFX_WindowsDevice::CFX_WindowsDevice(HDC hDC) {
diff --git a/core/fxge/win32/fx_win32_dib.cpp b/core/fxge/win32/fx_win32_dib.cpp
index 1f5688ddd2..40c9ca6e31 100644
--- a/core/fxge/win32/fx_win32_dib.cpp
+++ b/core/fxge/win32/fx_win32_dib.cpp
@@ -53,20 +53,20 @@ CFX_ByteString CFX_WindowsDIB::GetBitmapInfo(const CFX_DIBitmap* pBitmap) {
CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
LPVOID pData,
- FX_BOOL bAlpha) {
+ bool bAlpha) {
int width = pbmi->bmiHeader.biWidth;
int height = pbmi->bmiHeader.biHeight;
- BOOL bBottomUp = TRUE;
+ BOOL bBottomUp = true;
if (height < 0) {
height = -height;
- bBottomUp = FALSE;
+ bBottomUp = false;
}
int pitch = (width * pbmi->bmiHeader.biBitCount + 31) / 32 * 4;
CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
FXDIB_Format format = bAlpha
? (FXDIB_Format)(pbmi->bmiHeader.biBitCount + 0x200)
: (FXDIB_Format)pbmi->bmiHeader.biBitCount;
- FX_BOOL ret = pBitmap->Create(width, height, format);
+ bool ret = pBitmap->Create(width, height, format);
if (!ret) {
delete pBitmap;
return nullptr;
@@ -99,7 +99,7 @@ CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
}
CFX_DIBitmap* CFX_WindowsDIB::LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData) {
- return _FX_WindowsDIB_LoadFromBuf(pbmi, pData, FALSE);
+ return _FX_WindowsDIB_LoadFromBuf(pbmi, pData, false);
}
HBITMAP CFX_WindowsDIB::GetDDBitmap(const CFX_DIBitmap* pBitmap, HDC hDC) {
diff --git a/core/fxge/win32/fx_win32_dwrite.cpp b/core/fxge/win32/fx_win32_dwrite.cpp
index b12e5d7d15..dc0f5ed745 100644
--- a/core/fxge/win32/fx_win32_dwrite.cpp
+++ b/core/fxge/win32/fx_win32_dwrite.cpp
@@ -149,7 +149,7 @@ LPVOID CDWriteExt::DwCreateFontFaceFromStream(uint8_t* pData,
IDWriteFactory* pDwFactory = (IDWriteFactory*)m_pDWriteFactory;
IDWriteFontFile* pDwFontFile = nullptr;
IDWriteFontFace* pDwFontFace = nullptr;
- BOOL isSupportedFontType = FALSE;
+ BOOL isSupportedFontType = false;
DWRITE_FONT_FILE_TYPE fontFileType;
DWRITE_FONT_FACE_TYPE fontFaceType;
UINT32 numberOfFaces;
@@ -180,10 +180,10 @@ failed:
return nullptr;
}
-FX_BOOL CDWriteExt::DwCreateRenderingTarget(CFX_DIBitmap* pBitmap,
- void** renderTarget) {
+bool CDWriteExt::DwCreateRenderingTarget(CFX_DIBitmap* pBitmap,
+ void** renderTarget) {
if (pBitmap->GetFormat() > FXDIB_Argb) {
- return FALSE;
+ return false;
}
IDWriteFactory* pDwFactory = (IDWriteFactory*)m_pDWriteFactory;
IDWriteGdiInterop* pGdiInterop = nullptr;
@@ -214,29 +214,29 @@ FX_BOOL CDWriteExt::DwCreateRenderingTarget(CFX_DIBitmap* pBitmap,
SafeRelease(&pGdiInterop);
SafeRelease(&pBitmapRenderTarget);
SafeRelease(&pRenderingParams);
- return TRUE;
+ return true;
failed:
SafeRelease(&pGdiInterop);
SafeRelease(&pBitmapRenderTarget);
SafeRelease(&pRenderingParams);
- return FALSE;
+ return false;
}
-FX_BOOL CDWriteExt::DwRendingString(void* renderTarget,
- CFX_ClipRgn* pClipRgn,
- FX_RECT& stringRect,
- CFX_Matrix* pMatrix,
- void* font,
- FX_FLOAT font_size,
- FX_ARGB text_color,
- int glyph_count,
- unsigned short* glyph_indices,
- FX_FLOAT baselineOriginX,
- FX_FLOAT baselineOriginY,
- void* glyph_offsets,
- FX_FLOAT* glyph_advances) {
+bool CDWriteExt::DwRendingString(void* renderTarget,
+ CFX_ClipRgn* pClipRgn,
+ FX_RECT& stringRect,
+ CFX_Matrix* pMatrix,
+ void* font,
+ FX_FLOAT font_size,
+ FX_ARGB text_color,
+ int glyph_count,
+ unsigned short* glyph_indices,
+ FX_FLOAT baselineOriginX,
+ FX_FLOAT baselineOriginY,
+ void* glyph_offsets,
+ FX_FLOAT* glyph_advances) {
if (!renderTarget) {
- return TRUE;
+ return true;
}
CDwGdiTextRenderer* pTextRenderer = (CDwGdiTextRenderer*)renderTarget;
DWRITE_MATRIX transform;
@@ -256,7 +256,7 @@ FX_BOOL CDWriteExt::DwRendingString(void* renderTarget,
glyphRun.glyphIndices = glyph_indices;
glyphRun.glyphAdvances = glyph_advances;
glyphRun.glyphOffsets = (DWRITE_GLYPH_OFFSET*)glyph_offsets;
- glyphRun.isSideways = FALSE;
+ glyphRun.isSideways = false;
glyphRun.bidiLevel = 0;
hr = pTextRenderer->DrawGlyphRun(
stringRect, pClipRgn, pMatrix ? &transform : nullptr, baselineOriginX,
diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp
index 3dce58ffe3..f3bf2deae2 100644
--- a/core/fxge/win32/fx_win32_gdipext.cpp
+++ b/core/fxge/win32/fx_win32_gdipext.cpp
@@ -446,7 +446,7 @@ void* CGdiplusExt::GdiAddFontMemResourceEx(void* pFontdata,
(DWORD*)num_face);
}
-FX_BOOL CGdiplusExt::GdiRemoveFontMemResourceEx(void* handle) {
+bool CGdiplusExt::GdiRemoveFontMemResourceEx(void* handle) {
return m_pGdiRemoveFontMemResourseEx &&
m_pGdiRemoveFontMemResourseEx((HANDLE)handle);
}
@@ -462,11 +462,11 @@ static CFX_DIBitmap* _StretchMonoToGray(int dest_width,
int dest_height,
const CFX_DIBitmap* pSource,
FX_RECT* pClipRect) {
- FX_BOOL bFlipX = dest_width < 0;
+ bool bFlipX = dest_width < 0;
if (bFlipX) {
dest_width = -dest_width;
}
- FX_BOOL bFlipY = dest_height < 0;
+ bool bFlipY = dest_height < 0;
if (bFlipY) {
dest_height = -dest_height;
}
@@ -564,7 +564,7 @@ static void OutputImageMask(GpGraphics* pGraphics,
_StretchMonoToGray(dest_width, dest_height, pBitmap, &image_clip);
} else {
pStretched =
- pBitmap->StretchTo(dest_width, dest_height, FALSE, &image_clip);
+ pBitmap->StretchTo(dest_width, dest_height, false, &image_clip);
}
GpBitmap* bitmap;
CallFunc(GdipCreateBitmapFromScan0)(image_clip.Width(), image_clip.Height(),
@@ -729,7 +729,7 @@ void CGdiplusExt::DeleteMemFont(LPVOID pCollection) {
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
CallFunc(GdipDeletePrivateFontCollection)((GpFontCollection**)&pCollection);
}
-FX_BOOL CGdiplusExt::GdipCreateBitmap(CFX_DIBitmap* pBitmap, void** bitmap) {
+bool CGdiplusExt::GdipCreateBitmap(CFX_DIBitmap* pBitmap, void** bitmap) {
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
PixelFormat format;
@@ -744,53 +744,53 @@ FX_BOOL CGdiplusExt::GdipCreateBitmap(CFX_DIBitmap* pBitmap, void** bitmap) {
format = PixelFormat32bppARGB;
break;
default:
- return FALSE;
+ return false;
}
GpStatus status = CallFunc(GdipCreateBitmapFromScan0)(
pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap->GetPitch(), format,
pBitmap->GetBuffer(), (GpBitmap**)bitmap);
if (status == Ok) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CGdiplusExt::GdipCreateFromImage(void* bitmap, void** graphics) {
+bool CGdiplusExt::GdipCreateFromImage(void* bitmap, void** graphics) {
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
GpStatus status = CallFunc(GdipGetImageGraphicsContext)(
(GpBitmap*)bitmap, (GpGraphics**)graphics);
if (status == Ok) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CGdiplusExt::GdipCreateFontFamilyFromName(const FX_WCHAR* name,
- void* pFontCollection,
- void** pFamily) {
+bool CGdiplusExt::GdipCreateFontFamilyFromName(const FX_WCHAR* name,
+ void* pFontCollection,
+ void** pFamily) {
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
GpStatus status = CallFunc(GdipCreateFontFamilyFromName)(
(GDIPCONST WCHAR*)name, (GpFontCollection*)pFontCollection,
(GpFontFamily**)pFamily);
if (status == Ok) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CGdiplusExt::GdipCreateFontFromFamily(void* pFamily,
- FX_FLOAT font_size,
- int fontstyle,
- int flag,
- void** pFont) {
+bool CGdiplusExt::GdipCreateFontFromFamily(void* pFamily,
+ FX_FLOAT font_size,
+ int fontstyle,
+ int flag,
+ void** pFont) {
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
GpStatus status =
CallFunc(GdipCreateFont)((GpFontFamily*)pFamily, font_size, fontstyle,
Unit(flag), (GpFont**)pFont);
if (status == Ok) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void CGdiplusExt::GdipGetFontSize(void* pFont, FX_FLOAT* size) {
REAL get_size;
@@ -814,14 +814,14 @@ void CGdiplusExt::GdipSetPageUnit(void* graphics, uint32_t unit) {
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
CallFunc(GdipSetPageUnit)((GpGraphics*)graphics, (GpUnit)unit);
}
-FX_BOOL CGdiplusExt::GdipDrawDriverString(void* graphics,
- unsigned short* text,
- int length,
- void* font,
- void* brush,
- void* positions,
- int flags,
- const void* matrix) {
+bool CGdiplusExt::GdipDrawDriverString(void* graphics,
+ unsigned short* text,
+ int length,
+ void* font,
+ void* brush,
+ void* positions,
+ int flags,
+ const void* matrix) {
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
GpStatus status = CallFunc(GdipDrawDriverString)(
@@ -829,9 +829,9 @@ FX_BOOL CGdiplusExt::GdipDrawDriverString(void* graphics,
(GDIPCONST GpFont*)font, (GDIPCONST GpBrush*)brush,
(GDIPCONST PointF*)positions, (INT)flags, (GDIPCONST GpMatrix*)matrix);
if (status == Ok) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void CGdiplusExt::GdipCreateBrush(uint32_t fill_argb, void** pBrush) {
CGdiplusExt& GdiplusExt =
@@ -909,16 +909,16 @@ void CGdiplusExt::GdipDeleteGraphics(void* graphics) {
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
CallFunc(GdipDeleteGraphics)((GpGraphics*)graphics);
}
-FX_BOOL CGdiplusExt::StretchBitMask(HDC hDC,
- BOOL bMonoDevice,
- const CFX_DIBitmap* pBitmap,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- uint32_t argb,
- const FX_RECT* pClipRect,
- int flags) {
+bool CGdiplusExt::StretchBitMask(HDC hDC,
+ BOOL bMonoDevice,
+ const CFX_DIBitmap* pBitmap,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ uint32_t argb,
+ const FX_RECT* pClipRect,
+ int flags) {
ASSERT(pBitmap->GetBPP() == 1);
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
@@ -934,16 +934,16 @@ FX_BOOL CGdiplusExt::StretchBitMask(HDC hDC,
OutputImageMask(pGraphics, bMonoDevice, pBitmap, dest_left, dest_top,
dest_width, dest_height, argb, pClipRect);
CallFunc(GdipDeleteGraphics)(pGraphics);
- return TRUE;
+ return true;
}
-FX_BOOL CGdiplusExt::StretchDIBits(HDC hDC,
- const CFX_DIBitmap* pBitmap,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- int flags) {
+bool CGdiplusExt::StretchDIBits(HDC hDC,
+ const CFX_DIBitmap* pBitmap,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ int flags) {
GpGraphics* pGraphics;
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
@@ -963,12 +963,12 @@ FX_BOOL CGdiplusExt::StretchDIBits(HDC hDC,
dest_height);
CallFunc(GdipDeleteGraphics)(pGraphics);
CallFunc(GdipDeleteGraphics)(pGraphics);
- return TRUE;
+ return true;
}
static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState,
const CFX_Matrix* pMatrix,
DWORD argb,
- FX_BOOL bTextMode = FALSE) {
+ bool bTextMode = false) {
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
FX_FLOAT width = pGraphState ? pGraphState->m_LineWidth : 1.0f;
@@ -984,7 +984,7 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState,
CallFunc(GdipCreatePen1)((ARGB)argb, width, UnitWorld, &pPen);
LineCap lineCap = LineCapFlat;
DashCap dashCap = DashCapFlat;
- FX_BOOL bDashExtend = FALSE;
+ bool bDashExtend = false;
switch (pGraphState->m_LineCap) {
case CFX_GraphStateData::LineCapButt:
lineCap = LineCapFlat;
@@ -992,11 +992,11 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState,
case CFX_GraphStateData::LineCapRound:
lineCap = LineCapRound;
dashCap = DashCapRound;
- bDashExtend = TRUE;
+ bDashExtend = true;
break;
case CFX_GraphStateData::LineCapSquare:
lineCap = LineCapSquare;
- bDashExtend = TRUE;
+ bDashExtend = true;
break;
}
CallFunc(GdipSetPenLineCap197819)(pPen, lineCap, lineCap, dashCap);
@@ -1071,10 +1071,10 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState,
CallFunc(GdipSetPenMiterLimit)(pPen, pGraphState->m_MiterLimit);
return pPen;
}
-static FX_BOOL IsSmallTriangle(PointF* points,
- const CFX_Matrix* pMatrix,
- int& v1,
- int& v2) {
+static bool IsSmallTriangle(PointF* points,
+ const CFX_Matrix* pMatrix,
+ int& v1,
+ int& v2) {
int pairs[] = {1, 2, 0, 2, 0, 1};
for (int i = 0; i < 3; i++) {
int pair1 = pairs[i * 2];
@@ -1091,21 +1091,21 @@ static FX_BOOL IsSmallTriangle(PointF* points,
if (distance_square < (1.0f * 2 + 1.0f / 4)) {
v1 = i;
v2 = pair1;
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CGdiplusExt::DrawPath(HDC hDC,
- const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_argb,
- uint32_t stroke_argb,
- int fill_mode) {
+bool CGdiplusExt::DrawPath(HDC hDC,
+ const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_argb,
+ uint32_t stroke_argb,
+ int fill_mode) {
int nPoints = pPathData->GetPointCount();
if (nPoints == 0) {
- return TRUE;
+ return true;
}
FX_PATHPOINT* pPoints = pPathData->GetPoints();
GpGraphics* pGraphics = nullptr;
@@ -1124,9 +1124,9 @@ FX_BOOL CGdiplusExt::DrawPath(HDC hDC,
PointF* points = FX_Alloc(PointF, nPoints);
BYTE* types = FX_Alloc(BYTE, nPoints);
int nSubPathes = 0;
- FX_BOOL bSubClose = FALSE;
+ bool bSubClose = false;
int pos_subclose = 0;
- FX_BOOL bSmooth = FALSE;
+ bool bSmooth = false;
int startpoint = 0;
for (int i = 0; i < nPoints; i++) {
points[i].X = pPoints[i].m_PointX;
@@ -1154,7 +1154,7 @@ FX_BOOL CGdiplusExt::DrawPath(HDC hDC,
if (point_type == FXPT_MOVETO) {
types[i] = PathPointTypeStart;
nSubPathes++;
- bSubClose = FALSE;
+ bSubClose = false;
startpoint = i;
} else if (point_type == FXPT_LINETO) {
types[i] = PathPointTypeLine;
@@ -1166,32 +1166,32 @@ FX_BOOL CGdiplusExt::DrawPath(HDC hDC,
}
if (!bSmooth && points[i].X != points[i - 1].X &&
points[i].Y != points[i - 1].Y) {
- bSmooth = TRUE;
+ bSmooth = true;
}
} else if (point_type == FXPT_BEZIERTO) {
types[i] = PathPointTypeBezier;
- bSmooth = TRUE;
+ bSmooth = true;
}
if (pPoints[i].m_Flag & FXPT_CLOSEFIGURE) {
if (bSubClose) {
types[pos_subclose] &= ~PathPointTypeCloseSubpath;
} else {
- bSubClose = TRUE;
+ bSubClose = true;
}
pos_subclose = i;
types[i] |= PathPointTypeCloseSubpath;
if (!bSmooth && points[i].X != points[startpoint].X &&
points[i].Y != points[startpoint].Y) {
- bSmooth = TRUE;
+ bSmooth = true;
}
}
}
if (fill_mode & FXFILL_NOPATHSMOOTH) {
- bSmooth = FALSE;
+ bSmooth = false;
CallFunc(GdipSetSmoothingMode)(pGraphics, SmoothingModeNone);
} else if (!(fill_mode & FXFILL_FULLCOVER)) {
if (!bSmooth && (fill_mode & 3)) {
- bSmooth = TRUE;
+ bSmooth = true;
}
if (bSmooth || (pGraphState && pGraphState->m_LineWidth > 2)) {
CallFunc(GdipSetSmoothingMode)(pGraphics, SmoothingModeAntiAlias);
@@ -1207,7 +1207,7 @@ FX_BOOL CGdiplusExt::DrawPath(HDC hDC,
pGraphics, pPen, FXSYS_round(points[v1].X), FXSYS_round(points[v1].Y),
FXSYS_round(points[v2].X), FXSYS_round(points[v2].Y));
CallFunc(GdipDeletePen)(pPen);
- return TRUE;
+ return true;
}
}
GpPath* pGpPath = nullptr;
@@ -1220,7 +1220,7 @@ FX_BOOL CGdiplusExt::DrawPath(HDC hDC,
FX_Free(points);
FX_Free(types);
CallFunc(GdipDeleteGraphics)(pGraphics);
- return FALSE;
+ return false;
}
if (new_fill_mode) {
GpBrush* pBrush = _GdipCreateBrush(fill_argb);
@@ -1256,7 +1256,7 @@ FX_BOOL CGdiplusExt::DrawPath(HDC hDC,
FX_Free(types);
CallFunc(GdipDeletePath)(pGpPath);
CallFunc(GdipDeleteGraphics)(pGraphics);
- return TRUE;
+ return true;
}
class GpStream final : public IStream {
@@ -1497,7 +1497,7 @@ static void FreeDIBitmap(PREVIEW3_DIBITMAP* pInfo) {
CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
LPVOID pData,
- FX_BOOL bAlpha);
+ bool bAlpha);
CFX_DIBitmap* CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) {
PREVIEW3_DIBITMAP* pInfo = ::LoadDIBitmap(args);
if (!pInfo) {
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index ab12a92b1c..5a1a01a418 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -66,12 +66,12 @@ int CGdiPrinterDriver::GetDeviceCaps(int caps_id) const {
return CGdiDeviceDriver::GetDeviceCaps(caps_id);
}
-FX_BOOL CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource,
- uint32_t color,
- const FX_RECT* pSrcRect,
- int left,
- int top,
- int blend_type) {
+bool CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource,
+ uint32_t color,
+ const FX_RECT* pSrcRect,
+ int left,
+ int top,
+ int blend_type) {
if (pSource->IsAlphaMask()) {
FX_RECT clip_rect(left, top, left + pSrcRect->Width(),
top + pSrcRect->Height());
@@ -83,35 +83,35 @@ FX_BOOL CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource,
ASSERT(pSource && !pSource->IsAlphaMask() && pSrcRect);
ASSERT(blend_type == FXDIB_BLEND_NORMAL);
if (pSource->HasAlpha())
- return FALSE;
+ return false;
CFX_DIBExtractor temp(pSource);
CFX_DIBitmap* pBitmap = temp.GetBitmap();
if (!pBitmap)
- return FALSE;
+ return false;
return GDI_SetDIBits(pBitmap, pSrcRect, left, top);
}
-FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
- uint32_t color,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- uint32_t flags,
- int blend_type) {
+bool CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
+ uint32_t color,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ uint32_t flags,
+ int blend_type) {
if (pSource->IsAlphaMask()) {
int alpha = FXARGB_A(color);
if (pSource->GetBPP() != 1 || alpha != 255)
- return FALSE;
+ return false;
if (dest_width < 0 || dest_height < 0) {
std::unique_ptr<CFX_DIBitmap> pFlipped(
pSource->FlipImage(dest_width < 0, dest_height < 0));
if (!pFlipped)
- return FALSE;
+ return false;
if (dest_width < 0)
dest_left += dest_width;
@@ -126,19 +126,19 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
CFX_DIBExtractor temp(pSource);
CFX_DIBitmap* pBitmap = temp.GetBitmap();
if (!pBitmap)
- return FALSE;
+ return false;
return GDI_StretchBitMask(pBitmap, dest_left, dest_top, dest_width,
dest_height, color, flags);
}
if (pSource->HasAlpha())
- return FALSE;
+ return false;
if (dest_width < 0 || dest_height < 0) {
std::unique_ptr<CFX_DIBitmap> pFlipped(
pSource->FlipImage(dest_width < 0, dest_height < 0));
if (!pFlipped)
- return FALSE;
+ return false;
if (dest_width < 0)
dest_left += dest_width;
@@ -152,28 +152,28 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
CFX_DIBExtractor temp(pSource);
CFX_DIBitmap* pBitmap = temp.GetBitmap();
if (!pBitmap)
- return FALSE;
+ return false;
return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width,
dest_height, flags);
}
-FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource,
- int bitmap_alpha,
- uint32_t color,
- const CFX_Matrix* pMatrix,
- uint32_t render_flags,
- void*& handle,
- int blend_type) {
+bool CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource,
+ int bitmap_alpha,
+ uint32_t color,
+ const CFX_Matrix* pMatrix,
+ uint32_t render_flags,
+ void*& handle,
+ int blend_type) {
if (bitmap_alpha < 255 || pSource->HasAlpha() ||
(pSource->IsAlphaMask() && (pSource->GetBPP() != 1))) {
- return FALSE;
+ return false;
}
CFX_FloatRect unit_rect = pMatrix->GetUnitRect();
FX_RECT full_rect = unit_rect.GetOuterRect();
if (FXSYS_fabs(pMatrix->b) < 0.5f && pMatrix->a != 0 &&
FXSYS_fabs(pMatrix->c) < 0.5f && pMatrix->d != 0) {
- FX_BOOL bFlipX = pMatrix->a < 0;
- FX_BOOL bFlipY = pMatrix->d > 0;
+ bool bFlipX = pMatrix->a < 0;
+ bool bFlipY = pMatrix->d > 0;
return StretchDIBits(pSource, color,
bFlipX ? full_rect.right : full_rect.left,
bFlipY ? full_rect.bottom : full_rect.top,
@@ -182,30 +182,30 @@ FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource,
nullptr, 0, blend_type);
}
if (FXSYS_fabs(pMatrix->a) >= 0.5f || FXSYS_fabs(pMatrix->d) >= 0.5f)
- return FALSE;
+ return false;
std::unique_ptr<CFX_DIBitmap> pTransformed(
pSource->SwapXY(pMatrix->c > 0, pMatrix->b < 0));
if (!pTransformed)
- return FALSE;
+ return false;
return StretchDIBits(pTransformed.get(), color, full_rect.left, full_rect.top,
full_rect.Width(), full_rect.Height(), nullptr, 0,
blend_type);
}
-FX_BOOL CGdiPrinterDriver::DrawDeviceText(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t color) {
+bool CGdiPrinterDriver::DrawDeviceText(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t color) {
#if defined(PDFIUM_PRINT_TEXT_WITH_GDI)
if (!g_pdfium_print_text_with_gdi)
- return FALSE;
+ return false;
if (nChars < 1 || !pFont || !pFont->IsEmbedded() || !pFont->IsTTFont())
- return FALSE;
+ return false;
// Scale factor used to minimize the kerning problems caused by rounding
// errors below. Value choosen based on the title of https://crbug.com/18383
@@ -236,34 +236,34 @@ FX_BOOL CGdiPrinterDriver::DrawDeviceText(int nChars,
HFONT hFont = CreateFontIndirect(&lf);
if (!hFont)
- return FALSE;
+ return false;
ScopedState state(m_hDC, hFont);
size_t nTextMetricSize = GetOutlineTextMetrics(m_hDC, 0, nullptr);
if (nTextMetricSize == 0) {
// Give up and fail if there is no way to get the font to try again.
if (!g_pdfium_typeface_accessible_func)
- return FALSE;
+ return false;
// Try to get the font. Any letter will do.
g_pdfium_typeface_accessible_func(&lf, L"A", 1);
nTextMetricSize = GetOutlineTextMetrics(m_hDC, 0, nullptr);
if (nTextMetricSize == 0)
- return FALSE;
+ return false;
}
std::vector<BYTE> buf(nTextMetricSize);
OUTLINETEXTMETRIC* pTextMetric =
reinterpret_cast<OUTLINETEXTMETRIC*>(buf.data());
if (GetOutlineTextMetrics(m_hDC, nTextMetricSize, pTextMetric) == 0)
- return FALSE;
+ return false;
// If the selected font is not the requested font, then bail out. This can
// happen with web fonts, for example.
wchar_t* wsSelectedName = reinterpret_cast<wchar_t*>(
buf.data() + reinterpret_cast<size_t>(pTextMetric->otmpFaceName));
if (wsName != wsSelectedName)
- return FALSE;
+ return false;
// Transforms
SetGraphicsMode(m_hDC, GM_ADVANCED);
@@ -311,18 +311,18 @@ FX_BOOL CGdiPrinterDriver::DrawDeviceText(int nChars,
SetTextAlign(m_hDC, TA_LEFT | TA_BASELINE);
if (ExtTextOutW(m_hDC, 0, 0, ETO_GLYPH_INDEX, nullptr, wsText.c_str(), nChars,
nChars > 1 ? &spacing[1] : nullptr)) {
- return TRUE;
+ return true;
}
// Give up and fail if there is no way to get the font to try again.
if (!g_pdfium_typeface_accessible_func)
- return FALSE;
+ return false;
// Try to get the font and draw again.
g_pdfium_typeface_accessible_func(&lf, wsText.c_str(), nChars);
return !!ExtTextOutW(m_hDC, 0, 0, ETO_GLYPH_INDEX, nullptr, wsText.c_str(),
nChars, nChars > 1 ? &spacing[1] : nullptr);
#else
- return FALSE;
+ return false;
#endif
}
diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h
index 1f2bc50f42..fa1cc6830e 100644
--- a/core/fxge/win32/win32_int.h
+++ b/core/fxge/win32/win32_int.h
@@ -27,48 +27,48 @@ class CGdiplusExt {
CGdiplusExt();
~CGdiplusExt();
void Load();
- FX_BOOL IsAvailable() { return !!m_hModule; }
- FX_BOOL StretchBitMask(HDC hDC,
- BOOL bMonoDevice,
- const CFX_DIBitmap* pBitmap,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- uint32_t argb,
- const FX_RECT* pClipRect,
- int flags);
- FX_BOOL StretchDIBits(HDC hDC,
- const CFX_DIBitmap* pBitmap,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- int flags);
- FX_BOOL DrawPath(HDC hDC,
- const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_argb,
- uint32_t stroke_argb,
- int fill_mode);
+ bool IsAvailable() { return !!m_hModule; }
+ bool StretchBitMask(HDC hDC,
+ BOOL bMonoDevice,
+ const CFX_DIBitmap* pBitmap,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ uint32_t argb,
+ const FX_RECT* pClipRect,
+ int flags);
+ bool StretchDIBits(HDC hDC,
+ const CFX_DIBitmap* pBitmap,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ int flags);
+ bool DrawPath(HDC hDC,
+ const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_argb,
+ uint32_t stroke_argb,
+ int fill_mode);
void* LoadMemFont(uint8_t* pData, uint32_t size);
void DeleteMemFont(void* pFontCollection);
- FX_BOOL GdipCreateFromImage(void* bitmap, void** graphics);
+ bool GdipCreateFromImage(void* bitmap, void** graphics);
void GdipDeleteGraphics(void* graphics);
void GdipSetTextRenderingHint(void* graphics, int mode);
void GdipSetPageUnit(void* graphics, uint32_t unit);
void GdipSetWorldTransform(void* graphics, void* pMatrix);
- FX_BOOL GdipDrawDriverString(void* graphics,
- unsigned short* text,
- int length,
- void* font,
- void* brush,
- void* positions,
- int flags,
- const void* matrix);
+ bool GdipDrawDriverString(void* graphics,
+ unsigned short* text,
+ int length,
+ void* font,
+ void* brush,
+ void* positions,
+ int flags,
+ const void* matrix);
void GdipCreateBrush(uint32_t fill_argb, void** pBrush);
void GdipDeleteBrush(void* pBrush);
void GdipCreateMatrix(FX_FLOAT a,
@@ -79,27 +79,27 @@ class CGdiplusExt {
FX_FLOAT f,
void** matrix);
void GdipDeleteMatrix(void* matrix);
- FX_BOOL GdipCreateFontFamilyFromName(const FX_WCHAR* name,
- void* pFontCollection,
- void** pFamily);
+ bool GdipCreateFontFamilyFromName(const FX_WCHAR* name,
+ void* pFontCollection,
+ void** pFamily);
void GdipDeleteFontFamily(void* pFamily);
- FX_BOOL GdipCreateFontFromFamily(void* pFamily,
- FX_FLOAT font_size,
- int fontstyle,
- int flag,
- void** pFont);
+ bool GdipCreateFontFromFamily(void* pFamily,
+ FX_FLOAT font_size,
+ int fontstyle,
+ int flag,
+ void** pFont);
void* GdipCreateFontFromCollection(void* pFontCollection,
FX_FLOAT font_size,
int fontstyle);
void GdipDeleteFont(void* pFont);
- FX_BOOL GdipCreateBitmap(CFX_DIBitmap* pBitmap, void** bitmap);
+ bool GdipCreateBitmap(CFX_DIBitmap* pBitmap, void** bitmap);
void GdipDisposeImage(void* bitmap);
void GdipGetFontSize(void* pFont, FX_FLOAT* size);
void* GdiAddFontMemResourceEx(void* pFontdata,
uint32_t size,
void* pdv,
uint32_t* num_face);
- FX_BOOL GdiRemoveFontMemResourceEx(void* handle);
+ bool GdiRemoveFontMemResourceEx(void* handle);
CFX_DIBitmap* LoadDIBitmap(WINDIB_Open_Args_ args);
FARPROC m_Functions[100];
@@ -113,7 +113,7 @@ class CGdiplusExt {
class CWin32Platform {
public:
- FX_BOOL m_bHalfTone;
+ bool m_bHalfTone;
CGdiplusExt m_GdiplusExt;
CDWriteExt m_DWriteExt;
};
@@ -127,29 +127,29 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver {
int GetDeviceCaps(int caps_id) const override;
void SaveState() override;
void RestoreState(bool bKeepSaved) override;
- FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- int fill_mode) override;
- FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState) override;
- FX_BOOL DrawPath(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- int fill_mode,
- int blend_type) override;
- FX_BOOL FillRectWithBlend(const FX_RECT* pRect,
- uint32_t fill_color,
- int blend_type) override;
- FX_BOOL DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- uint32_t color,
- int blend_type) override;
- FX_BOOL GetClipBox(FX_RECT* pRect) override;
+ bool SetClip_PathFill(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ int fill_mode) override;
+ bool SetClip_PathStroke(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState) override;
+ bool DrawPath(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ int fill_mode,
+ int blend_type) override;
+ bool FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) override;
+ bool DrawCosmeticLine(FX_FLOAT x1,
+ FX_FLOAT y1,
+ FX_FLOAT x2,
+ FX_FLOAT y2,
+ uint32_t color,
+ int blend_type) override;
+ bool GetClipBox(FX_RECT* pRect) override;
void* GetPlatformSurface() const override;
void DrawLine(FX_FLOAT x1,
@@ -158,23 +158,23 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver {
FX_FLOAT y2,
const CFX_Matrix* pMatrix);
- FX_BOOL GDI_SetDIBits(CFX_DIBitmap* pBitmap,
- const FX_RECT* pSrcRect,
- int left,
- int top);
- FX_BOOL GDI_StretchDIBits(CFX_DIBitmap* pBitmap,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- uint32_t flags);
- FX_BOOL GDI_StretchBitMask(CFX_DIBitmap* pBitmap,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- uint32_t bitmap_color,
- uint32_t flags);
+ bool GDI_SetDIBits(CFX_DIBitmap* pBitmap,
+ const FX_RECT* pSrcRect,
+ int left,
+ int top);
+ bool GDI_StretchDIBits(CFX_DIBitmap* pBitmap,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ uint32_t flags);
+ bool GDI_StretchBitMask(CFX_DIBitmap* pBitmap,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ uint32_t bitmap_color,
+ uint32_t flags);
HDC m_hDC;
int m_Width;
@@ -190,37 +190,37 @@ class CGdiDisplayDriver : public CGdiDeviceDriver {
~CGdiDisplayDriver() override;
protected:
- FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override;
- FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
- uint32_t color,
- const FX_RECT* pSrcRect,
- int left,
- int top,
- int blend_type) override;
- FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
- uint32_t color,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- uint32_t flags,
- int blend_type) override;
- FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
- int bitmap_alpha,
- uint32_t color,
- const CFX_Matrix* pMatrix,
- uint32_t render_flags,
- void*& handle,
- int blend_type) override;
- FX_BOOL UseFoxitStretchEngine(const CFX_DIBSource* pSource,
- uint32_t color,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- int render_flags);
+ bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override;
+ bool SetDIBits(const CFX_DIBSource* pBitmap,
+ uint32_t color,
+ const FX_RECT* pSrcRect,
+ int left,
+ int top,
+ int blend_type) override;
+ bool StretchDIBits(const CFX_DIBSource* pBitmap,
+ uint32_t color,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ uint32_t flags,
+ int blend_type) override;
+ bool StartDIBits(const CFX_DIBSource* pBitmap,
+ int bitmap_alpha,
+ uint32_t color,
+ const CFX_Matrix* pMatrix,
+ uint32_t render_flags,
+ void*& handle,
+ int blend_type) override;
+ bool UseFoxitStretchEngine(const CFX_DIBSource* pSource,
+ uint32_t color,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ int render_flags);
};
class CGdiPrinterDriver : public CGdiDeviceDriver {
@@ -230,34 +230,34 @@ class CGdiPrinterDriver : public CGdiDeviceDriver {
protected:
int GetDeviceCaps(int caps_id) const override;
- FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
- uint32_t color,
- const FX_RECT* pSrcRect,
- int left,
- int top,
- int blend_type) override;
- FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
- uint32_t color,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- uint32_t flags,
- int blend_type) override;
- FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
- int bitmap_alpha,
- uint32_t color,
- const CFX_Matrix* pMatrix,
- uint32_t render_flags,
- void*& handle,
- int blend_type) override;
- FX_BOOL DrawDeviceText(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t color) override;
+ bool SetDIBits(const CFX_DIBSource* pBitmap,
+ uint32_t color,
+ const FX_RECT* pSrcRect,
+ int left,
+ int top,
+ int blend_type) override;
+ bool StretchDIBits(const CFX_DIBSource* pBitmap,
+ uint32_t color,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ uint32_t flags,
+ int blend_type) override;
+ bool StartDIBits(const CFX_DIBSource* pBitmap,
+ int bitmap_alpha,
+ uint32_t color,
+ const CFX_Matrix* pMatrix,
+ uint32_t render_flags,
+ void*& handle,
+ int blend_type) override;
+ bool DrawDeviceText(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t color) override;
const int m_HorzSize;
const int m_VertSize;