diff options
Diffstat (limited to 'core/fxge')
47 files changed, 2133 insertions, 2147 deletions
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, ¶ms); 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; |