From 320b2313d19869333ed453af546e61a9fc2b81c9 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 23 Jul 2015 13:26:26 -0700 Subject: FX_BOOL considered harmful, part 2. Fully automatic change, execpt for cleanup in fx_system.h R=thestig@chromium.org Review URL: https://codereview.chromium.org/1254703002 . --- core/src/fxge/dib/dib_int.h | 6 +- core/src/fxge/dib/fx_dib_composite.cpp | 142 +++++++++---------- core/src/fxge/dib/fx_dib_convert.cpp | 116 ++++++++-------- core/src/fxge/dib/fx_dib_engine.cpp | 72 +++++----- core/src/fxge/dib/fx_dib_main.cpp | 246 ++++++++++++++++----------------- core/src/fxge/dib/fx_dib_transform.cpp | 32 ++--- 6 files changed, 307 insertions(+), 307 deletions(-) (limited to 'core/src/fxge/dib') diff --git a/core/src/fxge/dib/dib_int.h b/core/src/fxge/dib/dib_int.h index 825cabe1d1..a6834fd641 100644 --- a/core/src/fxge/dib/dib_int.h +++ b/core/src/fxge/dib/dib_int.h @@ -63,7 +63,7 @@ public: int dest_width, int dest_height, const FX_RECT& clip_rect, const CFX_DIBSource* pSrcBitmap, int flags); ~CStretchEngine(); - FX_BOOL Continue(IFX_Pause* pPause); + bool Continue(IFX_Pause* pPause); public: FXDIB_Format m_DestFormat; int m_DestBpp, m_SrcBpp, m_bHasAlpha; @@ -84,8 +84,8 @@ public: int m_Flags; CWeightTable m_WeightTable; int m_CurRow; - FX_BOOL StartStretchHorz(); - FX_BOOL ContinueStretchHorz(IFX_Pause* pPause); + bool StartStretchHorz(); + bool ContinueStretchHorz(IFX_Pause* pPause); void StretchVert(); int m_State; }; diff --git a/core/src/fxge/dib/fx_dib_composite.cpp b/core/src/fxge/dib/fx_dib_composite.cpp index cb99a37ff4..9f454cc31d 100644 --- a/core/src/fxge/dib/fx_dib_composite.cpp +++ b/core/src/fxge/dib/fx_dib_composite.cpp @@ -272,7 +272,7 @@ void _CompositeRow_Argb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int p pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); } if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; if (src_alpha_scan) { for (int col = 0; col < pixel_count; col ++) { @@ -467,7 +467,7 @@ inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan, const uint8_t* src_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; int blended_color; if (src_alpha_scan) { for (int col = 0; col < pixel_count; col ++) { @@ -558,7 +558,7 @@ inline void _CompositeRow_Rgb2Gray(uint8_t* dest_scan, const uint8_t* src_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; int blended_color; for (int col = 0; col < pixel_count; col ++) { if (pIccTransform) { @@ -605,7 +605,7 @@ void _CompositeRow_Rgb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int sr } if (blend_type) { int blended_color; - 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) { @@ -689,7 +689,7 @@ void _CompositeRow_Argb2Argb(uint8_t* dest_scan, const uint8_t* src_scan, int pi 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 == NULL) { if (src_alpha_scan == NULL) { uint8_t back_alpha = 0; @@ -896,7 +896,7 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan, const uint8_t* src_ 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 == NULL) { for (int col = 0; col < width; col ++) { @@ -957,7 +957,7 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip(uint8_t* dest_scan, const uint8_t* 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 == NULL) { for (int col = 0; col < width; col ++) { @@ -1121,7 +1121,7 @@ inline void _CompositeRow_Argb2Rgb_Blend(uint8_t* dest_scan, const uint8_t* src_ 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 == NULL) { for (int col = 0; col < width; col ++) { @@ -1243,7 +1243,7 @@ inline void _CompositeRow_Argb2Rgb_NoBlend(uint8_t* dest_scan, const uint8_t* sr inline void _CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, 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 ++) { @@ -1266,7 +1266,7 @@ inline void _CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan, const uint8_t inline void _CompositeRow_Rgb2Rgb_Blend_Clip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, 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 ++) { @@ -1357,7 +1357,7 @@ void _CompositeRow_Argb2Argb_Transform(uint8_t* dest_scan, const uint8_t* src_sc } } else { 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); uint8_t back_alpha = *dest_alpha_scan; @@ -1487,7 +1487,7 @@ inline void _CompositeRow_Argb2Rgb_Blend_Transform(uint8_t* dest_scan, const uin pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_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); @@ -1630,7 +1630,7 @@ inline void _CompositeRow_8bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_sc { if (src_alpha_scan) { if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { uint8_t gray = pPalette[*src_scan]; @@ -1668,7 +1668,7 @@ inline void _CompositeRow_8bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_sc } } else { if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { uint8_t gray = pPalette[*src_scan]; @@ -1704,7 +1704,7 @@ inline void _CompositeRow_8bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_s { if (src_alpha_scan) { if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { uint8_t gray = pPalette[*src_scan]; @@ -1778,7 +1778,7 @@ inline void _CompositeRow_8bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_s } } else { if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { uint8_t gray = pPalette[*src_scan]; @@ -1836,7 +1836,7 @@ inline void _CompositeRow_1bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_sc 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; int blended_color; for (int col = 0; col < pixel_count; col ++) { uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; @@ -1870,7 +1870,7 @@ inline void _CompositeRow_1bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_s 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; int blended_color; for (int col = 0; col < pixel_count; col ++) { uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; @@ -2787,7 +2787,7 @@ void _CompositeRow_BitMask2Graya(uint8_t* dest_scan, const uint8_t* src_scan, in void _CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int pixel_count, 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) { @@ -2844,7 +2844,7 @@ void _CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, 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]; @@ -2881,7 +2881,7 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, const inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, 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) { @@ -2928,7 +2928,7 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_sca inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, 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) { @@ -2995,7 +2995,7 @@ inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_scan inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, 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 ++; @@ -3039,7 +3039,7 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, c inline void _CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, 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 ++; @@ -3495,7 +3495,7 @@ void _CompositeRow_BitMask2Rgb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* s dest_scan += Bpp; } } -inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int alpha_flag, FX_DWORD mask_color, int& mask_alpha, +inline bool _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int alpha_flag, FX_DWORD mask_color, int& mask_alpha, int& mask_red, int& mask_green, int& mask_blue, int& mask_black, void* icc_module, void* pIccTransform) { @@ -3513,7 +3513,7 @@ inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int mask_blue = FXARGB_B(mask_color); } if (dest_format == FXDIB_8bppMask) { - return TRUE; + return true; } if ((dest_format & 0xff) == 8) { if (pIccTransform) { @@ -3550,15 +3550,15 @@ inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int mask_blue = mask_color_p[0]; } } - return TRUE; + return true; } inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB_Format dest_format, FX_DWORD*& pDestPalette, FX_DWORD* pSrcPalette, void* icc_module, void* pIccTransform) { ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module; - FX_BOOL isSrcCmyk = src_format & 0x0400 ? TRUE : FALSE; - FX_BOOL isDstCmyk = dest_format & 0x0400 ? TRUE : FALSE; + bool isSrcCmyk = src_format & 0x0400 ? true : false; + bool isDstCmyk = dest_format & 0x0400 ? true : false; pDestPalette = NULL; if (pIccTransform) { if (pSrcPalette) { @@ -3679,7 +3679,7 @@ CFX_ScanlineCompositor::CFX_ScanlineCompositor() m_pSrcPalette = NULL; m_pCacheScanline = NULL; m_CacheSize = 0; - m_bRgbByteOrder = FALSE; + m_bRgbByteOrder = false; m_BlendType = FXDIB_BLEND_NORMAL; } CFX_ScanlineCompositor::~CFX_ScanlineCompositor() @@ -3691,8 +3691,8 @@ CFX_ScanlineCompositor::~CFX_ScanlineCompositor() FX_Free(m_pCacheScanline); } } -FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_format, int32_t width, FX_DWORD* pSrcPalette, - FX_DWORD 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, FX_DWORD* pSrcPalette, + FX_DWORD mask_color, int blend_type, bool bClip, bool bRgbByteOrder, int alpha_flag, void* pIccTransform) { m_SrcFormat = src_format; m_DestFormat = dest_format; @@ -3707,7 +3707,7 @@ FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_ } m_pIccTransform = pIccTransform; if ((dest_format & 0xff) == 1) { - return FALSE; + return false; } if (m_SrcFormat == FXDIB_1bppMask || m_SrcFormat == FXDIB_8bppMask) { return _ScanlineCompositor_InitSourceMask(dest_format, alpha_flag, mask_color, @@ -3715,11 +3715,11 @@ FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_ pIccModule, pIccTransform); } if (pIccTransform == NULL && (~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, pIccTransform); @@ -3727,7 +3727,7 @@ FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_ + (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) @@ -3736,7 +3736,7 @@ FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_ + (src_format & 0x0400 ? 16 : 0) + (dest_format & 0x0400 ? 32 : 0) + (pIccTransform ? 64 : 0); - return TRUE; + return true; } void CFX_ScanlineCompositor::CompositeRgbBitmapLine(uint8_t* dest_scan, const uint8_t* src_scan, int width, const uint8_t* clip_scan, const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) @@ -4059,22 +4059,22 @@ void CFX_ScanlineCompositor::CompositeBitMaskLine(uint8_t* dest_scan, const uint _CompositeRow_BitMask2Rgb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan); } -FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, int dest_top, int width, int height, +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) + int blend_type, const CFX_ClipRgn* pClipRgn, bool bRgbByteOrder, void* pIccTransform) { if (m_pBuffer == NULL) { - 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 = NULL; FX_RECT clip_box; @@ -4086,11 +4086,11 @@ FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, int dest_top, int width, in CFX_ScanlineCompositor compositor; if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width, pSrcBitmap->GetPalette(), 0, blend_type, pClipMask != NULL, 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 = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * dest_Bpp; @@ -4107,27 +4107,27 @@ FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, int dest_top, int width, in compositor.CompositePalBitmapLine(dest_scan, src_scan, src_left, width, clip_scan, src_scan_extra_alpha, dst_scan_extra_alpha); } } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int height, +bool CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int height, const CFX_DIBSource* pMask, FX_DWORD color, int src_left, int src_top, - int blend_type, const CFX_ClipRgn* pClipRgn, FX_BOOL bRgbByteOrder, int alpha_flag, void* pIccTransform) + int blend_type, const CFX_ClipRgn* pClipRgn, bool bRgbByteOrder, int alpha_flag, void* pIccTransform) { if (m_pBuffer == NULL) { - 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 = NULL; FX_RECT clip_box; @@ -4140,7 +4140,7 @@ FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int int Bpp = GetBPP() / 8; CFX_ScanlineCompositor compositor; if (!compositor.Init(GetFormat(), pMask->GetFormat(), width, NULL, color, blend_type, pClipMask != NULL, bRgbByteOrder, alpha_flag, pIccTransform)) { - return FALSE; + return false; } for (int row = 0; row < height; row ++) { uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp; @@ -4156,21 +4156,21 @@ FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int compositor.CompositeByteMaskLine(dest_scan, src_scan + src_left, width, clip_scan, dst_scan_extra_alpha); } } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX_DWORD color, int alpha_flag, void* pIccTransform) +bool CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX_DWORD color, int alpha_flag, void* pIccTransform) { if (m_pBuffer == NULL) { - 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(); FX_DWORD dst_color; @@ -4210,7 +4210,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX dest_scan ++; } } - return TRUE; + return true; } if (m_bpp == 1) { ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); @@ -4248,11 +4248,11 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } } } - return TRUE; + return true; } ASSERT(m_bpp >= 24); if (m_bpp < 24) { - return FALSE; + return false; } if (pIccTransform && CFX_GEModule::Get()->GetCodecModule()) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); @@ -4262,15 +4262,15 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), 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(); - FX_BOOL bArgb = GetFormat() == FXDIB_Argb ? TRUE : FALSE; + bool bAlpha = HasAlpha(); + bool bArgb = GetFormat() == FXDIB_Argb ? true : false; if (src_alpha == 255) { for (int row = rect.top; row < rect.bottom; row ++) { uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; @@ -4291,7 +4291,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } } } - 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; @@ -4346,7 +4346,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } } } - return TRUE; + return true; } CFX_BitmapComposer::CFX_BitmapComposer() { @@ -4354,7 +4354,7 @@ CFX_BitmapComposer::CFX_BitmapComposer() m_pScanlineAlphaV = NULL; m_pClipScanV = NULL; m_pAddClipScan = NULL; - m_bRgbByteOrder = FALSE; + m_bRgbByteOrder = false; m_BlendType = FXDIB_BLEND_NORMAL; } CFX_BitmapComposer::~CFX_BitmapComposer() @@ -4373,8 +4373,8 @@ CFX_BitmapComposer::~CFX_BitmapComposer() } } void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest, const CFX_ClipRgn* pClipRgn, int bitmap_alpha, - FX_DWORD mask_color, FX_RECT& dest_rect, FX_BOOL bVertical, - FX_BOOL bFlipX, FX_BOOL bFlipY, FX_BOOL bRgbByteOrder, + FX_DWORD mask_color, FX_RECT& dest_rect, bool bVertical, + bool bFlipX, bool bFlipY, bool bRgbByteOrder, int alpha_flag, void* pIccTransform, int blend_type) { m_pBitmap = pDest; @@ -4397,12 +4397,12 @@ void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest, const CFX_ClipRgn* pClipRg m_bRgbByteOrder = bRgbByteOrder; m_BlendType = blend_type; } -FX_BOOL CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_format, FX_DWORD* pSrcPalette) +bool CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_format, FX_DWORD* pSrcPalette) { m_SrcFormat = src_format; if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalette, m_MaskColor, FXDIB_BLEND_NORMAL, m_pClipMask != NULL || (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); @@ -4414,7 +4414,7 @@ FX_BOOL CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_form if (m_BitmapAlpha < 255) { 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, const uint8_t* src_scan, int dest_width, const uint8_t* clip_scan, const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp index d7860aee19..7e5a0341a2 100644 --- a/core/src/fxge/dib/fx_dib_convert.cpp +++ b/core/src/fxge/dib/fx_dib_convert.cpp @@ -103,7 +103,7 @@ public: CFX_Palette(); ~CFX_Palette(); public: - FX_BOOL BuildPalette(const CFX_DIBSource* pBitmap, int dwPaletteType); + bool BuildPalette(const CFX_DIBSource* pBitmap, int dwPaletteType); FX_DWORD* GetPalette() const { return m_pPalette; @@ -227,10 +227,10 @@ CFX_Palette::~CFX_Palette() } m_lut = 0; } -FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) +bool CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) { if (pBitmap == NULL) { - return FALSE; + return false; } if (m_pPalette != NULL) { FX_Free(m_pPalette); @@ -277,9 +277,9 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) win_mac_pal = (FX_DWORD*)g_dwMacPalette; } _Obtain_Pal(m_aLut, m_cLut, m_pPalette, pal_type, win_mac_pal, m_lut); - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, +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; @@ -296,9 +296,9 @@ FX_BOOL _ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int widt dest_scan ++; } } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, +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 ++) { @@ -306,9 +306,9 @@ FX_BOOL _ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int widt 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, +bool _ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { FX_DWORD* src_plt = pSrcBitmap->GetPalette(); @@ -359,9 +359,9 @@ FX_BOOL _ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width dest_scan ++; } } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { FX_DWORD* src_plt = pSrcBitmap->GetPalette(); @@ -402,9 +402,9 @@ FX_BOOL _ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width *dest_scan++ = gray[*src_scan++]; } } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { int Bpp = pSrcBitmap->GetBPP() / 8; @@ -451,7 +451,7 @@ FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf, int dest_pitch, int wid } } } - return TRUE; + return true; } inline void _ConvertBuffer_IndexCopy(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) @@ -476,7 +476,7 @@ inline void _ConvertBuffer_IndexCopy(uint8_t* dest_buf, int dest_pitch, int widt } } } -FX_BOOL _ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD* dst_plt, void* pIccTransform) { _ConvertBuffer_IndexCopy(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top); @@ -515,9 +515,9 @@ FX_BOOL _ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, FXSYS_memcpy(dst_plt, src_plt, plt_size * 4); } } - return TRUE; + return true; } -inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf, int dest_pitch, int width, int height, +inline bool _ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD* dst_plt) { int bpp = pSrcBitmap->GetBPP() / 8; @@ -527,7 +527,7 @@ inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf, int des FX_DWORD* cLut = palette.GetColorLut(); FX_DWORD* aLut = palette.GetAmountLut(); if (cLut == NULL || aLut == NULL) { - return FALSE; + return false; } int lut = palette.Getlut(); FX_DWORD* pPalette = palette.GetPalette(); @@ -571,12 +571,12 @@ inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf, int des } } FXSYS_memcpy(dst_plt, pPalette, sizeof(FX_DWORD) * 256); - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD* dst_plt, void* pIccTransform) { - FX_BOOL ret = _ConvertBuffer_Rgb2PltRgb8_NoTransform(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, dst_plt); + bool ret = _ConvertBuffer_Rgb2PltRgb8_NoTransform(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, dst_plt); if (ret && pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); for (int i = 0; i < 256; i++) { @@ -588,7 +588,7 @@ FX_BOOL _ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, } return ret; } -FX_BOOL _ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, +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; @@ -611,9 +611,9 @@ FX_BOOL _ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, 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, +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; @@ -629,9 +629,9 @@ FX_BOOL _ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, 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, +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, void* pIccTransform) { int comps = (dst_format & 0xff) / 8; @@ -676,9 +676,9 @@ FX_BOOL _ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, i 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, +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, void* pIccTransform) { int comps = (dst_format & 0xff) / 8; @@ -722,9 +722,9 @@ FX_BOOL _ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, i dest_scan += comps - 2; } } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { if (pIccTransform) { @@ -741,9 +741,9 @@ FX_BOOL _ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int wid 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, +bool _ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { for (int row = 0; row < height; row ++) { @@ -763,9 +763,9 @@ FX_BOOL _ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int wid pIccModule->TranslateScanline(pIccTransform, dest_scan, dest_scan, width); } } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { int comps = pSrcBitmap->GetBPP() / 8; @@ -793,9 +793,9 @@ FX_BOOL _ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, i } } } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { if (pIccTransform) { @@ -821,9 +821,9 @@ FX_BOOL _ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf, int dest_pitch, int wi } } } - return TRUE; + return true; } -FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitch, int width, int height, +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, FX_DWORD*& d_pal, void* pIccTransform) { FXDIB_Format src_format = pSrcBitmap->GetFormat(); @@ -835,8 +835,8 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitc 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()) { @@ -853,7 +853,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitc if ((src_format & 0xff) >= 24) { return _ConvertBuffer_RgbOrCmyk2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); } - return FALSE; + return false; } case FXDIB_8bppRgb: case FXDIB_8bppRgba: { @@ -867,7 +867,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitc if ((src_format & 0xff) >= 24) { return _ConvertBuffer_Rgb2PltRgb8(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform); } - return FALSE; + return false; } case FXDIB_Rgb: case FXDIB_Rgba: { @@ -889,7 +889,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitc if ((src_format & 0xff) == 32) { return _ConvertBuffer_32bppRgb2Rgb24(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); } - return FALSE; + return false; } case FXDIB_Argb: case FXDIB_Rgb32: { @@ -911,12 +911,12 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitc } return _ConvertBuffer_Rgb2Rgb32(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); } - return FALSE; + return false; } default: - return FALSE; + return false; } - return FALSE; + return false; } CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format, const FX_RECT* pClip, void* pIccTransform) const { @@ -939,7 +939,7 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format, const FX_REC delete pClone; return NULL; } - FX_BOOL ret = TRUE; + bool ret = true; CFX_DIBitmap* pSrcAlpha = NULL; if (m_AlphaFlag & 2) { pSrcAlpha = (GetFormat() == FXDIB_Argb) ? GetAlphaMask() : m_pAlphaMask; @@ -981,15 +981,15 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format, const FX_REC } return pClone; } -FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransform) +bool CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransform) { FXDIB_Format src_format = GetFormat(); if (dest_format == src_format && pIccTransform == NULL) { - return TRUE; + return true; } if (dest_format == FXDIB_8bppMask && src_format == FXDIB_8bppRgb && m_pPalette == NULL) { m_AlphaFlag = 1; - return TRUE; + return true; } if (dest_format == FXDIB_Argb && src_format == FXDIB_Rgb32 && pIccTransform == NULL) { m_AlphaFlag = 2; @@ -1000,13 +1000,13 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor 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 == NULL) { - return FALSE; + return false; } CFX_DIBitmap* pAlphaMask = NULL; if (dest_format == FXDIB_Argb) { @@ -1026,13 +1026,13 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor pAlphaMask = GetAlphaMask(); if (pAlphaMask == NULL) { FX_Free(dest_buf); - return FALSE; + return false; } } else { if (m_pAlphaMask == NULL) { if (!BuildAlphaMask()) { FX_Free(dest_buf); - return FALSE; + return false; } pAlphaMask = m_pAlphaMask; m_pAlphaMask = NULL; @@ -1041,7 +1041,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor } } } - FX_BOOL ret = FALSE; + bool ret = false; FX_DWORD* pal_8bpp = NULL; ret = ConvertBuffer(dest_format, dest_buf, dest_pitch, m_Width, m_Height, this, 0, 0, pal_8bpp, pIccTransform); if (!ret) { @@ -1054,7 +1054,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor if (dest_buf) { FX_Free(dest_buf); } - return FALSE; + return false; } if (m_pAlphaMask && pAlphaMask != m_pAlphaMask) { delete m_pAlphaMask; @@ -1067,10 +1067,10 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor 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/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp index 7390c431d9..f143ac3ae2 100644 --- a/core/src/fxge/dib/fx_dib_engine.cpp +++ b/core/src/fxge/dib/fx_dib_engine.cpp @@ -217,7 +217,7 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, FXDIB_Format d 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) < m_SrcWidth * m_SrcHeight * 8 / FXSYS_abs(dest_width)) { flags = FXDIB_INTERPOL; } @@ -280,16 +280,16 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, FXDIB_Format d } } } -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; } CStretchEngine::~CStretchEngine() { @@ -306,46 +306,46 @@ CStretchEngine::~CStretchEngine() FX_Free(m_pDestMaskScanline); } } -FX_BOOL CStretchEngine::StartStretchHorz() +bool CStretchEngine::StartStretchHorz() { if (m_DestWidth == 0 || m_pDestScanline == NULL || m_SrcClip.Height() > (int)((1U << 29) / m_InterPitch) || m_SrcClip.Height() == 0) { - return FALSE; + return false; } m_pInterBuf = FX_TryAlloc(unsigned char, m_SrcClip.Height() * m_InterPitch); if (m_pInterBuf == NULL) { - return FALSE; + return false; } if (m_pSource && m_bHasAlpha && m_pSource->m_pAlphaMask) { m_pExtraAlphaBuf = FX_Alloc2D(unsigned char, m_SrcClip.Height(), m_ExtraMaskPitch); FX_DWORD size = (m_DestClip.Width() * 8 + 31) / 32 * 4; m_pDestMaskScanline = FX_TryAlloc(unsigned char, size); if (!m_pDestMaskScanline) { - return FALSE; + return false; } } m_WeightTable.Calc(m_DestWidth, m_DestClip.left, m_DestClip.right, m_SrcWidth, m_SrcClip.left, m_SrcClip.right, m_Flags); if (m_WeightTable.m_pWeightTables == NULL) { - return FALSE; + return false; } m_CurRow = m_SrcClip.top; m_State = 1; - return TRUE; + return true; } #define FX_STRECH_PAUSE_ROWS 10 -FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) +bool CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) { if (!m_DestWidth) { return 0; } if (m_pSource->SkipToScanline(m_CurRow, pPause)) { - return TRUE; + return true; } int Bpp = m_DestBpp / 8; int rows_to_go = FX_STRECH_PAUSE_ROWS; for (; m_CurRow < m_SrcClip.bottom; m_CurRow ++) { if (rows_to_go == 0) { if (pPause && pPause->NeedToPauseNow()) { - return TRUE; + return true; } rows_to_go = FX_STRECH_PAUSE_ROWS; } @@ -532,7 +532,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) } rows_to_go --; } - return FALSE; + return false; } void CStretchEngine::StretchVert() { @@ -697,7 +697,7 @@ FXDIB_Format _GetStretchedFormat(const CFX_DIBSource* pSrc) } return format; } -FX_BOOL CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest, +bool CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest, const CFX_DIBSource* pSource, int dest_width, int dest_height, const FX_RECT& rect, FX_DWORD flags) { @@ -722,7 +722,7 @@ FX_BOOL CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest, pal[i] = ArgbEncode(a, r, g, b); } if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, pal)) { - return FALSE; + return false; } } else if (pSource->GetFormat() == FXDIB_1bppCmyk && pSource->GetPalette()) { FX_CMYK pal[256]; @@ -737,17 +737,17 @@ FX_BOOL CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest, pal[i] = CmykEncode(c, m, y, k); } if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, pal)) { - return FALSE; + return false; } } else if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, NULL)) { - return FALSE; + return false; } if (flags & FXDIB_DOWNSAMPLE) { return StartQuickStretch(); } 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); @@ -755,39 +755,39 @@ FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause) return ContinueStretch(pPause); } #define MAX_PROGRESSIVE_STRETCH_PIXELS 1000000 -FX_BOOL CFX_ImageStretcher::StartStretch() +bool CFX_ImageStretcher::StartStretch() { m_pStretchEngine = new CStretchEngine(m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, m_ClipRect, m_pSource, m_Flags); m_pStretchEngine->StartStretchHorz(); if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH_PIXELS) { m_pStretchEngine->Continue(NULL); - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) +bool CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) { if (m_pStretchEngine == NULL) { - return FALSE; + return false; } return m_pStretchEngine->Continue(pPause); } -FX_BOOL CFX_ImageStretcher::StartQuickStretch() +bool CFX_ImageStretcher::StartQuickStretch() { - m_bFlipX = FALSE; - m_bFlipY = FALSE; + m_bFlipX = false; + m_bFlipY = false; 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; } m_LineIndex = 0; FX_DWORD size = m_ClipRect.Width(); if (size && m_DestBPP > (int)(INT_MAX / size)) { - return FALSE; + return false; } size *= m_DestBPP; m_pScanline = FX_Alloc(uint8_t, (size / 8 + 3) / 4 * 4); @@ -796,14 +796,14 @@ FX_BOOL CFX_ImageStretcher::StartQuickStretch() } if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH_PIXELS) { ContinueQuickStretch(NULL); - 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 == NULL) { - return FALSE; + return false; } int result_width = m_ClipRect.Width(), result_height = m_ClipRect.Height(); int src_height = m_pSource->GetHeight(); @@ -823,7 +823,7 @@ FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) src_y = 0; } if (m_pSource->SkipToScanline(src_y, pPause)) { - return TRUE; + return true; } m_pSource->DownSampleScanline(src_y, m_pScanline, m_DestBPP, m_DestWidth, m_bFlipX, m_ClipRect.left, result_width); if (m_pMaskScanline) { @@ -831,5 +831,5 @@ FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) } m_pDest->ComposeScanline(dest_y, m_pScanline, m_pMaskScanline); } - return FALSE; + return false; } diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp index 8a864f10a1..efd886e2b7 100644 --- a/core/src/fxge/dib/fx_dib_main.cpp +++ b/core/src/fxge/dib/fx_dib_main.cpp @@ -9,7 +9,7 @@ #include "../../../include/fxcodec/fx_codec.h" #include "dib_int.h" #include -FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitch, int width, int height, +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, FX_DWORD*& pal, void* pIccTransform); void CmykDecode(FX_DWORD cmyk, int& c, int& m, int& y, int& k) { @@ -52,39 +52,39 @@ CFX_DIBSource::~CFX_DIBSource() } CFX_DIBitmap::CFX_DIBitmap() { - m_bExtBuf = FALSE; + m_bExtBuf = false; m_pBuffer = NULL; m_pPalette = NULL; } #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 = NULL; 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 == NULL) { - return FALSE; + return false; } } else { m_pBuffer = FX_Alloc(uint8_t, size); @@ -94,33 +94,33 @@ FX_BOOL CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, uint8_t 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 && m_pBuffer) { FX_Free(m_pBuffer); m_pBuffer = NULL; 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() { @@ -218,19 +218,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 = NULL; - return FALSE; + return false; } FXSYS_memset(m_pAlphaMask->GetBuffer(), 0xff, m_pAlphaMask->GetHeight()*m_pAlphaMask->GetPitch()); - return TRUE; + return true; } FX_DWORD CFX_DIBSource::GetPaletteEntry(int index) const { @@ -367,15 +367,15 @@ void CFX_DIBSource::GetOverlapRect(int& dest_left, int& dest_top, int& width, in width = dest_rect.right - dest_rect.left; height = dest_rect.bottom - dest_rect.top; } -FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int height, +bool CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { if (m_pBuffer == NULL) { - return FALSE; + return false; } GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(), pSrcBitmap->GetHeight(), src_left, src_top, NULL); if (width == 0 || height == 0) { - return TRUE; + return true; } FXDIB_Format dest_format = GetFormat(); FXDIB_Format src_format = pSrcBitmap->GetFormat(); @@ -402,7 +402,7 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int } } else { if (m_pPalette) { - return FALSE; + return false; } if (m_bpp == 8) { dest_format = FXDIB_8bppMask; @@ -410,25 +410,25 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int uint8_t* dest_buf = m_pBuffer + dest_top * m_Pitch + dest_left * GetBPP() / 8; FX_DWORD* d_plt = NULL; if(!ConvertBuffer(dest_format, dest_buf, m_Pitch, width, height, pSrcBitmap, src_left, src_top, d_plt, pIccTransform)) { - return FALSE; + return false; } } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int height, +bool CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int height, const CFX_DIBSource* pMask, FX_DWORD color, int src_left, int src_top, int alpha_flag, void* pIccTransform) { if (m_pBuffer == NULL) { - 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, NULL); if (width == 0 || height == 0) { - return TRUE; + return true; } int src_bpp = pMask->GetBPP(); int alpha; @@ -449,7 +449,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int h AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), 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()) { @@ -507,7 +507,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int h } } } - return TRUE; + return true; } void CFX_DIBSource::CopyPalette(const FX_DWORD* pSrc, FX_DWORD size) { @@ -570,21 +570,21 @@ 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); if (pClip) { 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 ++) @@ -593,25 +593,25 @@ FX_BOOL CFX_DIBSource::CopyAlphaMask(const CFX_DIBSource* pAlphaMask, const FX_R } 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 == NULL) { - 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 == NULL) { - return FALSE; + return false; } } if(pSrcBitmap->GetFormat() == FXDIB_Argb) { @@ -621,7 +621,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource } } else { if (pSrcBitmap->IsAlphaMask()) { - return FALSE; + return false; } if (pSrcBitmap->GetBPP() < 24) { if (pSrcBitmap->IsCmykImage()) { @@ -630,7 +630,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource pSrcClone = pSrcBitmap->CloneConvert((FXDIB_Format)((pSrcBitmap->GetFormat() & 0xff00) | 0x18)); } if (pSrcClone == NULL) { - return FALSE; + return false; } } srcOffset = g_ChannelOffset[srcChannel]; @@ -641,7 +641,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } destOffset = 0; } else { @@ -650,7 +650,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } if (GetFormat() == FXDIB_Argb) { destOffset = 3; @@ -661,7 +661,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } if (GetBPP() < 24) { if (HasAlpha()) { @@ -669,7 +669,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } } else #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ @@ -680,7 +680,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } } destOffset = g_ChannelOffset[destChannel]; @@ -694,7 +694,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } } } @@ -710,7 +710,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource delete pSrcClone; } if (pSrcMatched == NULL) { - return FALSE; + return false; } pSrcClone = pSrcMatched; } @@ -732,24 +732,24 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource 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 == NULL) { - 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; @@ -757,21 +757,21 @@ 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; } } else #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb)) { - return FALSE; + return false; } #else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb32)) { - return FALSE; + return false; } #endif } @@ -780,11 +780,11 @@ 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; @@ -793,16 +793,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 == NULL) { - return FALSE; + return false; } ASSERT(pSrcBitmap->IsAlphaMask()); if (!pSrcBitmap->IsAlphaMask()) { - return FALSE; + return false; } if (!IsAlphaMask() && !HasAlpha()) { return LoadChannel(FXDIB_Alpha, pSrcBitmap, FXDIB_Alpha); @@ -812,7 +812,7 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) pSrcClone = pSrcBitmap->StretchTo(m_Width, m_Height); ASSERT(pSrcClone != NULL); if (pSrcClone == NULL) { - return FALSE; + return false; } } if (IsAlphaMask()) { @@ -820,7 +820,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; @@ -844,7 +844,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; @@ -861,17 +861,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 == NULL) { - return FALSE; + return false; } switch (GetFormat()) { case FXDIB_1bppRgb: { if (m_pPalette == NULL) { - return FALSE; + return false; } uint8_t gray[2]; for (int i = 0; i < 2; i ++) { @@ -883,7 +883,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 ++) { @@ -902,7 +902,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) } case FXDIB_8bppRgb: { if (m_pPalette == NULL) { - return FALSE; + return false; } uint8_t gray[256]; for (int i = 0; i < 256; i ++) { @@ -914,7 +914,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(); @@ -931,7 +931,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; @@ -949,7 +949,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; @@ -964,19 +964,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 == NULL) { - return FALSE; + return false; } switch (GetFormat()) { case FXDIB_1bppMask: if (!ConvertFormat(FXDIB_8bppMask)) { - return FALSE; + return false; } MultiplyAlpha(alpha); break; @@ -1004,18 +1004,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; } FX_DWORD CFX_DIBitmap::GetPixel(int x, int y) const { @@ -1122,7 +1122,7 @@ void CFX_DIBitmap::SetPixel(int x, int y, FX_DWORD color) } } void CFX_DIBitmap::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, - int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const + int dest_width, bool bFlipX, int clip_left, int clip_width) const { if (m_pBuffer == NULL) { return; @@ -1179,15 +1179,15 @@ void CFX_DIBitmap::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp } } } -FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) +bool CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) { ASSERT(!IsAlphaMask()); if (m_pBuffer == NULL || IsAlphaMask()) { - return FALSE; + return false; } int fc, fm, fy, fk, bc, bm, by, bk; int fr, fg, fb, br, bg, bb; - FX_BOOL isCmykImage = IsCmykImage(); + bool isCmykImage = IsCmykImage(); if (isCmykImage) { fc = FXSYS_GetCValue(forecolor); fm = FXSYS_GetMValue(forecolor); @@ -1208,10 +1208,10 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) if (m_bpp <= 8) { if (isCmykImage) { if (forecolor == 0xff && backcolor == 0 && m_pPalette == NULL) { - return TRUE; + return true; } } else if (forecolor == 0 && backcolor == 0xffffff && m_pPalette == NULL) { - return TRUE; + return true; } if (m_pPalette == NULL) { BuildPalette(); @@ -1232,7 +1232,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) m_pPalette[i] = FXARGB_MAKE(0xff, br + (fr - br) * gray / 255, bg + (fg - bg) * gray / 255, bb + (fb - bb) * gray / 255); } - return TRUE; + return true; } if (isCmykImage) { if (forecolor == 0xff && backcolor == 0x00) { @@ -1248,7 +1248,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) *scanline ++ = 255 - FXRGB2GRAY(r, g, b); } } - return TRUE; + return true; } } else if (forecolor == 0 && backcolor == 0xffffff) { for (int row = 0; row < m_Height; row ++) { @@ -1262,7 +1262,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) scanline += gap; } } - return TRUE; + return true; } if (isCmykImage) { for (int row = 0; row < m_Height; row ++) { @@ -1291,18 +1291,18 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) } } } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, int pal_size, const FX_RECT* pRect) +bool CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, int pal_size, const FX_RECT* pRect) { if (m_pBuffer == NULL) { - return FALSE; + return false; } if (m_bpp != 8 && m_pPalette != NULL && m_AlphaFlag != 0) { - return FALSE; + return false; } if (m_Width < 4 && m_Height < 4) { - return FALSE; + return false; } FX_RECT rect(0, 0, m_Width, m_Height); if (pRect) { @@ -1374,9 +1374,9 @@ FX_BOOL CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, int pal_size, const FX_ } } } - 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())) { @@ -1480,7 +1480,7 @@ CFX_FilteredDIB::~CFX_FilteredDIB() FX_Free(m_pScanline); } } -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; @@ -1499,7 +1499,7 @@ const uint8_t* CFX_FilteredDIB::GetScanline(int line) const return m_pScanline; } void CFX_FilteredDIB::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, - int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const + int dest_width, bool bFlipX, int clip_left, int clip_width) const { m_pSrc->DownSampleScanline(line, dest_scan, dest_bpp, dest_width, bFlipX, clip_left, clip_width); TranslateDownSamples(dest_scan, dest_scan, clip_width, dest_bpp); @@ -1508,18 +1508,18 @@ CFX_ImageRenderer::CFX_ImageRenderer() { m_Status = 0; m_pTransformer = NULL; - m_bRgbByteOrder = FALSE; + m_bRgbByteOrder = false; m_BlendType = FXDIB_BLEND_NORMAL; } CFX_ImageRenderer::~CFX_ImageRenderer() { delete m_pTransformer; } -extern FX_RECT _FXDIB_SwapClipBox(FX_RECT& clip, int width, int height, FX_BOOL bFlipX, FX_BOOL bFlipY); -FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClipRgn, +extern FX_RECT _FXDIB_SwapClipBox(FX_RECT& clip, int width, int height, bool bFlipX, bool bFlipY); +bool CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClipRgn, const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD mask_color, const CFX_AffineMatrix* pMatrix, - FX_DWORD dib_flags, FX_BOOL bRgbByteOrder, + FX_DWORD dib_flags, bool bRgbByteOrder, int alpha_flag, void* pIccTransform, int blend_type) { m_Matrix = *pMatrix; @@ -1528,7 +1528,7 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClip m_ClipBox = pClipRgn ? pClipRgn->GetBox() : FX_RECT(0, 0, pDevice->GetWidth(), pDevice->GetHeight()); m_ClipBox.Intersect(image_rect); if (m_ClipBox.IsEmpty()) { - return FALSE; + return false; } m_pDevice = pDevice; m_pClipRgn = pClipRgn; @@ -1540,7 +1540,7 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClip m_pIccTransform = pIccTransform; m_bRgbByteOrder = bRgbByteOrder; m_BlendType = blend_type; - FX_BOOL ret = TRUE; + bool ret = true; if ((FXSYS_fabs(m_Matrix.b) >= 0.5f || m_Matrix.a == 0) || (FXSYS_fabs(m_Matrix.c) >= 0.5f || m_Matrix.d == 0) ) { if (FXSYS_fabs(m_Matrix.a) < FXSYS_fabs(m_Matrix.b) / 20 && FXSYS_fabs(m_Matrix.d) < FXSYS_fabs(m_Matrix.c) / 20 && @@ -1550,18 +1550,18 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClip FX_RECT bitmap_clip = m_ClipBox; bitmap_clip.Offset(-image_rect.left, -image_rect.top); 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_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox, true, m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder, alpha_flag, pIccTransform, m_BlendType); if (!m_Stretcher.Start(&m_Composer, pSource, dest_height, dest_width, bitmap_clip, dib_flags)) { - return FALSE; + return false; } m_Status = 1; - return TRUE; + return true; } m_Status = 2; m_pTransformer = new CFX_ImageTransformer; m_pTransformer->Start(pSource, &m_Matrix, dib_flags, &m_ClipBox); - return TRUE; + return true; } int dest_width = image_rect.Width(); if (m_Matrix.a < 0) { @@ -1572,32 +1572,32 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClip 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, pIccTransform, m_BlendType); + m_ClipBox, false, false, false, m_bRgbByteOrder, alpha_flag, pIccTransform, m_BlendType); m_Status = 1; ret = m_Stretcher.Start(&m_Composer, pSource, dest_width, dest_height, bitmap_clip, dib_flags); return ret; } -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; } CFX_DIBitmap* pBitmap = m_pTransformer->m_Storer.Detach(); if (pBitmap == NULL) { - return FALSE; + return false; } if (pBitmap->GetBuffer() == NULL) { delete pBitmap; - return FALSE; + return false; } if (pBitmap->IsAlphaMask()) { if (m_BitmapAlpha != 255) { @@ -1618,9 +1618,9 @@ FX_BOOL CFX_ImageRenderer::Continue(IFX_Pause* pPause) pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap, 0, 0, m_BlendType, m_pClipRgn, m_bRgbByteOrder, m_pIccTransform); } delete pBitmap; - return FALSE; + return false; } - return FALSE; + return false; } CFX_BitmapStorer::CFX_BitmapStorer() { @@ -1653,16 +1653,16 @@ void CFX_BitmapStorer::ComposeScanline(int line, const uint8_t* scanline, const FXSYS_memcpy(dest_alpha_buf, scan_extra_alpha, m_pBitmap->m_pAlphaMask->GetPitch()); } } -FX_BOOL CFX_BitmapStorer::SetInfo(int width, int height, FXDIB_Format src_format, FX_DWORD* pSrcPalette) +bool CFX_BitmapStorer::SetInfo(int width, int height, FXDIB_Format src_format, FX_DWORD* pSrcPalette) { m_pBitmap = new CFX_DIBitmap; if (!m_pBitmap->Create(width, height, src_format)) { delete m_pBitmap; m_pBitmap = NULL; - return FALSE; + return false; } if (pSrcPalette) { m_pBitmap->CopyPalette(pSrcPalette); } - return TRUE; + return true; } diff --git a/core/src/fxge/dib/fx_dib_transform.cpp b/core/src/fxge/dib/fx_dib_transform.cpp index e34e715bf2..01bc167ede 100644 --- a/core/src/fxge/dib/fx_dib_transform.cpp +++ b/core/src/fxge/dib/fx_dib_transform.cpp @@ -54,7 +54,7 @@ public: y1 /= base; } }; -CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_RECT* pDestClip) const +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) { @@ -148,7 +148,7 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_REC return pTransBitmap; } #define FIX16_005 0.05f -FX_RECT _FXDIB_SwapClipBox(FX_RECT& clip, int width, int height, FX_BOOL bFlipX, FX_BOOL bFlipY) +FX_RECT _FXDIB_SwapClipBox(FX_RECT& clip, int width, int height, bool bFlipX, bool bFlipY) { FX_RECT rect; if (bFlipY) { @@ -206,7 +206,7 @@ CFX_ImageTransformer::CFX_ImageTransformer() CFX_ImageTransformer::~CFX_ImageTransformer() { } -FX_BOOL CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pDestMatrix, int flags, const FX_RECT* pDestClip) +bool CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pDestMatrix, int flags, const FX_RECT* pDestClip) { m_pMatrix = (CFX_AffineMatrix*)pDestMatrix; CFX_FloatRect unit_rect = pDestMatrix->GetUnitRect(); @@ -216,7 +216,7 @@ FX_BOOL CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineM result_clip.Intersect(*pDestClip); } if (result_clip.IsEmpty()) { - return FALSE; + return false; } m_ResultLeft = result_clip.left; m_ResultTop = result_clip.top; @@ -232,7 +232,7 @@ FX_BOOL CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineM result_clip = _FXDIB_SwapClipBox(result_clip, dest_width, dest_height, pDestMatrix->c > 0, pDestMatrix->b < 0); m_Stretcher.Start(&m_Storer, pSrc, dest_height, dest_width, result_clip, flags); m_Status = 1; - return TRUE; + return true; } if (FXSYS_fabs(pDestMatrix->b) < FIX16_005 && FXSYS_fabs(pDestMatrix->c) < FIX16_005) { int dest_width = pDestMatrix->a > 0 ? (int)FXSYS_ceil(pDestMatrix->a) : (int)FXSYS_floor(pDestMatrix->a); @@ -240,7 +240,7 @@ FX_BOOL CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineM result_clip.Offset(-result_rect.left, -result_rect.top); m_Stretcher.Start(&m_Storer, pSrc, dest_width, dest_height, result_clip, flags); m_Status = 2; - return TRUE; + return true; } int stretch_width = (int)FXSYS_ceil(FXSYS_sqrt2(pDestMatrix->a, pDestMatrix->b)); int stretch_height = (int)FXSYS_ceil(FXSYS_sqrt2(pDestMatrix->c, pDestMatrix->d)); @@ -254,7 +254,7 @@ FX_BOOL CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineM m_StretchClip.Intersect(0, 0, stretch_width, stretch_height); m_Stretcher.Start(&m_Storer, pSrc, stretch_width, stretch_height, m_StretchClip, flags); m_Status = 3; - return TRUE; + return true; } uint8_t _bilinear_interpol(const uint8_t* buf, int row_offset_l, int row_offset_r, int src_col_l, int src_col_r, int res_x, int res_y, @@ -335,30 +335,30 @@ FXDIB_Format _GetTransformedFormat(const CFX_DIBSource* pDrc) } return format; } -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()) { m_Storer.Replace(m_Storer.GetBitmap()->SwapXY(m_pMatrix->c > 0, m_pMatrix->b < 0)); } - 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() == NULL) { - return FALSE; + return false; } const uint8_t* stretch_buf = m_Storer.GetBitmap()->GetBuffer(); const uint8_t* stretch_buf_mask = NULL; @@ -370,7 +370,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) FXDIB_Format transformF = _GetTransformedFormat(m_Stretcher.m_pSource); if (!pTransformed->Create(m_ResultWidth, m_ResultHeight, transformF)) { delete pTransformed; - return FALSE; + return false; } pTransformed->Clear(0); if (pTransformed->m_pAlphaMask) { @@ -641,7 +641,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)) { CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); @@ -786,5 +786,5 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } } m_Storer.Replace(pTransformed); - return FALSE; + return false; } -- cgit v1.2.3