diff options
Diffstat (limited to 'core/src/fxge')
37 files changed, 1180 insertions, 1180 deletions
diff --git a/core/src/fxge/agg/include/fx_agg_driver.h b/core/src/fxge/agg/include/fx_agg_driver.h index 29b56c77e4..c8d620122e 100644 --- a/core/src/fxge/agg/include/fx_agg_driver.h +++ b/core/src/fxge/agg/include/fx_agg_driver.h @@ -22,7 +22,7 @@ public: class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { public: - CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout); + CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, bool bRgbByteOrder, CFX_DIBitmap* pOriDevice, bool bGroupKnockout); virtual ~CFX_AggDeviceDriver(); void InitPlatform(); void DestroyPlatform(); @@ -32,22 +32,22 @@ public: virtual void SaveState(); - virtual void RestoreState(FX_BOOL bKeepSaved); + virtual void RestoreState(bool bKeepSaved); - virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, + virtual bool SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, int fill_mode ); - virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, + virtual bool SetClip_PathStroke(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState ); - virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, + virtual bool DrawPath(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState, FX_DWORD fill_color, @@ -58,44 +58,44 @@ public: int blend_type ); - virtual FX_BOOL SetPixel(int x, int y, FX_DWORD color, + virtual bool SetPixel(int x, int y, FX_DWORD color, int alpha_flag, void* pIccTransform); - virtual FX_BOOL FillRect(const FX_RECT* pRect, + virtual bool FillRect(const FX_RECT* pRect, FX_DWORD fill_color, int alpha_flag, void* pIccTransform, int blend_type); - virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, FX_DWORD color, + virtual bool DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, FX_DWORD color, int alpha_flag, void* pIccTransform, int blend_type) { - return FALSE; + return false; } - virtual FX_BOOL GetClipBox(FX_RECT* pRect); + virtual bool GetClipBox(FX_RECT* pRect); - virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform = NULL, FX_BOOL bDEdge = FALSE); + virtual bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform = NULL, bool bDEdge = false); virtual CFX_DIBitmap* GetBackDrop() { return m_pOriDevice; } - virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type, + virtual bool SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type, int alpha_flag, void* pIccTransform); - virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, + virtual bool StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform, int blend_type); - virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, + virtual bool StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, const CFX_AffineMatrix* pMatrix, FX_DWORD flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type); - virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); + 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, + virtual bool DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, int alpha_flag, void* pIccTransform); - virtual FX_BOOL RenderRasterizer(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa)& rasterizer, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout, + virtual bool RenderRasterizer(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa)& rasterizer, FX_DWORD color, bool bFullCover, bool bGroupKnockout, int alpha_flag, void* pIccTransform); void SetClipMask(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa)& rasterizer); @@ -117,9 +117,9 @@ public: void* m_pDwRenderTartget; int m_FillFlags; int m_DitherBits; - FX_BOOL m_bRgbByteOrder; + bool m_bRgbByteOrder; CFX_DIBitmap* m_pOriDevice; - FX_BOOL m_bGroupKnockout; + bool m_bGroupKnockout; }; #endif // FX_AGG_DRIVER_H_ diff --git a/core/src/fxge/agg/src/fx_agg_driver.cpp b/core/src/fxge/agg/src/fx_agg_driver.cpp index 118db7bf1f..2f96ef7379 100644 --- a/core/src/fxge/agg/src/fx_agg_driver.cpp +++ b/core/src/fxge/agg/src/fx_agg_driver.cpp @@ -119,7 +119,7 @@ private: static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer, agg::path_storage& path_data, const CFX_AffineMatrix* 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) { @@ -185,11 +185,11 @@ static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer, agg::path_s rasterizer.add_path_transformed(stroke, pObject2Device); } } -IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver(CFX_DIBitmap* pBitmap, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) +IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver(CFX_DIBitmap* pBitmap, bool bRgbByteOrder, CFX_DIBitmap* pOriDevice, bool bGroupKnockout) { return new CFX_AggDeviceDriver(pBitmap, 0, bRgbByteOrder, pOriDevice, bGroupKnockout); } -CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) +CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, bool bRgbByteOrder, CFX_DIBitmap* pOriDevice, bool bGroupKnockout) { m_pBitmap = pBitmap; m_DitherBits = dither_bits; @@ -217,11 +217,11 @@ void CFX_AggDeviceDriver::InitPlatform() void CFX_AggDeviceDriver::DestroyPlatform() { } -FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, +bool CFX_AggDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, int alpha_flag, void* pIccTransform) { - return FALSE; + return false; } #endif int CFX_AggDeviceDriver::GetDeviceCaps(int caps_id) @@ -267,7 +267,7 @@ void CFX_AggDeviceDriver::SaveState() } m_StateStack.Add(pClip); } -void CFX_AggDeviceDriver::RestoreState(FX_BOOL bKeepSaved) +void CFX_AggDeviceDriver::RestoreState(bool bKeepSaved) { if (m_StateStack.GetSize() == 0) { delete m_pClipRgn; @@ -307,7 +307,7 @@ void CFX_AggDeviceDriver::SetClipMask(agg::rasterizer_scanline_aa& rasterizer) agg::render_scanlines(rasterizer, scanline, final_render, (m_FillFlags & FXFILL_NOPATHSMOOTH) != 0); m_pClipRgn->IntersectMaskF(path_rect.left, path_rect.top, mask); } -FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, +bool CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, int fill_mode ) @@ -322,7 +322,7 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, rectf.Intersect(CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH), (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT))); FX_RECT rect = rectf.GetOutterRect(); m_pClipRgn->IntersectRect(rect); - return TRUE; + return true; } } CAgg_PathData path_data; @@ -333,9 +333,9 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, rasterizer.add_path(path_data.m_PathData); rasterizer.filling_rule((fill_mode & 3) == FXFILL_WINDING ? agg::fill_non_zero : agg::fill_even_odd); SetClipMask(rasterizer); - return TRUE; + return true; } -FX_BOOL CFX_AggDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData, +bool CFX_AggDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState ) @@ -350,7 +350,7 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData, RasterizeStroke(rasterizer, path_data.m_PathData, pObject2Device, pGraphState); rasterizer.filling_rule(agg::fill_non_zero); SetClipMask(rasterizer); - return TRUE; + return true; } class CFX_Renderer { @@ -361,8 +361,8 @@ private: m_Blue, m_Gray; FX_DWORD 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; @@ -371,7 +371,7 @@ private: void (CFX_Renderer::*composite_span)(uint8_t*, int, int, int, uint8_t*, int, int, uint8_t*, uint8_t*); public: void prepare(unsigned) {} - void CompositeSpan(uint8_t* dest_scan, uint8_t* ori_scan, int Bpp, FX_BOOL bDestAlpha, + void CompositeSpan(uint8_t* dest_scan, uint8_t* ori_scan, int Bpp, bool bDestAlpha, int span_left, int span_len, uint8_t* cover_scan, int clip_left, int clip_right, uint8_t* clip_scan) { @@ -955,7 +955,7 @@ public: 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) { @@ -988,7 +988,7 @@ public: } } - FX_BOOL Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDevice, const CFX_ClipRgn* pClipRgn, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bRgbByteOrder, + bool Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDevice, const CFX_ClipRgn* pClipRgn, FX_DWORD color, bool bFullCover, bool bRgbByteOrder, int alpha_flag = 0, void* pIccTransform = NULL) { m_pDevice = pDevice; @@ -1008,8 +1008,8 @@ public: m_pClipMask = m_pClipRgn->GetMask(); } 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); ICodec_IccModule* pIccModule = NULL; if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { @@ -1039,7 +1039,7 @@ public: } } } - return TRUE; + return true; } if (bDeviceCMYK) { ASSERT(!m_bRgbByteOrder); @@ -1051,7 +1051,7 @@ public: } } else { if (!pIccTransform) { - return FALSE; + return false; } color = FXARGB_TODIB(color); pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1); @@ -1100,22 +1100,22 @@ public: if (m_pDevice->GetBPP() == 1) { composite_span = &CFX_Renderer::CompositeSpan1bpp; } - return TRUE; + return true; } }; -FX_BOOL CFX_AggDeviceDriver::RenderRasterizer(agg::rasterizer_scanline_aa& rasterizer, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout, +bool CFX_AggDeviceDriver::RenderRasterizer(agg::rasterizer_scanline_aa& rasterizer, FX_DWORD color, bool bFullCover, bool bGroupKnockout, int alpha_flag, void* pIccTransform) { CFX_DIBitmap* pt = bGroupKnockout ? m_pOriDevice : NULL; CFX_Renderer render; if (!render.Init(m_pBitmap, pt, m_pClipRgn, 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, +bool CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState, FX_DWORD fill_color, @@ -1127,10 +1127,10 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, ) { if (blend_type != FXDIB_BLEND_NORMAL) { - return FALSE; + return false; } if (GetBuffer() == NULL) { - return TRUE; + return true; } m_FillFlags = fill_mode; if ((fill_mode & 3) && fill_color) { @@ -1140,8 +1140,8 @@ 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))); rasterizer.add_path(path_data.m_PathData); rasterizer.filling_rule((fill_mode & 3) == FXFILL_WINDING ? agg::fill_non_zero : agg::fill_even_odd); - if (!RenderRasterizer(rasterizer, fill_color, fill_mode & FXFILL_FULLCOVER, FALSE, alpha_flag, pIccTransform)) { - return FALSE; + if (!RenderRasterizer(rasterizer, fill_color, fill_mode & FXFILL_FULLCOVER, false, alpha_flag, pIccTransform)) { + return false; } } int stroke_alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_STROKE(alpha_flag) : FXARGB_A(stroke_color); @@ -1151,12 +1151,12 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, path_data.BuildPath(pPathData, pObject2Device); agg::rasterizer_scanline_aa rasterizer; 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, NULL, pGraphState, 1, FALSE, fill_mode & FX_STROKE_TEXT_MODE); + RasterizeStroke(rasterizer, path_data.m_PathData, NULL, pGraphState, 1, false, fill_mode & FX_STROKE_TEXT_MODE); int fill_flag = FXGETFLAG_COLORTYPE(alpha_flag) << 8 | FXGETFLAG_ALPHA_STROKE(alpha_flag); if (!RenderRasterizer(rasterizer, stroke_color, fill_mode & FXFILL_FULLCOVER, m_bGroupKnockout, fill_flag, pIccTransform)) { - return FALSE; + return false; } - return TRUE; + return true; } CFX_AffineMatrix matrix1, matrix2; if (pObject2Device) { @@ -1174,13 +1174,13 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, path_data.BuildPath(pPathData, &matrix1); agg::rasterizer_scanline_aa rasterizer; 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); + RasterizeStroke(rasterizer, path_data.m_PathData, &matrix2, pGraphState, matrix1.a, false, fill_mode & FX_STROKE_TEXT_MODE); int fill_flag = FXGETFLAG_COLORTYPE(alpha_flag) << 8 | FXGETFLAG_ALPHA_STROKE(alpha_flag); if (!RenderRasterizer(rasterizer, stroke_color, fill_mode & FXFILL_FULLCOVER, m_bGroupKnockout, fill_flag, pIccTransform)) { - return FALSE; + return false; } } - return TRUE; + return true; } void RgbByteOrderSetPixel(CFX_DIBitmap* pBitmap, int x, int y, FX_DWORD argb) { @@ -1208,7 +1208,7 @@ void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap, int left, int top, int wid width = rect.Width(); int src_r = FXARGB_R(argb), src_g = FXARGB_G(argb), 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) { @@ -1317,7 +1317,7 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t } } } else { - ASSERT(FALSE); + ASSERT(false); } } else if (dest_format == FXDIB_Argb || dest_format == FXDIB_Rgb32) { if (src_format == FXDIB_Rgb) { @@ -1351,7 +1351,7 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t } } } else { - ASSERT(FALSE); + ASSERT(false); } } FX_ARGB _DefaultCMYK2ARGB(FX_CMYK cmyk, uint8_t alpha) @@ -1361,9 +1361,9 @@ FX_ARGB _DefaultCMYK2ARGB(FX_CMYK cmyk, uint8_t alpha) r, g, b); return ArgbEncode(alpha, r, g, b); } -FX_BOOL _DibSetPixel(CFX_DIBitmap* pDevice, int x, int y, FX_DWORD color, int alpha_flag, void* pIccTransform) +bool _DibSetPixel(CFX_DIBitmap* pDevice, int x, int y, FX_DWORD color, int alpha_flag, void* pIccTransform) { - FX_BOOL bObjCMYK = FXGETFLAG_COLORTYPE(alpha_flag); + bool bObjCMYK = FXGETFLAG_COLORTYPE(alpha_flag); int alpha = bObjCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); @@ -1376,7 +1376,7 @@ FX_BOOL _DibSetPixel(CFX_DIBitmap* pDevice, int x, int y, FX_DWORD color, int al } else { if (pDevice->IsCmykImage()) { if (!bObjCMYK) { - return FALSE; + return false; } } else { if (bObjCMYK) { @@ -1388,12 +1388,12 @@ FX_BOOL _DibSetPixel(CFX_DIBitmap* pDevice, int x, int y, FX_DWORD color, int al if (pDevice->m_pAlphaMask) { pDevice->m_pAlphaMask->SetPixel(x, y, alpha << 24); } - return TRUE; + return true; } -FX_BOOL CFX_AggDeviceDriver::SetPixel(int x, int y, FX_DWORD color, int alpha_flag, void* pIccTransform) +bool CFX_AggDeviceDriver::SetPixel(int x, int y, FX_DWORD color, int alpha_flag, void* pIccTransform) { if (m_pBitmap->GetBuffer() == NULL) { - return TRUE; + return true; } if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { pIccTransform = NULL; @@ -1413,12 +1413,12 @@ FX_BOOL CFX_AggDeviceDriver::SetPixel(int x, int y, FX_DWORD color, int alpha_fl } } else if (m_pClipRgn->GetType() == CFX_ClipRgn::MaskF) { const CFX_DIBitmap* pMask = m_pClipRgn->GetMask(); - FX_BOOL bCMYK = FXGETFLAG_COLORTYPE(alpha_flag); + bool bCMYK = FXGETFLAG_COLORTYPE(alpha_flag); int new_alpha = bCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); new_alpha = new_alpha * pMask->GetScanline(y)[x] / 255; if (m_bRgbByteOrder) { RgbByteOrderSetPixel(m_pBitmap, x, y, (color & 0xffffff) | (new_alpha << 24)); - return TRUE; + return true; } if (bCMYK) { FXSETFLAG_ALPHA_FILL(alpha_flag, new_alpha); @@ -1428,15 +1428,15 @@ FX_BOOL CFX_AggDeviceDriver::SetPixel(int x, int y, FX_DWORD color, int alpha_fl return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTransform); } } - return TRUE; + return true; } -FX_BOOL CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect, FX_DWORD fill_color, int alpha_flag, void* pIccTransform, int blend_type) +bool CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect, FX_DWORD fill_color, int alpha_flag, void* pIccTransform, int blend_type) { if (blend_type != FXDIB_BLEND_NORMAL) { - return FALSE; + return false; } if (m_pBitmap->GetBuffer() == NULL) { - return TRUE; + return true; } FX_RECT clip_rect; GetClipBox(&clip_rect); @@ -1445,7 +1445,7 @@ FX_BOOL CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect, FX_DWORD fill_color, draw_rect.Intersect(*pRect); } if (draw_rect.IsEmpty()) { - return TRUE; + return true; } if (m_pClipRgn == NULL || m_pClipRgn->GetType() == CFX_ClipRgn::RectI) { if (m_bRgbByteOrder) { @@ -1453,27 +1453,27 @@ FX_BOOL CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect, FX_DWORD fill_color, } else { m_pBitmap->CompositeRect(draw_rect.left, draw_rect.top, draw_rect.Width(), draw_rect.Height(), fill_color, alpha_flag, pIccTransform); } - return TRUE; + return true; } m_pBitmap->CompositeMask(draw_rect.left, draw_rect.top, draw_rect.Width(), draw_rect.Height(), (const CFX_DIBitmap*)m_pClipRgn->GetMask(), fill_color, draw_rect.left - clip_rect.left, draw_rect.top - clip_rect.top, FXDIB_BLEND_NORMAL, NULL, m_bRgbByteOrder, alpha_flag, pIccTransform); - return TRUE; + return true; } -FX_BOOL CFX_AggDeviceDriver::GetClipBox(FX_RECT* pRect) +bool CFX_AggDeviceDriver::GetClipBox(FX_RECT* pRect) { if (m_pClipRgn == NULL) { 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, void* pIccTransform, FX_BOOL bDEdge) +bool CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform, bool bDEdge) { if (m_pBitmap->GetBuffer() == NULL) { - return TRUE; + return true; } if (bDEdge) { if (m_bRgbByteOrder) { @@ -1481,23 +1481,23 @@ FX_BOOL CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, } else { return pBitmap->TransferBitmap(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight(), m_pBitmap, left, top, pIccTransform); } - return TRUE; + return true; } FX_RECT rect(left, top, left + pBitmap->GetWidth(), top + pBitmap->GetHeight()); CFX_DIBitmap *pBack = NULL; 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 = left >= 0 ? 0 : left; top = top >= 0 ? 0 : top; if (m_bRgbByteOrder) { @@ -1508,11 +1508,11 @@ FX_BOOL CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, delete pBack; return bRet; } -FX_BOOL CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD argb, const FX_RECT* pSrcRect, int left, int top, int blend_type, +bool CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD argb, const FX_RECT* pSrcRect, int left, int top, int blend_type, int alpha_flag, void* pIccTransform) { if (m_pBitmap->GetBuffer() == NULL) { - return TRUE; + return true; } if (pBitmap->IsAlphaMask()) return m_pBitmap->CompositeMask(left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, argb, @@ -1520,12 +1520,12 @@ FX_BOOL CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD ar return m_pBitmap->CompositeBitmap(left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, pSrcRect->left, pSrcRect->top, blend_type, m_pClipRgn, m_bRgbByteOrder, pIccTransform); } -FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD argb, int dest_left, int dest_top, +bool CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD argb, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform, int blend_type) { if (m_pBitmap->GetBuffer() == NULL) { - return TRUE; + return true; } if (dest_width == pSource->GetWidth() && dest_height == pSource->GetHeight()) { FX_RECT rect(0, 0, dest_width, dest_height); @@ -1536,30 +1536,30 @@ FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWOR FX_RECT dest_clip = dest_rect; dest_clip.Intersect(*pClipRect); CFX_BitmapComposer composer; - composer.Compose(m_pBitmap, m_pClipRgn, 255, argb, dest_clip, FALSE, FALSE, FALSE, m_bRgbByteOrder, alpha_flag, pIccTransform, blend_type); + composer.Compose(m_pBitmap, m_pClipRgn, 255, argb, dest_clip, false, false, false, m_bRgbByteOrder, alpha_flag, pIccTransform, blend_type); dest_clip.Offset(-dest_rect.left, -dest_rect.top); CFX_ImageStretcher stretcher; if (stretcher.Start(&composer, pSource, dest_width, dest_height, dest_clip, flags)) { stretcher.Continue(NULL); } - return TRUE; + return true; } -FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD argb, +bool CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD argb, const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type) { if (m_pBitmap->GetBuffer() == NULL) { - return TRUE; + return true; } CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer; pRenderer->Start(m_pBitmap, m_pClipRgn, pSource, bitmap_alpha, argb, pMatrix, render_flags, m_bRgbByteOrder, alpha_flag, pIccTransform); 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() == NULL) { - return TRUE; + return true; } return ((CFX_ImageRenderer*)pHandle)->Continue(pPause); } @@ -1572,30 +1572,30 @@ void CFX_AggDeviceDriver::CancelDIBits(void* pHandle) } CFX_FxgeDevice::CFX_FxgeDevice() { - m_bOwnedBitmap = FALSE; + m_bOwnedBitmap = false; } -FX_BOOL CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) +bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, int dither_bits, bool bRgbByteOrder, CFX_DIBitmap* pOriDevice, bool bGroupKnockout) { if (pBitmap == NULL) { - return FALSE; + return false; } SetBitmap(pBitmap); IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, pOriDevice, bGroupKnockout); SetDeviceDriver(pDriver); - return TRUE; + return true; } -FX_BOOL CFX_FxgeDevice::Create(int width, int height, FXDIB_Format format, int dither_bits, CFX_DIBitmap* pOriDevice) +bool CFX_FxgeDevice::Create(int width, int height, FXDIB_Format format, int dither_bits, CFX_DIBitmap* pOriDevice) { - m_bOwnedBitmap = TRUE; + m_bOwnedBitmap = true; CFX_DIBitmap* pBitmap = new CFX_DIBitmap; if (!pBitmap->Create(width, height, format)) { delete pBitmap; - return FALSE; + return false; } SetBitmap(pBitmap); - IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE); + IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, false, pOriDevice, false); SetDeviceDriver(pDriver); - return TRUE; + return true; } CFX_FxgeDevice::~CFX_FxgeDevice() { diff --git a/core/src/fxge/android/fpf_skiafont.cpp b/core/src/fxge/android/fpf_skiafont.cpp index 2dad01057a..f5ac6c0ce6 100644 --- a/core/src/fxge/android/fpf_skiafont.cpp +++ b/core/src/fxge/android/fpf_skiafont.cpp @@ -87,23 +87,23 @@ int32_t CFPF_SkiaFont::GetDescent() const } return FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), 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,24 +119,24 @@ FX_BOOL CFPF_SkiaFont::GetGlyphBBox(int32_t iGlyphIndex, FX_RECT &rtBBox) return FXFT_Set_Pixel_Sizes(m_Face, 0, 64) == 0; } 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)); rtBBox.bottom = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Glyph_HoriBearingY(m_Face)); rtBBox.right = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Glyph_HoriBearingX(m_Face) + FXFT_Get_Glyph_Width(m_Face)); 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)); rtBBox.top = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Face_yMin(m_Face)); rtBBox.right = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), 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 { @@ -167,10 +167,10 @@ FX_DWORD CFPF_SkiaFont::GetFontData(FX_DWORD dwTable, uint8_t* pBuffer, FX_DWORD } return pdfium::base::checked_cast<FX_DWORD>(ulSize); } -FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, const CFX_ByteStringC& bsFamily, FX_DWORD dwStyle, uint8_t uCharset) +bool CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, const CFX_ByteStringC& bsFamily, FX_DWORD dwStyle, uint8_t uCharset) { if (!pFontMgr || !pFontDes) { - return FALSE; + return false; } switch (pFontDes->GetType()) { case FPF_SKIAFONTTYPE_Path: { @@ -189,16 +189,16 @@ FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescrip } 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; } #endif diff --git a/core/src/fxge/android/fpf_skiafont.h b/core/src/fxge/android/fpf_skiafont.h index 49819d4c11..90cf5cb29c 100644 --- a/core/src/fxge/android/fpf_skiafont.h +++ b/core/src/fxge/android/fpf_skiafont.h @@ -39,13 +39,13 @@ public: virtual int32_t GetAscent() const; virtual int32_t GetDescent() const; - virtual FX_BOOL GetGlyphBBox(int32_t iGlyphIndex, FX_RECT &rtBBox); - virtual FX_BOOL GetBBox(FX_RECT &rtBBox); + virtual bool GetGlyphBBox(int32_t iGlyphIndex, FX_RECT &rtBBox); + virtual bool GetBBox(FX_RECT &rtBBox); virtual int32_t GetHeight() const; virtual int32_t GetItalicAngle() const; virtual FX_DWORD GetFontData(FX_DWORD dwTable, uint8_t* pBuffer, FX_DWORD dwSize); - FX_BOOL InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, const CFX_ByteStringC& bsFamily, FX_DWORD dwStyle, uint8_t uCharset); + bool InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, const CFX_ByteStringC& bsFamily, FX_DWORD dwStyle, uint8_t uCharset); protected: CFPF_SkiaFontMgr *m_pFontMgr; CFPF_SkiaFontDescriptor *m_pFontDes; diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp index 86bb052435..8c835392fc 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.cpp +++ b/core/src/fxge/android/fpf_skiafontmgr.cpp @@ -103,7 +103,7 @@ FX_DWORD FPF_SkiaGetSansFont(FX_DWORD dwHash) } return 0; } -static uint32_t FPF_GetHashCode_StringA(const FX_CHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE) +static uint32_t FPF_GetHashCode_StringA(const FX_CHAR* pStr, int32_t iLength, bool bIgnoreCase = false) { if (!pStr) { return 0; @@ -208,27 +208,27 @@ static FX_DWORD FPF_SKIAGetFamilyHash(const CFX_ByteStringC& bsFamily, FX_DWORD bsFont += "Serif"; } bsFont += uCharset; - return FPF_GetHashCode_StringA(bsFont.c_str(), bsFont.GetLength(), TRUE); + return FPF_GetHashCode_StringA(bsFont.c_str(), bsFont.GetLength(), true); } -static FX_BOOL FPF_SkiaIsCJK(uint8_t uCharset) +static bool FPF_SkiaIsCJK(uint8_t uCharset) { return (uCharset == FXFONT_GB2312_CHARSET) || (uCharset == FXFONT_CHINESEBIG5_CHARSET) || (uCharset == FXFONT_HANGEUL_CHARSET) || (uCharset == FXFONT_SHIFTJIS_CHARSET); } -static FX_BOOL FPF_SkiaMaybeSymbol(const CFX_ByteStringC& bsFacename) +static bool FPF_SkiaMaybeSymbol(const CFX_ByteStringC& bsFacename) { CFX_ByteString bsName = bsFacename; bsName.MakeLower(); return bsName.Find("symbol") > -1; } -static FX_BOOL FPF_SkiaMaybeArabic(const CFX_ByteStringC& bsFacename) +static bool FPF_SkiaMaybeArabic(const CFX_ByteStringC& bsFacename) { CFX_ByteString bsName = bsFacename; bsName.MakeLower(); return bsName.Find("arabic") > -1; } CFPF_SkiaFontMgr::CFPF_SkiaFontMgr() - : m_bLoaded(FALSE), m_FTLibrary(NULL) + : m_bLoaded(false), m_FTLibrary(NULL) { } CFPF_SkiaFontMgr::~CFPF_SkiaFontMgr() @@ -252,7 +252,7 @@ CFPF_SkiaFontMgr::~CFPF_SkiaFontMgr() FXFT_Done_FreeType(m_FTLibrary); } } -FX_BOOL CFPF_SkiaFontMgr::InitFTLibrary() +bool CFPF_SkiaFontMgr::InitFTLibrary() { if (m_FTLibrary == NULL) { FXFT_Init_FreeType(&m_FTLibrary); @@ -266,7 +266,7 @@ void CFPF_SkiaFontMgr::LoadSystemFonts() } ScanPath(FX_BSTRC("/system/fonts")); OutputSystemFonts(); - m_bLoaded = TRUE; + m_bLoaded = true; } void CFPF_SkiaFontMgr::LoadPrivateFont(IFX_FileRead* pFontFile) { @@ -289,7 +289,7 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname, uin FX_DWORD dwFaceName = FPF_SKIANormalizeFontName(bsFamilyname); FX_DWORD dwSubst = FPF_SkiaGetSubstFont(dwFaceName); FX_DWORD dwSubstSans = FPF_SkiaGetSansFont(dwFaceName); - FX_BOOL bMaybeSymbol = FPF_SkiaMaybeSymbol(bsFamilyname); + bool bMaybeSymbol = FPF_SkiaMaybeSymbol(bsFamilyname); if (uCharset != FXFONT_ARABIC_CHARSET && FPF_SkiaMaybeArabic(bsFamilyname)) { uCharset = FXFONT_ARABIC_CHARSET; } else if (uCharset == FXFONT_ANSI_CHARSET && (dwMatch & FPF_MATCHFONT_REPLACEANSI)) { @@ -309,7 +309,7 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname, uin if (dwFaceName == dwSysFontName) { nFind += FPF_SKIAMATCHWEIGHT_NAME1; } - FX_BOOL bMatchedName = (nFind == FPF_SKIAMATCHWEIGHT_NAME1); + bool bMatchedName = (nFind == FPF_SKIAMATCHWEIGHT_NAME1); if ((dwStyle & FXFONT_BOLD) == (pFontDes->m_dwStyle & FXFONT_BOLD)) { nFind += FPF_SKIAMATCHWEIGHT_1; } @@ -327,7 +327,7 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname, uin } if (dwSubst == dwSysFontName || dwSubstSans == dwSysFontName) { nFind += FPF_SKIAMATCHWEIGHT_NAME2; - bMatchedName = TRUE; + bMatchedName = true; } if (uCharset == FXFONT_DEFAULT_CHARSET || bMaybeSymbol) { if (nFind > nMax && bMatchedName) { @@ -399,7 +399,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const CFX_ByteStringC& bsFile, int32_t i args.pathname = (FT_String*)bsFile.GetCStr(); FXFT_Face face; if (FXFT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face)) { - return FALSE; + return false; } FXFT_Set_Pixel_Sizes(face, 0, 64); return face; @@ -418,7 +418,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const uint8_t* pBuffer, size_t szBuffer, args.memory_size = szBuffer; FXFT_Face face; if (FXFT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face)) { - return FALSE; + return false; } FXFT_Set_Pixel_Sizes(face, 0, 64); return face; @@ -430,7 +430,7 @@ void CFPF_SkiaFontMgr::ScanPath(const CFX_ByteStringC& path) return; } CFX_ByteString filename; - FX_BOOL bFolder = FALSE; + bool bFolder = false; while (FX_GetNextFile(handle, filename, bFolder)) { if (bFolder) { if (filename == FX_BSTRC(".") || filename == FX_BSTRC("..")) { diff --git a/core/src/fxge/android/fpf_skiafontmgr.h b/core/src/fxge/android/fpf_skiafontmgr.h index 8c721ff68a..b4ebe9454a 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.h +++ b/core/src/fxge/android/fpf_skiafontmgr.h @@ -94,7 +94,7 @@ class CFPF_SkiaFontMgr : public IFPF_FontMgr public: CFPF_SkiaFontMgr(); virtual ~CFPF_SkiaFontMgr(); - FX_BOOL InitFTLibrary(); + bool InitFTLibrary(); virtual void LoadSystemFonts(); virtual void LoadPrivateFont(IFX_FileRead* pFontFile); virtual void LoadPrivateFont(const CFX_ByteStringC& bsFileName); @@ -109,7 +109,7 @@ protected: void ScanFile(const CFX_ByteStringC& file); void ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor *pFontDesc); void OutputSystemFonts(); - FX_BOOL m_bLoaded; + bool m_bLoaded; CFX_PtrArray m_FontFaces; FXFT_Library m_FTLibrary; CFX_MapPtrToPtr m_FamilyFonts; diff --git a/core/src/fxge/android/fx_android_font.cpp b/core/src/fxge/android/fx_android_font.cpp index 3e2fc45854..4f2bc15b2a 100644 --- a/core/src/fxge/android/fx_android_font.cpp +++ b/core/src/fxge/android/fx_android_font.cpp @@ -10,20 +10,20 @@ CFX_AndroidFontInfo::CFX_AndroidFontInfo() : m_pFontMgr(NULL) { } -FX_BOOL CFX_AndroidFontInfo::Init(IFPF_FontMgr *pFontMgr) +bool CFX_AndroidFontInfo::Init(IFPF_FontMgr *pFontMgr) { if (!pFontMgr) { - return FALSE; + return false; } pFontMgr->LoadSystemFonts(); m_pFontMgr = pFontMgr; - return TRUE; + return true; } -FX_BOOL CFX_AndroidFontInfo::EnumFontList(CFX_FontMapper* pMapper) +bool CFX_AndroidFontInfo::EnumFontList(CFX_FontMapper* pMapper) { - return FALSE; + return false; } -void* CFX_AndroidFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact) +void* CFX_AndroidFontInfo::MapFont(int weight, bool bItalic, int charset, int pitch_family, const FX_CHAR* face, bool& bExact) { if (!m_pFontMgr) { return NULL; @@ -57,21 +57,21 @@ FX_DWORD CFX_AndroidFontInfo::GetFontData(void* hFont, FX_DWORD table, uint8_t* } return ((IFPF_Font*)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 = ((IFPF_Font*)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 = ((IFPF_Font*)hFont)->GetCharset(); - return FALSE; + return false; } void CFX_AndroidFontInfo::DeleteFont(void* hFont) { diff --git a/core/src/fxge/android/fx_android_font.h b/core/src/fxge/android/fx_android_font.h index 83c04a03a4..075b79e7f2 100644 --- a/core/src/fxge/android/fx_android_font.h +++ b/core/src/fxge/android/fx_android_font.h @@ -18,18 +18,18 @@ public: delete this; } - virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); + virtual bool EnumFontList(CFX_FontMapper* pMapper); - virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact); + virtual void* MapFont(int weight, bool bItalic, int charset, int pitch_family, const FX_CHAR* face, bool& bExact); virtual void* GetFont(const FX_CHAR* face); virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size); - virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); - virtual FX_BOOL GetFontCharset(void* hFont, int& charset); + virtual bool GetFaceName(void* hFont, CFX_ByteString& name); + virtual bool GetFontCharset(void* hFont, int& charset); virtual void DeleteFont(void* hFont); virtual void* RetainFont(void* hFont); - FX_BOOL Init(IFPF_FontMgr *pFontMgr); + bool Init(IFPF_FontMgr *pFontMgr); protected: IFPF_FontMgr *m_pFontMgr; }; diff --git a/core/src/fxge/apple/apple_int.h b/core/src/fxge/apple/apple_int.h index 715e48d6c2..0e6c9d683f 100644 --- a/core/src/fxge/apple/apple_int.h +++ b/core/src/fxge/apple/apple_int.h @@ -51,7 +51,7 @@ public: void* CreateFont(const uint8_t* pFontData, FX_DWORD dwFontSize); void DestroyFont(void* pFont); void setGraphicsTextMatrix(void* graphics, CFX_AffineMatrix* matrix); - FX_BOOL drawGraphicsString(void* graphics, + bool drawGraphicsString(void* graphics, void* font, FX_FLOAT fontSize, FX_WORD* glyphIndices, @@ -92,26 +92,26 @@ public: { return NULL; } - virtual FX_BOOL IsPSPrintDriver() + virtual bool IsPSPrintDriver() { - return FALSE; + return false; } - virtual FX_BOOL StartRendering() + virtual bool StartRendering() { - return TRUE; + return true; } virtual void EndRendering() {} virtual void SaveState(); - virtual void RestoreState(FX_BOOL bKeepSaved); - virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, + virtual void RestoreState(bool bKeepSaved); + virtual bool SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, int fill_mode ); - virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, + virtual bool SetClip_PathStroke(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState ); - virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, + virtual bool DrawPath(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState, FX_DWORD fill_color, @@ -121,36 +121,36 @@ public: void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL ); - virtual FX_BOOL SetPixel(int x, int y, FX_DWORD color, + virtual bool SetPixel(int x, int y, FX_DWORD color, int alpha_flag = 0, void* pIccTransform = NULL) { - return FALSE; + return false; } - virtual FX_BOOL FillRect(const FX_RECT* pRect, FX_DWORD fill_color, + virtual bool FillRect(const FX_RECT* pRect, FX_DWORD fill_color, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL); - virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, FX_DWORD color, + virtual bool DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, FX_DWORD color, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL); - virtual FX_BOOL GetClipBox(FX_RECT* pRect); - virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform = NULL, FX_BOOL bDEdge = FALSE); - virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, + virtual bool GetClipBox(FX_RECT* pRect); + virtual bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform = NULL, bool bDEdge = false); + virtual bool SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, int dest_left, int dest_top, int blend_type, int alpha_flag = 0, void* pIccTransform = NULL); - virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, + virtual bool StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL); - virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, + virtual bool StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, const CFX_AffineMatrix* pMatrix, FX_DWORD flags, void*& handle, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL) { - return FALSE; + return false; } - virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) + virtual bool ContinueDIBits(void* handle, IFX_Pause* pPause) { - return FALSE; + return false; } virtual void CancelDIBits(void* handle) {} - virtual FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, + virtual bool DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, int alpha_flag = 0, void* pIccTransform = NULL); virtual void ClearDriver(); @@ -159,7 +159,7 @@ protected: void setFillInfo(FX_ARGB argb); void setPathToContext(const CFX_PathData * pathData); FX_FLOAT getLineWidth(const CFX_GraphStateData * graphState, CGAffineTransform ctm); - FX_BOOL CG_DrawGlypRun(int nChars, + bool CG_DrawGlypRun(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, @@ -195,9 +195,9 @@ public: { return (FX_FILESIZE)_totalSize; } - virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; + virtual bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; - virtual FX_BOOL IsEOF() override + virtual bool IsEOF() override { return _offSet == _totalSize; } diff --git a/core/src/fxge/apple/fx_apple_platform.cpp b/core/src/fxge/apple/fx_apple_platform.cpp index 9db807c3af..9f4712bf7e 100644 --- a/core/src/fxge/apple/fx_apple_platform.cpp +++ b/core/src/fxge/apple/fx_apple_platform.cpp @@ -39,7 +39,7 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph_Nativetext(CFX_Font * pFont, { return NULL; } -static FX_BOOL _CGDrawGlyphRun(CGContextRef pContext, +static bool _CGDrawGlyphRun(CGContextRef pContext, int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, @@ -51,10 +51,10 @@ static FX_BOOL _CGDrawGlyphRun(CGContextRef pContext, void* pIccTransform) { if (nChars == 0) { - return TRUE; + return true; } CFX_AffineMatrix new_matrix; - FX_BOOL bNegSize = font_size < 0; + bool bNegSize = font_size < 0; if (bNegSize) { font_size = -font_size; } @@ -66,11 +66,11 @@ static FX_BOOL _CGDrawGlyphRun(CGContextRef pContext, CQuartz2D& quartz2d = ((CApplePlatform *) CFX_GEModule::Get()->GetPlatformData())->_quartz2d; if (!pFont->m_pPlatformFont) { if (pFont->GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) { - return FALSE; + return false; } pFont->m_pPlatformFont = quartz2d.CreateFont(pFont->m_pFontData, pFont->m_dwSize); if (NULL == pFont->m_pPlatformFont) { - return FALSE; + return false; } } CFX_FixedBufGrow<FX_WORD, 32> glyph_indices(nChars); @@ -101,7 +101,7 @@ static FX_BOOL _CGDrawGlyphRun(CGContextRef pContext, NULL); } static void _DoNothing(void *info, const void *data, size_t size) {} -FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars, +bool CFX_AggDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS * pCharPos, CFX_Font * pFont, CFX_FontCache * pCache, @@ -111,22 +111,22 @@ FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars, int alpha_flag, void* pIccTransform) { 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 (NULL == ctx) { - return FALSE; + return false; } CGContextSaveGState(ctx); CGContextSetTextDrawingMode(ctx, kCGTextFillClip); @@ -143,7 +143,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); + decode_f, false); CGDataProviderRelease(pClipMaskDataProvider); } } else { @@ -155,7 +155,7 @@ FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars, } else { CGContextClipToRect(ctx, rect_cg); } - FX_BOOL ret = _CGDrawGlyphRun(ctx, nChars, pCharPos, pFont, pCache, pObject2Device, font_size, argb, alpha_flag, pIccTransform); + bool ret = _CGDrawGlyphRun(ctx, nChars, pCharPos, pFont, pCache, pObject2Device, font_size, argb, alpha_flag, pIccTransform); if (pImageCG) { CGImageRelease(pImageCG); } diff --git a/core/src/fxge/apple/fx_mac_imp.cpp b/core/src/fxge/apple/fx_mac_imp.cpp index 04b04b8ba8..5e5908b8ff 100644 --- a/core/src/fxge/apple/fx_mac_imp.cpp +++ b/core/src/fxge/apple/fx_mac_imp.cpp @@ -28,7 +28,7 @@ Base14Substs[] = { class CFX_MacFontInfo : public CFX_FolderFontInfo { public: - virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL& bExact); + virtual void* MapFont(int weight, bool bItalic, int charset, int pitch_family, const FX_CHAR* family, bool& bExact); }; #define JAPAN_GOTHIC "Hiragino Kaku Gothic Pro W6" #define JAPAN_MINCHO "Hiragino Mincho Pro W6" @@ -44,14 +44,14 @@ static void GetJapanesePreference(CFX_ByteString& face, int weight, int picth_fa face = JAPAN_MINCHO; } } -void* CFX_MacFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, FX_BOOL& bExact) +void* CFX_MacFontInfo::MapFont(int weight, bool bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, bool& bExact) { CFX_ByteString face = cstr_face; int iBaseFont; for (iBaseFont = 0; iBaseFont < 12; iBaseFont ++) if (face == CFX_ByteStringC(Base14Substs[iBaseFont].m_pName)) { face = Base14Substs[iBaseFont].m_pSubstName; - bExact = TRUE; + bExact = true; break; } if (iBaseFont < 12) { diff --git a/core/src/fxge/apple/fx_quartz_device.cpp b/core/src/fxge/apple/fx_quartz_device.cpp index d1e4f544ba..8aa689fa91 100644 --- a/core/src/fxge/apple/fx_quartz_device.cpp +++ b/core/src/fxge/apple/fx_quartz_device.cpp @@ -76,7 +76,7 @@ void CQuartz2D::setGraphicsTextMatrix(void* graphics, CFX_AffineMatrix* matrix) matrix->e, ty)); } -FX_BOOL CQuartz2D::drawGraphicsString(void* graphics, +bool CQuartz2D::drawGraphicsString(void* graphics, void* font, FX_FLOAT fontSize, FX_WORD* glyphIndices, @@ -86,7 +86,7 @@ FX_BOOL CQuartz2D::drawGraphicsString(void* graphics, CFX_AffineMatrix* matrix ) { if (!graphics) { - return FALSE; + return false; } CGContextRef context = (CGContextRef) graphics; CGContextSetFont(context, (CGFontRef)font); @@ -113,7 +113,7 @@ FX_BOOL CQuartz2D::drawGraphicsString(void* graphics, #if CGFLOAT_IS_DOUBLE CGPoint* glyphPositionsCG = new CGPoint[charsCount]; if (!glyphPositionsCG) { - return FALSE; + return false; } for (int index = 0; index < charsCount; ++index) { glyphPositionsCG[index].x = glyphPositions[index].x; @@ -130,7 +130,7 @@ FX_BOOL CQuartz2D::drawGraphicsString(void* graphics, delete[] glyphPositionsCG; #endif CGContextRestoreGState(context); - return TRUE; + return true; } void CQuartz2D::saveGraphicsState(void * graphics) { @@ -251,7 +251,7 @@ void CFX_QuartzDeviceDriver::SaveState() CGContextSaveGState(_context); m_saveCount++; } -void CFX_QuartzDeviceDriver::RestoreState(FX_BOOL isKeepSaved ) +void CFX_QuartzDeviceDriver::RestoreState(bool isKeepSaved ) { CGContextRestoreGState(_context); if (isKeepSaved) { @@ -260,7 +260,7 @@ void CFX_QuartzDeviceDriver::RestoreState(FX_BOOL isKeepSaved ) m_saveCount--; } } -FX_BOOL CFX_QuartzDeviceDriver::SetClip_PathFill(const CFX_PathData* pathData, +bool CFX_QuartzDeviceDriver::SetClip_PathFill(const CFX_PathData* pathData, const CFX_AffineMatrix* matrix, int fillMode ) { @@ -272,13 +272,13 @@ FX_BOOL CFX_QuartzDeviceDriver::SetClip_PathFill(const CFX_PathData* pathData m = CGAffineTransformConcat(m, _foxitDevice2User); CGContextConcatCTM(_context, m); setPathToContext(pathData); - RestoreState(FALSE); + RestoreState(false); if ((fillMode & 3) == FXFILL_WINDING) { CGContextClip(_context); } else { CGContextEOClip(_context); } - return TRUE; + return true; } FX_FLOAT CFX_QuartzDeviceDriver::getLineWidth(const CFX_GraphStateData * graphState, CGAffineTransform ctm) { @@ -294,7 +294,7 @@ FX_FLOAT CFX_QuartzDeviceDriver::getLineWidth(const CFX_GraphStateData * graphSt } return lineWidth; } -FX_BOOL CFX_QuartzDeviceDriver::SetClip_PathStroke(const CFX_PathData* pathData, +bool CFX_QuartzDeviceDriver::SetClip_PathStroke(const CFX_PathData* pathData, const CFX_AffineMatrix* matrix, const CFX_GraphStateData* graphState ) { @@ -309,9 +309,9 @@ FX_BOOL CFX_QuartzDeviceDriver::SetClip_PathStroke(const CFX_PathData* path setStrokeInfo(graphState, 0xFF000000, lineWidth); setPathToContext(pathData); CGContextReplacePathWithStrokedPath(_context); - RestoreState(FALSE); + RestoreState(false); CGContextClip(_context); - return TRUE; + return true; } static CGBlendMode GetCGBlendMode(int blend_type) { @@ -371,7 +371,7 @@ static CGBlendMode GetCGBlendMode(int blend_type) } return mode; } -FX_BOOL CFX_QuartzDeviceDriver::DrawPath(const CFX_PathData* pathData, +bool CFX_QuartzDeviceDriver::DrawPath(const CFX_PathData* pathData, const CFX_AffineMatrix* matrix, const CFX_GraphStateData* graphState, FX_DWORD fillArgb, @@ -423,10 +423,10 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawPath(const CFX_PathData* pathData, } else if (pathMode == 6) { CGContextDrawPath(_context, kCGPathEOFillStroke); } - RestoreState(FALSE); - return TRUE; + RestoreState(false); + return true; } -FX_BOOL CFX_QuartzDeviceDriver::FillRect(const FX_RECT* rect, +bool CFX_QuartzDeviceDriver::FillRect(const FX_RECT* rect, FX_ARGB fillArgb, int alphaFlag , void* iccTransform , @@ -449,9 +449,9 @@ FX_BOOL CFX_QuartzDeviceDriver::FillRect(const FX_RECT* rect, if (mode != kCGBlendModeNormal) { CGContextSetBlendMode(_context, kCGBlendModeNormal); } - return TRUE; + return true; } -FX_BOOL CFX_QuartzDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, +bool CFX_QuartzDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, @@ -483,9 +483,9 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, if (mode != kCGBlendModeNormal) { CGContextSetBlendMode(_context, kCGBlendModeNormal); } - return TRUE; + return true; } -FX_BOOL CFX_QuartzDeviceDriver::GetClipBox(FX_RECT* rect) +bool CFX_QuartzDeviceDriver::GetClipBox(FX_RECT* rect) { CGRect r = CGContextGetClipBoundingBox(_context); r = CGRectApplyAffineTransform(r, _user2FoxitDevice); @@ -493,22 +493,22 @@ FX_BOOL CFX_QuartzDeviceDriver::GetClipBox(FX_RECT* rect) 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, +bool CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap* bitmap, int32_t left, int32_t top, void* pIccTransform, - FX_BOOL bDEdge) + bool bDEdge) { if (FXDC_PRINTER == _deviceClass) { - return FALSE; + return false; } if (bitmap->GetBPP() < 32) { - return FALSE; + return false; } if (!(_renderCaps | FXRC_GET_BITS)) { - return FALSE; + return false; } CGPoint pt = CGPointMake(left, top); pt = CGPointApplyAffineTransform(pt, _foxitDevice2User); @@ -517,7 +517,7 @@ FX_BOOL CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap* bitmap, pt.y *= FXSYS_fabs(ctm.d); CGImageRef image = CGBitmapContextCreateImage(_context); if (NULL == image) { - return FALSE; + return false; } CGFloat width = (CGFloat) bitmap->GetWidth(); CGFloat height = (CGFloat) bitmap->GetHeight(); @@ -552,9 +552,9 @@ FX_BOOL CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap* bitmap, } } } - return TRUE; + return true; } -FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, +bool CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, FX_ARGB argb, const FX_RECT* srcRect, int dest_left, @@ -598,8 +598,8 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, pBitmap1 = pBitmap->Clone(); } if (NULL == pBitmap1) { - RestoreState(FALSE); - return FALSE; + RestoreState(false); + return false; } CGDataProviderRef pBitmapProvider = CGDataProviderCreateWithData(NULL, pBitmap1->GetBuffer(), @@ -629,8 +629,8 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, if (pBitmap1 != pBitmap) { delete pBitmap1; } - RestoreState(FALSE); - return TRUE; + RestoreState(false); + return true; } if (pBitmap->GetBPP() < 32) { pBitmap1 = pBitmap->CloneConvert(FXDIB_Rgb32); @@ -642,15 +642,15 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, } } if (NULL == pBitmap1) { - RestoreState(FALSE); - return FALSE; + RestoreState(false); + return false; } if (pBitmap1->HasAlpha()) { if (pBitmap1 == pBitmap) { pBitmap1 = pBitmap->Clone(); if (!pBitmap1) { - RestoreState(FALSE); - return FALSE; + RestoreState(false); + return false; } } for (int row = 0; row < pBitmap1->GetHeight(); row ++) { @@ -682,10 +682,10 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, if (pBitmap1 != pBitmap) { delete pBitmap1; } - RestoreState(FALSE); - return TRUE; + RestoreState(false); + return true; } -FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap, +bool CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap, FX_ARGB argb, int dest_left, int dest_top, @@ -723,8 +723,8 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap, pBitmap1 = pBitmap->Clone(); } if (NULL == pBitmap1) { - RestoreState(FALSE); - return FALSE; + RestoreState(false); + return false; } CGDataProviderRef pBitmapProvider = CGDataProviderCreateWithData(NULL, pBitmap1->GetBuffer(), @@ -754,8 +754,8 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap, if (pBitmap1 != pBitmap) { delete pBitmap1; } - RestoreState(FALSE); - return TRUE; + RestoreState(false); + return true; } if (pBitmap->GetBPP() < 32) { pBitmap1 = pBitmap->CloneConvert(FXDIB_Rgb32); @@ -767,15 +767,15 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap, } } if (NULL == pBitmap1) { - RestoreState(FALSE); - return FALSE; + RestoreState(false); + return false; } if (pBitmap1->HasAlpha()) { if (pBitmap1 == pBitmap) { pBitmap1 = pBitmap->Clone(); if (!pBitmap1) { - RestoreState(FALSE); - return FALSE; + RestoreState(false); + return false; } } for (int row = 0; row < pBitmap1->GetHeight(); row ++) { @@ -796,10 +796,10 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap, if (pBitmap1 != pBitmap) { delete pBitmap1; } - RestoreState(FALSE); - return TRUE; + RestoreState(false); + return true; } -FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlypRun(int nChars, +bool CFX_QuartzDeviceDriver::CG_DrawGlypRun(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, @@ -811,16 +811,16 @@ FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlypRun(int nChars void* pIccTransform) { if (nChars == 0) { - return TRUE; + return true; } CQuartz2D& quartz2d = ((CApplePlatform *) CFX_GEModule::Get()->GetPlatformData())->_quartz2d; if (!pFont->m_pPlatformFont) { if (pFont->GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) { - return FALSE; + return false; } pFont->m_pPlatformFont = quartz2d.CreateFont(pFont->m_pFontData, pFont->m_dwSize); if (NULL == pFont->m_pPlatformFont) { - return FALSE; + return false; } } CFX_FixedBufGrow<FX_WORD, 32> glyph_indices(nChars); @@ -872,10 +872,10 @@ FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlypRun(int nChars (CGGlyph*)glyph_indices, glyph_positions, nChars); - RestoreState(FALSE); - return TRUE; + RestoreState(false); + return true; } -FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars, +bool CFX_QuartzDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, @@ -886,24 +886,24 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars, void* pIccTransform) { if (NULL == pFont || NULL == _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(_context, kCGTextFillClip); - FX_BOOL ret = FALSE; + bool ret = false; int32_t i = 0; while (i < nChars) { if (pCharPos[i].m_bGlyphAdjust || font_size < 0) { if (i > 0) { ret = CG_DrawGlypRun(i, pCharPos, pFont, pCache, NULL, pObject2Device, font_size, color, alpha_flag, pIccTransform); if (!ret) { - RestoreState(FALSE); + RestoreState(false); return ret; } } @@ -920,7 +920,7 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars, } ret = CG_DrawGlypRun(1, char_pos, pFont, pCache, &glphy_matrix, pObject2Device, font_size, color, alpha_flag, pIccTransform); if (!ret) { - RestoreState(FALSE); + RestoreState(false); return ret; } i ++; @@ -934,7 +934,7 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars, if (i > 0) { ret = CG_DrawGlypRun(i, pCharPos, pFont, pCache, NULL, pObject2Device, font_size, color, alpha_flag, pIccTransform); } - RestoreState(FALSE); + RestoreState(false); return ret; } void CFX_QuartzDeviceDriver::setStrokeInfo(const CFX_GraphStateData* graphState, FX_ARGB argb, FX_FLOAT lineWidth) @@ -1074,7 +1074,7 @@ void CFX_QuartzDeviceDriver::ClearDriver() } CFX_QuartzDevice::CFX_QuartzDevice() { - m_bOwnedBitmap = FALSE; + m_bOwnedBitmap = false; m_pContext = NULL; } CFX_QuartzDevice::~CFX_QuartzDevice() @@ -1090,7 +1090,7 @@ 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); @@ -1099,30 +1099,30 @@ FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, int32_t nDeviceClass) CGContextRetain(m_pContext); IFX_RenderDeviceDriver* pDriver = new CFX_QuartzDeviceDriver(m_pContext, nDeviceClass); SetDeviceDriver(pDriver); - 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 (NULL == m_pContext) { - return FALSE; + return false; } IFX_RenderDeviceDriver* pDriver = new CFX_QuartzDeviceDriver(m_pContext, FXDC_DISPLAY); SetDeviceDriver(pDriver); - 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; } CFX_DIBitmap* pBitmap = new CFX_DIBitmap; if (!pBitmap->Create(width, height, format)) { delete pBitmap; - return FALSE; + return false; } - m_bOwnedBitmap = TRUE; + m_bOwnedBitmap = true; return Attach(pBitmap); } #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ diff --git a/core/src/fxge/dib/dib_int.h b/core/src/fxge/dib/dib_int.h index 825cabe1d1..a6834fd641 100644 --- a/core/src/fxge/dib/dib_int.h +++ b/core/src/fxge/dib/dib_int.h @@ -63,7 +63,7 @@ public: int dest_width, int dest_height, const FX_RECT& clip_rect, const CFX_DIBSource* pSrcBitmap, int flags); ~CStretchEngine(); - FX_BOOL Continue(IFX_Pause* pPause); + bool Continue(IFX_Pause* pPause); public: FXDIB_Format m_DestFormat; int m_DestBpp, m_SrcBpp, m_bHasAlpha; @@ -84,8 +84,8 @@ public: int m_Flags; CWeightTable m_WeightTable; int m_CurRow; - FX_BOOL StartStretchHorz(); - FX_BOOL ContinueStretchHorz(IFX_Pause* pPause); + bool StartStretchHorz(); + bool ContinueStretchHorz(IFX_Pause* pPause); void StretchVert(); int m_State; }; diff --git a/core/src/fxge/dib/fx_dib_composite.cpp b/core/src/fxge/dib/fx_dib_composite.cpp index cb99a37ff4..9f454cc31d 100644 --- a/core/src/fxge/dib/fx_dib_composite.cpp +++ b/core/src/fxge/dib/fx_dib_composite.cpp @@ -272,7 +272,7 @@ void _CompositeRow_Argb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int p pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); } if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; if (src_alpha_scan) { for (int col = 0; col < pixel_count; col ++) { @@ -467,7 +467,7 @@ inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan, const uint8_t* src_scan, pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); } if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; if (src_alpha_scan) { for (int col = 0; col < pixel_count; col ++) { @@ -558,7 +558,7 @@ inline void _CompositeRow_Rgb2Gray(uint8_t* dest_scan, const uint8_t* src_scan, pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); } if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { if (pIccTransform) { @@ -605,7 +605,7 @@ void _CompositeRow_Rgb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int sr } if (blend_type) { int blended_color; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col ++) { int back_alpha = *dest_alpha_scan; if (back_alpha == 0) { @@ -689,7 +689,7 @@ void _CompositeRow_Argb2Argb(uint8_t* dest_scan, const uint8_t* src_scan, int pi uint8_t* dest_alpha_scan, const uint8_t* src_alpha_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; if (dest_alpha_scan == NULL) { if (src_alpha_scan == NULL) { uint8_t back_alpha = 0; @@ -896,7 +896,7 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan, const uint8_t* src_ uint8_t* dest_alpha_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int src_gap = src_Bpp - 3; if (dest_alpha_scan == NULL) { for (int col = 0; col < width; col ++) { @@ -957,7 +957,7 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip(uint8_t* dest_scan, const uint8_t* uint8_t* dest_alpha_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int src_gap = src_Bpp - 3; if (dest_alpha_scan == NULL) { for (int col = 0; col < width; col ++) { @@ -1121,7 +1121,7 @@ inline void _CompositeRow_Argb2Rgb_Blend(uint8_t* dest_scan, const uint8_t* src_ const uint8_t* src_alpha_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int dest_gap = dest_Bpp - 3; if (src_alpha_scan == NULL) { for (int col = 0; col < width; col ++) { @@ -1243,7 +1243,7 @@ inline void _CompositeRow_Argb2Rgb_NoBlend(uint8_t* dest_scan, const uint8_t* sr inline void _CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int dest_gap = dest_Bpp - 3; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { @@ -1266,7 +1266,7 @@ inline void _CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan, const uint8_t inline void _CompositeRow_Rgb2Rgb_Blend_Clip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, const uint8_t* clip_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int dest_gap = dest_Bpp - 3; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { @@ -1357,7 +1357,7 @@ void _CompositeRow_Argb2Argb_Transform(uint8_t* dest_scan, const uint8_t* src_sc } } else { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col ++) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); uint8_t back_alpha = *dest_alpha_scan; @@ -1487,7 +1487,7 @@ inline void _CompositeRow_Argb2Rgb_Blend_Transform(uint8_t* dest_scan, const uin pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int dest_gap = dest_Bpp - 3; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); @@ -1630,7 +1630,7 @@ inline void _CompositeRow_8bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_sc { if (src_alpha_scan) { if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { uint8_t gray = pPalette[*src_scan]; @@ -1668,7 +1668,7 @@ inline void _CompositeRow_8bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_sc } } else { if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { uint8_t gray = pPalette[*src_scan]; @@ -1704,7 +1704,7 @@ inline void _CompositeRow_8bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_s { if (src_alpha_scan) { if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { uint8_t gray = pPalette[*src_scan]; @@ -1778,7 +1778,7 @@ inline void _CompositeRow_8bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_s } } else { if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { uint8_t gray = pPalette[*src_scan]; @@ -1836,7 +1836,7 @@ inline void _CompositeRow_1bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_sc int reset_gray = pPalette[0]; int set_gray = pPalette[1]; if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; @@ -1870,7 +1870,7 @@ inline void _CompositeRow_1bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_s int reset_gray = pPalette[0]; int set_gray = pPalette[1]; if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; @@ -2787,7 +2787,7 @@ void _CompositeRow_BitMask2Graya(uint8_t* dest_scan, const uint8_t* src_scan, in void _CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int pixel_count, int blend_type, const uint8_t* clip_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col ++) { uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { @@ -2844,7 +2844,7 @@ void _CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int src_Bpp) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { uint8_t back_alpha = dest_scan[3]; @@ -2881,7 +2881,7 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, const inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, const uint8_t* clip_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < width; col ++) { uint8_t src_alpha; if (clip_scan) { @@ -2928,7 +2928,7 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_sca inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { if (bNonseparableBlend) { @@ -2995,7 +2995,7 @@ inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_scan inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int src_Bpp, const uint8_t* clip_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { int src_alpha = *clip_scan ++; @@ -3039,7 +3039,7 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, c inline void _CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, const uint8_t* clip_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { uint8_t src_alpha = *clip_scan ++; @@ -3495,7 +3495,7 @@ void _CompositeRow_BitMask2Rgb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* s dest_scan += Bpp; } } -inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int alpha_flag, FX_DWORD mask_color, int& mask_alpha, +inline bool _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int alpha_flag, FX_DWORD mask_color, int& mask_alpha, int& mask_red, int& mask_green, int& mask_blue, int& mask_black, void* icc_module, void* pIccTransform) { @@ -3513,7 +3513,7 @@ inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int mask_blue = FXARGB_B(mask_color); } if (dest_format == FXDIB_8bppMask) { - return TRUE; + return true; } if ((dest_format & 0xff) == 8) { if (pIccTransform) { @@ -3550,15 +3550,15 @@ inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int mask_blue = mask_color_p[0]; } } - return TRUE; + return true; } inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB_Format dest_format, FX_DWORD*& pDestPalette, FX_DWORD* pSrcPalette, void* icc_module, void* pIccTransform) { ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module; - FX_BOOL isSrcCmyk = src_format & 0x0400 ? TRUE : FALSE; - FX_BOOL isDstCmyk = dest_format & 0x0400 ? TRUE : FALSE; + bool isSrcCmyk = src_format & 0x0400 ? true : false; + bool isDstCmyk = dest_format & 0x0400 ? true : false; pDestPalette = NULL; if (pIccTransform) { if (pSrcPalette) { @@ -3679,7 +3679,7 @@ CFX_ScanlineCompositor::CFX_ScanlineCompositor() m_pSrcPalette = NULL; m_pCacheScanline = NULL; m_CacheSize = 0; - m_bRgbByteOrder = FALSE; + m_bRgbByteOrder = false; m_BlendType = FXDIB_BLEND_NORMAL; } CFX_ScanlineCompositor::~CFX_ScanlineCompositor() @@ -3691,8 +3691,8 @@ CFX_ScanlineCompositor::~CFX_ScanlineCompositor() FX_Free(m_pCacheScanline); } } -FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_format, int32_t width, FX_DWORD* pSrcPalette, - FX_DWORD mask_color, int blend_type, FX_BOOL bClip, FX_BOOL bRgbByteOrder, int alpha_flag, void* pIccTransform) +bool CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_format, int32_t width, FX_DWORD* pSrcPalette, + FX_DWORD mask_color, int blend_type, bool bClip, bool bRgbByteOrder, int alpha_flag, void* pIccTransform) { m_SrcFormat = src_format; m_DestFormat = dest_format; @@ -3707,7 +3707,7 @@ FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_ } m_pIccTransform = pIccTransform; if ((dest_format & 0xff) == 1) { - return FALSE; + return false; } if (m_SrcFormat == FXDIB_1bppMask || m_SrcFormat == FXDIB_8bppMask) { return _ScanlineCompositor_InitSourceMask(dest_format, alpha_flag, mask_color, @@ -3715,11 +3715,11 @@ FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_ pIccModule, pIccTransform); } if (pIccTransform == NULL && (~src_format & 0x0400) && (dest_format & 0x0400)) { - return FALSE; + return false; } if ((m_SrcFormat & 0xff) <= 8) { if (dest_format == FXDIB_8bppMask) { - return TRUE; + return true; } _ScanlineCompositor_InitSourcePalette(src_format, dest_format, m_pSrcPalette, pSrcPalette, pIccModule, pIccTransform); @@ -3727,7 +3727,7 @@ FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_ + (dest_format & 0x0200 ? 2 : 0) + (dest_format & 0x0400 ? 4 : 0) + ((src_format & 0xff) == 1 ? 8 : 0); - return TRUE; + return true; } m_Transparency = (src_format & 0x0200 ? 0 : 1) + (dest_format & 0x0200 ? 0 : 2) @@ -3736,7 +3736,7 @@ FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_ + (src_format & 0x0400 ? 16 : 0) + (dest_format & 0x0400 ? 32 : 0) + (pIccTransform ? 64 : 0); - return TRUE; + return true; } void CFX_ScanlineCompositor::CompositeRgbBitmapLine(uint8_t* dest_scan, const uint8_t* src_scan, int width, const uint8_t* clip_scan, const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) @@ -4059,22 +4059,22 @@ void CFX_ScanlineCompositor::CompositeBitMaskLine(uint8_t* dest_scan, const uint _CompositeRow_BitMask2Rgb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan); } -FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, int dest_top, int width, int height, +bool CFX_DIBitmap::CompositeBitmap(int dest_left, int dest_top, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, - int blend_type, const CFX_ClipRgn* pClipRgn, FX_BOOL bRgbByteOrder, void* pIccTransform) + int blend_type, const CFX_ClipRgn* pClipRgn, bool bRgbByteOrder, void* pIccTransform) { if (m_pBuffer == NULL) { - return FALSE; + return false; } ASSERT(!pSrcBitmap->IsAlphaMask()); ASSERT(m_bpp >= 8); if (pSrcBitmap->IsAlphaMask() || m_bpp < 8) { - return FALSE; + return false; } GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(), pSrcBitmap->GetHeight(), src_left, src_top, pClipRgn); if (width == 0 || height == 0) { - return TRUE; + return true; } const CFX_DIBitmap* pClipMask = NULL; FX_RECT clip_box; @@ -4086,11 +4086,11 @@ FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, int dest_top, int width, in CFX_ScanlineCompositor compositor; if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width, pSrcBitmap->GetPalette(), 0, blend_type, pClipMask != NULL, bRgbByteOrder, 0, pIccTransform)) { - return FALSE; + return false; } int dest_Bpp = m_bpp / 8; int src_Bpp = pSrcBitmap->GetBPP() / 8; - FX_BOOL bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); + bool bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; for (int row = 0; row < height; row ++) { uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * dest_Bpp; @@ -4107,27 +4107,27 @@ FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, int dest_top, int width, in compositor.CompositePalBitmapLine(dest_scan, src_scan, src_left, width, clip_scan, src_scan_extra_alpha, dst_scan_extra_alpha); } } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int height, +bool CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int height, const CFX_DIBSource* pMask, FX_DWORD color, int src_left, int src_top, - int blend_type, const CFX_ClipRgn* pClipRgn, FX_BOOL bRgbByteOrder, int alpha_flag, void* pIccTransform) + int blend_type, const CFX_ClipRgn* pClipRgn, bool bRgbByteOrder, int alpha_flag, void* pIccTransform) { if (m_pBuffer == NULL) { - return FALSE; + return false; } ASSERT(pMask->IsAlphaMask()); ASSERT(m_bpp >= 8); if (!pMask->IsAlphaMask() || m_bpp < 8) { - return FALSE; + return false; } GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(), pMask->GetHeight(), src_left, src_top, pClipRgn); if (width == 0 || height == 0) { - return TRUE; + return true; } int src_alpha = (uint8_t)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); if (src_alpha == 0) { - return TRUE; + return true; } const CFX_DIBitmap* pClipMask = NULL; FX_RECT clip_box; @@ -4140,7 +4140,7 @@ FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int int Bpp = GetBPP() / 8; CFX_ScanlineCompositor compositor; if (!compositor.Init(GetFormat(), pMask->GetFormat(), width, NULL, color, blend_type, pClipMask != NULL, bRgbByteOrder, alpha_flag, pIccTransform)) { - return FALSE; + return false; } for (int row = 0; row < height; row ++) { uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp; @@ -4156,21 +4156,21 @@ FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int compositor.CompositeByteMaskLine(dest_scan, src_scan + src_left, width, clip_scan, dst_scan_extra_alpha); } } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX_DWORD color, int alpha_flag, void* pIccTransform) +bool CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX_DWORD color, int alpha_flag, void* pIccTransform) { if (m_pBuffer == NULL) { - return FALSE; + return false; } int src_alpha = (alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); if (src_alpha == 0) { - return TRUE; + return true; } FX_RECT rect(left, top, left + width, top + height); rect.Intersect(0, 0, m_Width, m_Height); if (rect.IsEmpty()) { - return TRUE; + return true; } width = rect.Width(); FX_DWORD dst_color; @@ -4210,7 +4210,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX dest_scan ++; } } - return TRUE; + return true; } if (m_bpp == 1) { ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); @@ -4248,11 +4248,11 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } } } - return TRUE; + return true; } ASSERT(m_bpp >= 24); if (m_bpp < 24) { - return FALSE; + return false; } if (pIccTransform && CFX_GEModule::Get()->GetCodecModule()) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); @@ -4262,15 +4262,15 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color), color_p[2], color_p[1], color_p[0]); else if (!(alpha_flag >> 8) && IsCmykImage()) { - return FALSE; + return false; } } if(!IsCmykImage()) { color_p[3] = (uint8_t)src_alpha; } int Bpp = m_bpp / 8; - FX_BOOL bAlpha = HasAlpha(); - FX_BOOL bArgb = GetFormat() == FXDIB_Argb ? TRUE : FALSE; + bool bAlpha = HasAlpha(); + bool bArgb = GetFormat() == FXDIB_Argb ? true : false; if (src_alpha == 255) { for (int row = rect.top; row < rect.bottom; row ++) { uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; @@ -4291,7 +4291,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } } } - return TRUE; + return true; } for (int row = rect.top; row < rect.bottom; row ++) { uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; @@ -4346,7 +4346,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } } } - return TRUE; + return true; } CFX_BitmapComposer::CFX_BitmapComposer() { @@ -4354,7 +4354,7 @@ CFX_BitmapComposer::CFX_BitmapComposer() m_pScanlineAlphaV = NULL; m_pClipScanV = NULL; m_pAddClipScan = NULL; - m_bRgbByteOrder = FALSE; + m_bRgbByteOrder = false; m_BlendType = FXDIB_BLEND_NORMAL; } CFX_BitmapComposer::~CFX_BitmapComposer() @@ -4373,8 +4373,8 @@ CFX_BitmapComposer::~CFX_BitmapComposer() } } void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest, const CFX_ClipRgn* pClipRgn, int bitmap_alpha, - FX_DWORD mask_color, FX_RECT& dest_rect, FX_BOOL bVertical, - FX_BOOL bFlipX, FX_BOOL bFlipY, FX_BOOL bRgbByteOrder, + FX_DWORD mask_color, FX_RECT& dest_rect, bool bVertical, + bool bFlipX, bool bFlipY, bool bRgbByteOrder, int alpha_flag, void* pIccTransform, int blend_type) { m_pBitmap = pDest; @@ -4397,12 +4397,12 @@ void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest, const CFX_ClipRgn* pClipRg m_bRgbByteOrder = bRgbByteOrder; m_BlendType = blend_type; } -FX_BOOL CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_format, FX_DWORD* pSrcPalette) +bool CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_format, FX_DWORD* pSrcPalette) { m_SrcFormat = src_format; if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalette, m_MaskColor, FXDIB_BLEND_NORMAL, m_pClipMask != NULL || (m_BitmapAlpha < 255), m_bRgbByteOrder, m_AlphaFlag, m_pIccTransform)) { - return FALSE; + return false; } if (m_bVertical) { m_pScanlineV = FX_Alloc(uint8_t, m_pBitmap->GetBPP() / 8 * width + 4); @@ -4414,7 +4414,7 @@ FX_BOOL CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_form if (m_BitmapAlpha < 255) { m_pAddClipScan = FX_Alloc(uint8_t, m_bVertical ? m_pBitmap->GetHeight() : m_pBitmap->GetWidth()); } - return TRUE; + return true; } void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan, const uint8_t* src_scan, int dest_width, const uint8_t* clip_scan, const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp index d7860aee19..7e5a0341a2 100644 --- a/core/src/fxge/dib/fx_dib_convert.cpp +++ b/core/src/fxge/dib/fx_dib_convert.cpp @@ -103,7 +103,7 @@ public: CFX_Palette(); ~CFX_Palette(); public: - FX_BOOL BuildPalette(const CFX_DIBSource* pBitmap, int dwPaletteType); + bool BuildPalette(const CFX_DIBSource* pBitmap, int dwPaletteType); FX_DWORD* GetPalette() const { return m_pPalette; @@ -227,10 +227,10 @@ CFX_Palette::~CFX_Palette() } m_lut = 0; } -FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) +bool CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) { if (pBitmap == NULL) { - return FALSE; + return false; } if (m_pPalette != NULL) { FX_Free(m_pPalette); @@ -277,9 +277,9 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) win_mac_pal = (FX_DWORD*)g_dwMacPalette; } _Obtain_Pal(m_aLut, m_cLut, m_pPalette, pal_type, win_mac_pal, m_lut); - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { uint8_t set_gray, reset_gray; @@ -296,9 +296,9 @@ FX_BOOL _ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int widt dest_scan ++; } } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { for (int row = 0; row < height; row ++) { @@ -306,9 +306,9 @@ FX_BOOL _ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int widt const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; FXSYS_memcpy(dest_scan, src_scan, width); } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { FX_DWORD* src_plt = pSrcBitmap->GetPalette(); @@ -359,9 +359,9 @@ FX_BOOL _ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width dest_scan ++; } } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { FX_DWORD* src_plt = pSrcBitmap->GetPalette(); @@ -402,9 +402,9 @@ FX_BOOL _ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width *dest_scan++ = gray[*src_scan++]; } } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { int Bpp = pSrcBitmap->GetBPP() / 8; @@ -451,7 +451,7 @@ FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf, int dest_pitch, int wid } } } - return TRUE; + return true; } inline void _ConvertBuffer_IndexCopy(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) @@ -476,7 +476,7 @@ inline void _ConvertBuffer_IndexCopy(uint8_t* dest_buf, int dest_pitch, int widt } } } -FX_BOOL _ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD* dst_plt, void* pIccTransform) { _ConvertBuffer_IndexCopy(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top); @@ -515,9 +515,9 @@ FX_BOOL _ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, FXSYS_memcpy(dst_plt, src_plt, plt_size * 4); } } - return TRUE; + return true; } -inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf, int dest_pitch, int width, int height, +inline bool _ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD* dst_plt) { int bpp = pSrcBitmap->GetBPP() / 8; @@ -527,7 +527,7 @@ inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf, int des FX_DWORD* cLut = palette.GetColorLut(); FX_DWORD* aLut = palette.GetAmountLut(); if (cLut == NULL || aLut == NULL) { - return FALSE; + return false; } int lut = palette.Getlut(); FX_DWORD* pPalette = palette.GetPalette(); @@ -571,12 +571,12 @@ inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf, int des } } FXSYS_memcpy(dst_plt, pPalette, sizeof(FX_DWORD) * 256); - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD* dst_plt, void* pIccTransform) { - FX_BOOL ret = _ConvertBuffer_Rgb2PltRgb8_NoTransform(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, dst_plt); + bool ret = _ConvertBuffer_Rgb2PltRgb8_NoTransform(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, dst_plt); if (ret && pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); for (int i = 0; i < 256; i++) { @@ -588,7 +588,7 @@ FX_BOOL _ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, } return ret; } -FX_BOOL _ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { int comps = (dst_format & 0xff) / 8; @@ -611,9 +611,9 @@ FX_BOOL _ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, dest_scan += comps; } } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { int comps = (dst_format & 0xff) / 8; @@ -629,9 +629,9 @@ FX_BOOL _ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, dest_scan += comps - 2; } } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { int comps = (dst_format & 0xff) / 8; @@ -676,9 +676,9 @@ FX_BOOL _ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, i dest_scan += comps - 2; } } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { int comps = (dst_format & 0xff) / 8; @@ -722,9 +722,9 @@ FX_BOOL _ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, i dest_scan += comps - 2; } } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { if (pIccTransform) { @@ -741,9 +741,9 @@ FX_BOOL _ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int wid FXSYS_memcpy(dest_scan, src_scan, width * 3); } } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { for (int row = 0; row < height; row ++) { @@ -763,9 +763,9 @@ FX_BOOL _ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int wid pIccModule->TranslateScanline(pIccTransform, dest_scan, dest_scan, width); } } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { int comps = pSrcBitmap->GetBPP() / 8; @@ -793,9 +793,9 @@ FX_BOOL _ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, i } } } - return TRUE; + return true; } -FX_BOOL _ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, +bool _ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { if (pIccTransform) { @@ -821,9 +821,9 @@ FX_BOOL _ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf, int dest_pitch, int wi } } } - return TRUE; + return true; } -FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitch, int width, int height, +bool ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD*& d_pal, void* pIccTransform) { FXDIB_Format src_format = pSrcBitmap->GetFormat(); @@ -835,8 +835,8 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitc case FXDIB_1bppCmyk: case FXDIB_1bppMask: case FXDIB_1bppRgb: - ASSERT(FALSE); - return FALSE; + ASSERT(false); + return false; case FXDIB_8bppMask: { if ((src_format & 0xff) == 1) { if (pSrcBitmap->GetPalette()) { @@ -853,7 +853,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitc if ((src_format & 0xff) >= 24) { return _ConvertBuffer_RgbOrCmyk2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); } - return FALSE; + return false; } case FXDIB_8bppRgb: case FXDIB_8bppRgba: { @@ -867,7 +867,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitc if ((src_format & 0xff) >= 24) { return _ConvertBuffer_Rgb2PltRgb8(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform); } - return FALSE; + return false; } case FXDIB_Rgb: case FXDIB_Rgba: { @@ -889,7 +889,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitc if ((src_format & 0xff) == 32) { return _ConvertBuffer_32bppRgb2Rgb24(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); } - return FALSE; + return false; } case FXDIB_Argb: case FXDIB_Rgb32: { @@ -911,12 +911,12 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitc } return _ConvertBuffer_Rgb2Rgb32(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); } - return FALSE; + return false; } default: - return FALSE; + return false; } - return FALSE; + return false; } CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format, const FX_RECT* pClip, void* pIccTransform) const { @@ -939,7 +939,7 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format, const FX_REC delete pClone; return NULL; } - FX_BOOL ret = TRUE; + bool ret = true; CFX_DIBitmap* pSrcAlpha = NULL; if (m_AlphaFlag & 2) { pSrcAlpha = (GetFormat() == FXDIB_Argb) ? GetAlphaMask() : m_pAlphaMask; @@ -981,15 +981,15 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format, const FX_REC } return pClone; } -FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransform) +bool CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransform) { FXDIB_Format src_format = GetFormat(); if (dest_format == src_format && pIccTransform == NULL) { - return TRUE; + return true; } if (dest_format == FXDIB_8bppMask && src_format == FXDIB_8bppRgb && m_pPalette == NULL) { m_AlphaFlag = 1; - return TRUE; + return true; } if (dest_format == FXDIB_Argb && src_format == FXDIB_Rgb32 && pIccTransform == NULL) { m_AlphaFlag = 2; @@ -1000,13 +1000,13 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor scanline += 4; } } - return TRUE; + return true; } int dest_bpp = dest_format & 0xff; int dest_pitch = (dest_bpp * m_Width + 31) / 32 * 4; uint8_t* dest_buf = FX_TryAlloc(uint8_t, dest_pitch * m_Height + 4); if (dest_buf == NULL) { - return FALSE; + return false; } CFX_DIBitmap* pAlphaMask = NULL; if (dest_format == FXDIB_Argb) { @@ -1026,13 +1026,13 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor pAlphaMask = GetAlphaMask(); if (pAlphaMask == NULL) { FX_Free(dest_buf); - return FALSE; + return false; } } else { if (m_pAlphaMask == NULL) { if (!BuildAlphaMask()) { FX_Free(dest_buf); - return FALSE; + return false; } pAlphaMask = m_pAlphaMask; m_pAlphaMask = NULL; @@ -1041,7 +1041,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor } } } - FX_BOOL ret = FALSE; + bool ret = false; FX_DWORD* pal_8bpp = NULL; ret = ConvertBuffer(dest_format, dest_buf, dest_pitch, m_Width, m_Height, this, 0, 0, pal_8bpp, pIccTransform); if (!ret) { @@ -1054,7 +1054,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor if (dest_buf) { FX_Free(dest_buf); } - return FALSE; + return false; } if (m_pAlphaMask && pAlphaMask != m_pAlphaMask) { delete m_pAlphaMask; @@ -1067,10 +1067,10 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor if (!m_bExtBuf) { FX_Free(m_pBuffer); } - m_bExtBuf = FALSE; + m_bExtBuf = false; m_pBuffer = dest_buf; m_bpp = (uint8_t)dest_format; m_AlphaFlag = (uint8_t)(dest_format >> 8); m_Pitch = dest_pitch; - return TRUE; + return true; } diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp index 7390c431d9..f143ac3ae2 100644 --- a/core/src/fxge/dib/fx_dib_engine.cpp +++ b/core/src/fxge/dib/fx_dib_engine.cpp @@ -217,7 +217,7 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, FXDIB_Format d m_SrcHeight = pSrcBitmap->GetHeight(); m_SrcPitch = (m_SrcWidth * m_SrcBpp + 31) / 32 * 4; if ((flags & FXDIB_NOSMOOTH) == 0) { - FX_BOOL bInterpol = flags & FXDIB_INTERPOL || flags & FXDIB_BICUBIC_INTERPOL; + bool bInterpol = flags & FXDIB_INTERPOL || flags & FXDIB_BICUBIC_INTERPOL; if (!bInterpol && FXSYS_abs(dest_width) != 0 && FXSYS_abs(dest_height) < m_SrcWidth * m_SrcHeight * 8 / FXSYS_abs(dest_width)) { flags = FXDIB_INTERPOL; } @@ -280,16 +280,16 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, FXDIB_Format d } } } -FX_BOOL CStretchEngine::Continue(IFX_Pause* pPause) +bool CStretchEngine::Continue(IFX_Pause* pPause) { while (m_State == 1) { if (ContinueStretchHorz(pPause)) { - return TRUE; + return true; } m_State = 2; StretchVert(); } - return FALSE; + return false; } CStretchEngine::~CStretchEngine() { @@ -306,46 +306,46 @@ CStretchEngine::~CStretchEngine() FX_Free(m_pDestMaskScanline); } } -FX_BOOL CStretchEngine::StartStretchHorz() +bool CStretchEngine::StartStretchHorz() { if (m_DestWidth == 0 || m_pDestScanline == NULL || m_SrcClip.Height() > (int)((1U << 29) / m_InterPitch) || m_SrcClip.Height() == 0) { - return FALSE; + return false; } m_pInterBuf = FX_TryAlloc(unsigned char, m_SrcClip.Height() * m_InterPitch); if (m_pInterBuf == NULL) { - return FALSE; + return false; } if (m_pSource && m_bHasAlpha && m_pSource->m_pAlphaMask) { m_pExtraAlphaBuf = FX_Alloc2D(unsigned char, m_SrcClip.Height(), m_ExtraMaskPitch); FX_DWORD size = (m_DestClip.Width() * 8 + 31) / 32 * 4; m_pDestMaskScanline = FX_TryAlloc(unsigned char, size); if (!m_pDestMaskScanline) { - return FALSE; + return false; } } m_WeightTable.Calc(m_DestWidth, m_DestClip.left, m_DestClip.right, m_SrcWidth, m_SrcClip.left, m_SrcClip.right, m_Flags); if (m_WeightTable.m_pWeightTables == NULL) { - return FALSE; + return false; } m_CurRow = m_SrcClip.top; m_State = 1; - return TRUE; + return true; } #define FX_STRECH_PAUSE_ROWS 10 -FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) +bool CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) { if (!m_DestWidth) { return 0; } if (m_pSource->SkipToScanline(m_CurRow, pPause)) { - return TRUE; + return true; } int Bpp = m_DestBpp / 8; int rows_to_go = FX_STRECH_PAUSE_ROWS; for (; m_CurRow < m_SrcClip.bottom; m_CurRow ++) { if (rows_to_go == 0) { if (pPause && pPause->NeedToPauseNow()) { - return TRUE; + return true; } rows_to_go = FX_STRECH_PAUSE_ROWS; } @@ -532,7 +532,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) } rows_to_go --; } - return FALSE; + return false; } void CStretchEngine::StretchVert() { @@ -697,7 +697,7 @@ FXDIB_Format _GetStretchedFormat(const CFX_DIBSource* pSrc) } return format; } -FX_BOOL CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest, +bool CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest, const CFX_DIBSource* pSource, int dest_width, int dest_height, const FX_RECT& rect, FX_DWORD flags) { @@ -722,7 +722,7 @@ FX_BOOL CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest, pal[i] = ArgbEncode(a, r, g, b); } if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, pal)) { - return FALSE; + return false; } } else if (pSource->GetFormat() == FXDIB_1bppCmyk && pSource->GetPalette()) { FX_CMYK pal[256]; @@ -737,17 +737,17 @@ FX_BOOL CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest, pal[i] = CmykEncode(c, m, y, k); } if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, pal)) { - return FALSE; + return false; } } else if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, NULL)) { - return FALSE; + return false; } if (flags & FXDIB_DOWNSAMPLE) { return StartQuickStretch(); } return StartStretch(); } -FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause) +bool CFX_ImageStretcher::Continue(IFX_Pause* pPause) { if (m_Flags & FXDIB_DOWNSAMPLE) { return ContinueQuickStretch(pPause); @@ -755,39 +755,39 @@ FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause) return ContinueStretch(pPause); } #define MAX_PROGRESSIVE_STRETCH_PIXELS 1000000 -FX_BOOL CFX_ImageStretcher::StartStretch() +bool CFX_ImageStretcher::StartStretch() { m_pStretchEngine = new CStretchEngine(m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, m_ClipRect, m_pSource, m_Flags); m_pStretchEngine->StartStretchHorz(); if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH_PIXELS) { m_pStretchEngine->Continue(NULL); - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) +bool CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) { if (m_pStretchEngine == NULL) { - return FALSE; + return false; } return m_pStretchEngine->Continue(pPause); } -FX_BOOL CFX_ImageStretcher::StartQuickStretch() +bool CFX_ImageStretcher::StartQuickStretch() { - m_bFlipX = FALSE; - m_bFlipY = FALSE; + m_bFlipX = false; + m_bFlipY = false; if (m_DestWidth < 0) { - m_bFlipX = TRUE; + m_bFlipX = true; m_DestWidth = -m_DestWidth; } if (m_DestHeight < 0) { - m_bFlipY = TRUE; + m_bFlipY = true; m_DestHeight = -m_DestHeight; } m_LineIndex = 0; FX_DWORD size = m_ClipRect.Width(); if (size && m_DestBPP > (int)(INT_MAX / size)) { - return FALSE; + return false; } size *= m_DestBPP; m_pScanline = FX_Alloc(uint8_t, (size / 8 + 3) / 4 * 4); @@ -796,14 +796,14 @@ FX_BOOL CFX_ImageStretcher::StartQuickStretch() } if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH_PIXELS) { ContinueQuickStretch(NULL); - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) +bool CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) { if (m_pScanline == NULL) { - return FALSE; + return false; } int result_width = m_ClipRect.Width(), result_height = m_ClipRect.Height(); int src_height = m_pSource->GetHeight(); @@ -823,7 +823,7 @@ FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) src_y = 0; } if (m_pSource->SkipToScanline(src_y, pPause)) { - return TRUE; + return true; } m_pSource->DownSampleScanline(src_y, m_pScanline, m_DestBPP, m_DestWidth, m_bFlipX, m_ClipRect.left, result_width); if (m_pMaskScanline) { @@ -831,5 +831,5 @@ FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) } m_pDest->ComposeScanline(dest_y, m_pScanline, m_pMaskScanline); } - return FALSE; + return false; } diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp index 8a864f10a1..efd886e2b7 100644 --- a/core/src/fxge/dib/fx_dib_main.cpp +++ b/core/src/fxge/dib/fx_dib_main.cpp @@ -9,7 +9,7 @@ #include "../../../include/fxcodec/fx_codec.h" #include "dib_int.h" #include <limits.h> -FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitch, int width, int height, +bool ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD*& pal, void* pIccTransform); void CmykDecode(FX_DWORD cmyk, int& c, int& m, int& y, int& k) { @@ -52,39 +52,39 @@ CFX_DIBSource::~CFX_DIBSource() } CFX_DIBitmap::CFX_DIBitmap() { - m_bExtBuf = FALSE; + m_bExtBuf = false; m_pBuffer = NULL; m_pPalette = NULL; } #define _MAX_OOM_LIMIT_ 12000000 -FX_BOOL CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, uint8_t* pBuffer, int pitch) +bool CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, uint8_t* pBuffer, int pitch) { m_pBuffer = NULL; m_bpp = (uint8_t)format; m_AlphaFlag = (uint8_t)(format >> 8); m_Width = m_Height = m_Pitch = 0; if (width <= 0 || height <= 0 || pitch < 0) { - return FALSE; + return false; } if ((INT_MAX - 31) / width < (format & 0xff)) { - return FALSE; + return false; } if (!pitch) { pitch = (width * (format & 0xff) + 31) / 32 * 4; } if ((1 << 30) / pitch < height) { - return FALSE; + return false; } if (pBuffer) { m_pBuffer = pBuffer; - m_bExtBuf = TRUE; + m_bExtBuf = true; } else { int size = pitch * height + 4; int oomlimit = _MAX_OOM_LIMIT_; if (oomlimit >= 0 && size >= oomlimit) { m_pBuffer = FX_TryAlloc(uint8_t, size); if (m_pBuffer == NULL) { - return FALSE; + return false; } } else { m_pBuffer = FX_Alloc(uint8_t, size); @@ -94,33 +94,33 @@ FX_BOOL CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, uint8_t m_Height = height; m_Pitch = pitch; if (HasAlpha() && format != FXDIB_Argb) { - FX_BOOL ret = TRUE; + bool ret = true; ret = BuildAlphaMask(); if (!ret) { if (!m_bExtBuf && m_pBuffer) { FX_Free(m_pBuffer); m_pBuffer = NULL; m_Width = m_Height = m_Pitch = 0; - return FALSE; + return false; } } } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::Copy(const CFX_DIBSource* pSrc) +bool CFX_DIBitmap::Copy(const CFX_DIBSource* pSrc) { if (m_pBuffer) { - return FALSE; + return false; } if (!Create(pSrc->GetWidth(), pSrc->GetHeight(), pSrc->GetFormat())) { - return FALSE; + return false; } CopyPalette(pSrc->GetPalette()); CopyAlphaMask(pSrc->m_pAlphaMask); for (int row = 0; row < pSrc->GetHeight(); row ++) { FXSYS_memcpy(m_pBuffer + row * m_Pitch, pSrc->GetScanline(row), m_Pitch); } - return TRUE; + return true; } CFX_DIBitmap::~CFX_DIBitmap() { @@ -218,19 +218,19 @@ void CFX_DIBSource::BuildPalette() } } } -FX_BOOL CFX_DIBSource::BuildAlphaMask() +bool CFX_DIBSource::BuildAlphaMask() { if (m_pAlphaMask) { - return TRUE; + return true; } m_pAlphaMask = new CFX_DIBitmap; if (!m_pAlphaMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { delete m_pAlphaMask; m_pAlphaMask = NULL; - return FALSE; + return false; } FXSYS_memset(m_pAlphaMask->GetBuffer(), 0xff, m_pAlphaMask->GetHeight()*m_pAlphaMask->GetPitch()); - return TRUE; + return true; } FX_DWORD CFX_DIBSource::GetPaletteEntry(int index) const { @@ -367,15 +367,15 @@ void CFX_DIBSource::GetOverlapRect(int& dest_left, int& dest_top, int& width, in width = dest_rect.right - dest_rect.left; height = dest_rect.bottom - dest_rect.top; } -FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int height, +bool CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { if (m_pBuffer == NULL) { - return FALSE; + return false; } GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(), pSrcBitmap->GetHeight(), src_left, src_top, NULL); if (width == 0 || height == 0) { - return TRUE; + return true; } FXDIB_Format dest_format = GetFormat(); FXDIB_Format src_format = pSrcBitmap->GetFormat(); @@ -402,7 +402,7 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int } } else { if (m_pPalette) { - return FALSE; + return false; } if (m_bpp == 8) { dest_format = FXDIB_8bppMask; @@ -410,25 +410,25 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int uint8_t* dest_buf = m_pBuffer + dest_top * m_Pitch + dest_left * GetBPP() / 8; FX_DWORD* d_plt = NULL; if(!ConvertBuffer(dest_format, dest_buf, m_Pitch, width, height, pSrcBitmap, src_left, src_top, d_plt, pIccTransform)) { - return FALSE; + return false; } } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int height, +bool CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int height, const CFX_DIBSource* pMask, FX_DWORD color, int src_left, int src_top, int alpha_flag, void* pIccTransform) { if (m_pBuffer == NULL) { - return FALSE; + return false; } ASSERT(HasAlpha() && (m_bpp >= 24)); ASSERT(pMask->IsAlphaMask()); if (!HasAlpha() || !pMask->IsAlphaMask() || m_bpp < 24) { - return FALSE; + return false; } GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(), pMask->GetHeight(), src_left, src_top, NULL); if (width == 0 || height == 0) { - return TRUE; + return true; } int src_bpp = pMask->GetBPP(); int alpha; @@ -449,7 +449,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int h AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color), color_p[2], color_p[1], color_p[0]); else if (!(alpha_flag >> 8) && IsCmykImage()) { - return FALSE; + return false; } } if(!IsCmykImage()) { @@ -507,7 +507,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int h } } } - return TRUE; + return true; } void CFX_DIBSource::CopyPalette(const FX_DWORD* pSrc, FX_DWORD size) { @@ -570,21 +570,21 @@ CFX_DIBitmap* CFX_DIBSource::GetAlphaMask(const FX_RECT* pClip) const } return pMask; } -FX_BOOL CFX_DIBSource::CopyAlphaMask(const CFX_DIBSource* pAlphaMask, const FX_RECT* pClip) +bool CFX_DIBSource::CopyAlphaMask(const CFX_DIBSource* pAlphaMask, const FX_RECT* pClip) { if (!HasAlpha() || GetFormat() == FXDIB_Argb) { - return FALSE; + return false; } if (pAlphaMask) { FX_RECT rect(0, 0, pAlphaMask->m_Width, pAlphaMask->m_Height); if (pClip) { rect.Intersect(*pClip); if (rect.IsEmpty() || rect.Width() != m_Width || rect.Height() != m_Height) { - return FALSE; + return false; } } else { if (pAlphaMask->m_Width != m_Width || pAlphaMask->m_Height != m_Height) { - return FALSE; + return false; } } for (int row = 0; row < m_Height; row ++) @@ -593,25 +593,25 @@ FX_BOOL CFX_DIBSource::CopyAlphaMask(const CFX_DIBSource* pAlphaMask, const FX_R } else { m_pAlphaMask->Clear(0xff000000); } - return TRUE; + return true; } const int g_ChannelOffset[] = {0, 2, 1, 0, 0, 1, 2, 3, 3}; -FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource* pSrcBitmap, FXDIB_Channel srcChannel) +bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource* pSrcBitmap, FXDIB_Channel srcChannel) { if (m_pBuffer == NULL) { - return FALSE; + return false; } CFX_DIBSource* pSrcClone = (CFX_DIBSource*)pSrcBitmap; CFX_DIBitmap* pDst = this; int destOffset, srcOffset; if (srcChannel == FXDIB_Alpha) { if (!pSrcBitmap->HasAlpha() && !pSrcBitmap->IsAlphaMask()) { - return FALSE; + return false; } if (pSrcBitmap->GetBPP() == 1) { pSrcClone = pSrcBitmap->CloneConvert(FXDIB_8bppMask); if (pSrcClone == NULL) { - return FALSE; + return false; } } if(pSrcBitmap->GetFormat() == FXDIB_Argb) { @@ -621,7 +621,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource } } else { if (pSrcBitmap->IsAlphaMask()) { - return FALSE; + return false; } if (pSrcBitmap->GetBPP() < 24) { if (pSrcBitmap->IsCmykImage()) { @@ -630,7 +630,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource pSrcClone = pSrcBitmap->CloneConvert((FXDIB_Format)((pSrcBitmap->GetFormat() & 0xff00) | 0x18)); } if (pSrcClone == NULL) { - return FALSE; + return false; } } srcOffset = g_ChannelOffset[srcChannel]; @@ -641,7 +641,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } destOffset = 0; } else { @@ -650,7 +650,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } if (GetFormat() == FXDIB_Argb) { destOffset = 3; @@ -661,7 +661,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } if (GetBPP() < 24) { if (HasAlpha()) { @@ -669,7 +669,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } } else #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ @@ -680,7 +680,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } } destOffset = g_ChannelOffset[destChannel]; @@ -694,7 +694,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } } } @@ -710,7 +710,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource delete pSrcClone; } if (pSrcMatched == NULL) { - return FALSE; + return false; } pSrcClone = pSrcMatched; } @@ -732,24 +732,24 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource if (pSrcClone != pSrcBitmap && pSrcClone != pSrcBitmap->m_pAlphaMask) { delete pSrcClone; } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) +bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) { if (m_pBuffer == NULL) { - return FALSE; + return false; } int destOffset; if (destChannel == FXDIB_Alpha) { if (IsAlphaMask()) { if(!ConvertFormat(FXDIB_8bppMask)) { - return FALSE; + return false; } destOffset = 0; } else { destOffset = 0; if(!ConvertFormat(IsCmykImage() ? FXDIB_Cmyka : FXDIB_Argb)) { - return FALSE; + return false; } if (GetFormat() == FXDIB_Argb) { destOffset = 3; @@ -757,21 +757,21 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) } } else { if (IsAlphaMask()) { - return FALSE; + return false; } if (GetBPP() < 24) { if (HasAlpha()) { if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyka : FXDIB_Argb)) { - return FALSE; + return false; } } else #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb)) { - return FALSE; + return false; } #else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb32)) { - return FALSE; + return false; } #endif } @@ -780,11 +780,11 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) int Bpp = GetBPP() / 8; if (Bpp == 1) { FXSYS_memset(m_pBuffer, value, m_Height * m_Pitch); - return TRUE; + return true; } if (destChannel == FXDIB_Alpha && m_pAlphaMask) { FXSYS_memset(m_pAlphaMask->GetBuffer(), value, m_pAlphaMask->GetHeight()*m_pAlphaMask->GetPitch()); - return TRUE; + return true; } for (int row = 0; row < m_Height; row ++) { uint8_t* scan_line = m_pBuffer + row * m_Pitch + destOffset; @@ -793,16 +793,16 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) scan_line += Bpp; } } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) +bool CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) { if (m_pBuffer == NULL) { - return FALSE; + return false; } ASSERT(pSrcBitmap->IsAlphaMask()); if (!pSrcBitmap->IsAlphaMask()) { - return FALSE; + return false; } if (!IsAlphaMask() && !HasAlpha()) { return LoadChannel(FXDIB_Alpha, pSrcBitmap, FXDIB_Alpha); @@ -812,7 +812,7 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) pSrcClone = pSrcBitmap->StretchTo(m_Width, m_Height); ASSERT(pSrcClone != NULL); if (pSrcClone == NULL) { - return FALSE; + return false; } } if (IsAlphaMask()) { @@ -820,7 +820,7 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } for (int row = 0; row < m_Height; row ++) { uint8_t* dest_scan = m_pBuffer + m_Pitch * row; @@ -844,7 +844,7 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } for (int row = 0; row < m_Height; row ++) { uint8_t* dest_scan = m_pBuffer + m_Pitch * row + 3; @@ -861,17 +861,17 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) +bool CFX_DIBitmap::GetGrayData(void* pIccTransform) { if (m_pBuffer == NULL) { - return FALSE; + return false; } switch (GetFormat()) { case FXDIB_1bppRgb: { if (m_pPalette == NULL) { - return FALSE; + return false; } uint8_t gray[2]; for (int i = 0; i < 2; i ++) { @@ -883,7 +883,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) CFX_DIBitmap* pMask = new CFX_DIBitmap; if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { delete pMask; - return FALSE; + return false; } FXSYS_memset(pMask->GetBuffer(), gray[0], pMask->GetPitch() * m_Height); for (int row = 0; row < m_Height; row ++) { @@ -902,7 +902,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) } case FXDIB_8bppRgb: { if (m_pPalette == NULL) { - return FALSE; + return false; } uint8_t gray[256]; for (int i = 0; i < 256; i ++) { @@ -914,7 +914,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) CFX_DIBitmap* pMask = new CFX_DIBitmap; if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { delete pMask; - return FALSE; + return false; } for (int row = 0; row < m_Height; row ++) { uint8_t* dest_pos = pMask->GetBuffer() + row * pMask->GetPitch(); @@ -931,7 +931,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) CFX_DIBitmap* pMask = new CFX_DIBitmap; if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { delete pMask; - return FALSE; + return false; } for (int row = 0; row < m_Height; row ++) { uint8_t* src_pos = m_pBuffer + row * m_Pitch; @@ -949,7 +949,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) CFX_DIBitmap* pMask = new CFX_DIBitmap; if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { delete pMask; - return FALSE; + return false; } for (int row = 0; row < m_Height; row ++) { uint8_t* src_pos = m_pBuffer + row * m_Pitch; @@ -964,19 +964,19 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) break; } default: - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::MultiplyAlpha(int alpha) +bool CFX_DIBitmap::MultiplyAlpha(int alpha) { if (m_pBuffer == NULL) { - return FALSE; + return false; } switch (GetFormat()) { case FXDIB_1bppMask: if (!ConvertFormat(FXDIB_8bppMask)) { - return FALSE; + return false; } MultiplyAlpha(alpha); break; @@ -1004,18 +1004,18 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(int alpha) m_pAlphaMask->MultiplyAlpha(alpha); } else if (IsCmykImage()) { if (!ConvertFormat((FXDIB_Format)(GetFormat() | 0x0200))) { - return FALSE; + return false; } m_pAlphaMask->MultiplyAlpha(alpha); } else { if (!ConvertFormat(FXDIB_Argb)) { - return FALSE; + return false; } MultiplyAlpha(alpha); } break; } - return TRUE; + return true; } FX_DWORD CFX_DIBitmap::GetPixel(int x, int y) const { @@ -1122,7 +1122,7 @@ void CFX_DIBitmap::SetPixel(int x, int y, FX_DWORD color) } } void CFX_DIBitmap::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, - int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const + int dest_width, bool bFlipX, int clip_left, int clip_width) const { if (m_pBuffer == NULL) { return; @@ -1179,15 +1179,15 @@ void CFX_DIBitmap::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp } } } -FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) +bool CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) { ASSERT(!IsAlphaMask()); if (m_pBuffer == NULL || IsAlphaMask()) { - return FALSE; + return false; } int fc, fm, fy, fk, bc, bm, by, bk; int fr, fg, fb, br, bg, bb; - FX_BOOL isCmykImage = IsCmykImage(); + bool isCmykImage = IsCmykImage(); if (isCmykImage) { fc = FXSYS_GetCValue(forecolor); fm = FXSYS_GetMValue(forecolor); @@ -1208,10 +1208,10 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) if (m_bpp <= 8) { if (isCmykImage) { if (forecolor == 0xff && backcolor == 0 && m_pPalette == NULL) { - return TRUE; + return true; } } else if (forecolor == 0 && backcolor == 0xffffff && m_pPalette == NULL) { - return TRUE; + return true; } if (m_pPalette == NULL) { BuildPalette(); @@ -1232,7 +1232,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) m_pPalette[i] = FXARGB_MAKE(0xff, br + (fr - br) * gray / 255, bg + (fg - bg) * gray / 255, bb + (fb - bb) * gray / 255); } - return TRUE; + return true; } if (isCmykImage) { if (forecolor == 0xff && backcolor == 0x00) { @@ -1248,7 +1248,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) *scanline ++ = 255 - FXRGB2GRAY(r, g, b); } } - return TRUE; + return true; } } else if (forecolor == 0 && backcolor == 0xffffff) { for (int row = 0; row < m_Height; row ++) { @@ -1262,7 +1262,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) scanline += gap; } } - return TRUE; + return true; } if (isCmykImage) { for (int row = 0; row < m_Height; row ++) { @@ -1291,18 +1291,18 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) } } } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, int pal_size, const FX_RECT* pRect) +bool CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, int pal_size, const FX_RECT* pRect) { if (m_pBuffer == NULL) { - return FALSE; + return false; } if (m_bpp != 8 && m_pPalette != NULL && m_AlphaFlag != 0) { - return FALSE; + return false; } if (m_Width < 4 && m_Height < 4) { - return FALSE; + return false; } FX_RECT rect(0, 0, m_Width, m_Height); if (pRect) { @@ -1374,9 +1374,9 @@ FX_BOOL CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, int pal_size, const FX_ } } } - return TRUE; + return true; } -CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const +CFX_DIBitmap* CFX_DIBSource::FlipImage(bool bXFlip, bool bYFlip) const { CFX_DIBitmap* pFlipped = new CFX_DIBitmap; if (!pFlipped->Create(m_Width, m_Height, GetFormat())) { @@ -1480,7 +1480,7 @@ CFX_FilteredDIB::~CFX_FilteredDIB() FX_Free(m_pScanline); } } -void CFX_FilteredDIB::LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc) +void CFX_FilteredDIB::LoadSrc(const CFX_DIBSource* pSrc, bool bAutoDropSrc) { m_pSrc = pSrc; m_bAutoDropSrc = bAutoDropSrc; @@ -1499,7 +1499,7 @@ const uint8_t* CFX_FilteredDIB::GetScanline(int line) const return m_pScanline; } void CFX_FilteredDIB::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, - int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const + int dest_width, bool bFlipX, int clip_left, int clip_width) const { m_pSrc->DownSampleScanline(line, dest_scan, dest_bpp, dest_width, bFlipX, clip_left, clip_width); TranslateDownSamples(dest_scan, dest_scan, clip_width, dest_bpp); @@ -1508,18 +1508,18 @@ CFX_ImageRenderer::CFX_ImageRenderer() { m_Status = 0; m_pTransformer = NULL; - m_bRgbByteOrder = FALSE; + m_bRgbByteOrder = false; m_BlendType = FXDIB_BLEND_NORMAL; } CFX_ImageRenderer::~CFX_ImageRenderer() { delete m_pTransformer; } -extern FX_RECT _FXDIB_SwapClipBox(FX_RECT& clip, int width, int height, FX_BOOL bFlipX, FX_BOOL bFlipY); -FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClipRgn, +extern FX_RECT _FXDIB_SwapClipBox(FX_RECT& clip, int width, int height, bool bFlipX, bool bFlipY); +bool CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClipRgn, const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD mask_color, const CFX_AffineMatrix* pMatrix, - FX_DWORD dib_flags, FX_BOOL bRgbByteOrder, + FX_DWORD dib_flags, bool bRgbByteOrder, int alpha_flag, void* pIccTransform, int blend_type) { m_Matrix = *pMatrix; @@ -1528,7 +1528,7 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClip m_ClipBox = pClipRgn ? pClipRgn->GetBox() : FX_RECT(0, 0, pDevice->GetWidth(), pDevice->GetHeight()); m_ClipBox.Intersect(image_rect); if (m_ClipBox.IsEmpty()) { - return FALSE; + return false; } m_pDevice = pDevice; m_pClipRgn = pClipRgn; @@ -1540,7 +1540,7 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClip m_pIccTransform = pIccTransform; m_bRgbByteOrder = bRgbByteOrder; m_BlendType = blend_type; - FX_BOOL ret = TRUE; + bool ret = true; if ((FXSYS_fabs(m_Matrix.b) >= 0.5f || m_Matrix.a == 0) || (FXSYS_fabs(m_Matrix.c) >= 0.5f || m_Matrix.d == 0) ) { if (FXSYS_fabs(m_Matrix.a) < FXSYS_fabs(m_Matrix.b) / 20 && FXSYS_fabs(m_Matrix.d) < FXSYS_fabs(m_Matrix.c) / 20 && @@ -1550,18 +1550,18 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClip FX_RECT bitmap_clip = m_ClipBox; bitmap_clip.Offset(-image_rect.left, -image_rect.top); bitmap_clip = _FXDIB_SwapClipBox(bitmap_clip, dest_width, dest_height, m_Matrix.c > 0, m_Matrix.b < 0); - m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox, TRUE, + m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox, true, m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder, alpha_flag, pIccTransform, m_BlendType); if (!m_Stretcher.Start(&m_Composer, pSource, dest_height, dest_width, bitmap_clip, dib_flags)) { - return FALSE; + return false; } m_Status = 1; - return TRUE; + return true; } m_Status = 2; m_pTransformer = new CFX_ImageTransformer; m_pTransformer->Start(pSource, &m_Matrix, dib_flags, &m_ClipBox); - return TRUE; + return true; } int dest_width = image_rect.Width(); if (m_Matrix.a < 0) { @@ -1572,32 +1572,32 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClip dest_height = -dest_height; } if (dest_width == 0 || dest_height == 0) { - return FALSE; + return false; } FX_RECT bitmap_clip = m_ClipBox; bitmap_clip.Offset(-image_rect.left, -image_rect.top); m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, - m_ClipBox, FALSE, FALSE, FALSE, m_bRgbByteOrder, alpha_flag, pIccTransform, m_BlendType); + m_ClipBox, false, false, false, m_bRgbByteOrder, alpha_flag, pIccTransform, m_BlendType); m_Status = 1; ret = m_Stretcher.Start(&m_Composer, pSource, dest_width, dest_height, bitmap_clip, dib_flags); return ret; } -FX_BOOL CFX_ImageRenderer::Continue(IFX_Pause* pPause) +bool CFX_ImageRenderer::Continue(IFX_Pause* pPause) { if (m_Status == 1) { return m_Stretcher.Continue(pPause); } if (m_Status == 2) { if (m_pTransformer->Continue(pPause)) { - return TRUE; + return true; } CFX_DIBitmap* pBitmap = m_pTransformer->m_Storer.Detach(); if (pBitmap == NULL) { - return FALSE; + return false; } if (pBitmap->GetBuffer() == NULL) { delete pBitmap; - return FALSE; + return false; } if (pBitmap->IsAlphaMask()) { if (m_BitmapAlpha != 255) { @@ -1618,9 +1618,9 @@ FX_BOOL CFX_ImageRenderer::Continue(IFX_Pause* pPause) pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap, 0, 0, m_BlendType, m_pClipRgn, m_bRgbByteOrder, m_pIccTransform); } delete pBitmap; - return FALSE; + return false; } - return FALSE; + return false; } CFX_BitmapStorer::CFX_BitmapStorer() { @@ -1653,16 +1653,16 @@ void CFX_BitmapStorer::ComposeScanline(int line, const uint8_t* scanline, const FXSYS_memcpy(dest_alpha_buf, scan_extra_alpha, m_pBitmap->m_pAlphaMask->GetPitch()); } } -FX_BOOL CFX_BitmapStorer::SetInfo(int width, int height, FXDIB_Format src_format, FX_DWORD* pSrcPalette) +bool CFX_BitmapStorer::SetInfo(int width, int height, FXDIB_Format src_format, FX_DWORD* pSrcPalette) { m_pBitmap = new CFX_DIBitmap; if (!m_pBitmap->Create(width, height, src_format)) { delete m_pBitmap; m_pBitmap = NULL; - return FALSE; + return false; } if (pSrcPalette) { m_pBitmap->CopyPalette(pSrcPalette); } - return TRUE; + return true; } diff --git a/core/src/fxge/dib/fx_dib_transform.cpp b/core/src/fxge/dib/fx_dib_transform.cpp index e34e715bf2..01bc167ede 100644 --- a/core/src/fxge/dib/fx_dib_transform.cpp +++ b/core/src/fxge/dib/fx_dib_transform.cpp @@ -54,7 +54,7 @@ public: y1 /= base; } }; -CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_RECT* pDestClip) const +CFX_DIBitmap* CFX_DIBSource::SwapXY(bool bXFlip, bool bYFlip, const FX_RECT* pDestClip) const { FX_RECT dest_clip(0, 0, m_Height, m_Width); if (pDestClip) { @@ -148,7 +148,7 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_REC return pTransBitmap; } #define FIX16_005 0.05f -FX_RECT _FXDIB_SwapClipBox(FX_RECT& clip, int width, int height, FX_BOOL bFlipX, FX_BOOL bFlipY) +FX_RECT _FXDIB_SwapClipBox(FX_RECT& clip, int width, int height, bool bFlipX, bool bFlipY) { FX_RECT rect; if (bFlipY) { @@ -206,7 +206,7 @@ CFX_ImageTransformer::CFX_ImageTransformer() CFX_ImageTransformer::~CFX_ImageTransformer() { } -FX_BOOL CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pDestMatrix, int flags, const FX_RECT* pDestClip) +bool CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pDestMatrix, int flags, const FX_RECT* pDestClip) { m_pMatrix = (CFX_AffineMatrix*)pDestMatrix; CFX_FloatRect unit_rect = pDestMatrix->GetUnitRect(); @@ -216,7 +216,7 @@ FX_BOOL CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineM result_clip.Intersect(*pDestClip); } if (result_clip.IsEmpty()) { - return FALSE; + return false; } m_ResultLeft = result_clip.left; m_ResultTop = result_clip.top; @@ -232,7 +232,7 @@ FX_BOOL CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineM result_clip = _FXDIB_SwapClipBox(result_clip, dest_width, dest_height, pDestMatrix->c > 0, pDestMatrix->b < 0); m_Stretcher.Start(&m_Storer, pSrc, dest_height, dest_width, result_clip, flags); m_Status = 1; - return TRUE; + return true; } if (FXSYS_fabs(pDestMatrix->b) < FIX16_005 && FXSYS_fabs(pDestMatrix->c) < FIX16_005) { int dest_width = pDestMatrix->a > 0 ? (int)FXSYS_ceil(pDestMatrix->a) : (int)FXSYS_floor(pDestMatrix->a); @@ -240,7 +240,7 @@ FX_BOOL CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineM result_clip.Offset(-result_rect.left, -result_rect.top); m_Stretcher.Start(&m_Storer, pSrc, dest_width, dest_height, result_clip, flags); m_Status = 2; - return TRUE; + return true; } int stretch_width = (int)FXSYS_ceil(FXSYS_sqrt2(pDestMatrix->a, pDestMatrix->b)); int stretch_height = (int)FXSYS_ceil(FXSYS_sqrt2(pDestMatrix->c, pDestMatrix->d)); @@ -254,7 +254,7 @@ FX_BOOL CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineM m_StretchClip.Intersect(0, 0, stretch_width, stretch_height); m_Stretcher.Start(&m_Storer, pSrc, stretch_width, stretch_height, m_StretchClip, flags); m_Status = 3; - return TRUE; + return true; } uint8_t _bilinear_interpol(const uint8_t* buf, int row_offset_l, int row_offset_r, int src_col_l, int src_col_r, int res_x, int res_y, @@ -335,30 +335,30 @@ FXDIB_Format _GetTransformedFormat(const CFX_DIBSource* pDrc) } return format; } -FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) +bool CFX_ImageTransformer::Continue(IFX_Pause* pPause) { if (m_Status == 1) { if (m_Stretcher.Continue(pPause)) { - return TRUE; + return true; } if (m_Storer.GetBitmap()) { m_Storer.Replace(m_Storer.GetBitmap()->SwapXY(m_pMatrix->c > 0, m_pMatrix->b < 0)); } - return FALSE; + return false; } if (m_Status == 2) { return m_Stretcher.Continue(pPause); } if (m_Status != 3) { - return FALSE; + return false; } if (m_Stretcher.Continue(pPause)) { - return TRUE; + return true; } int stretch_width = m_StretchClip.Width(); int stretch_height = m_StretchClip.Height(); if (m_Storer.GetBitmap() == NULL) { - return FALSE; + return false; } const uint8_t* stretch_buf = m_Storer.GetBitmap()->GetBuffer(); const uint8_t* stretch_buf_mask = NULL; @@ -370,7 +370,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) FXDIB_Format transformF = _GetTransformedFormat(m_Stretcher.m_pSource); if (!pTransformed->Create(m_ResultWidth, m_ResultHeight, transformF)) { delete pTransformed; - return FALSE; + return false; } pTransformed->Clear(0); if (pTransformed->m_pAlphaMask) { @@ -641,7 +641,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } } } else { - FX_BOOL bHasAlpha = m_Storer.GetBitmap()->HasAlpha(); + bool bHasAlpha = m_Storer.GetBitmap()->HasAlpha(); int destBpp = pTransformed->GetBPP() / 8; if (!(m_Flags & FXDIB_DOWNSAMPLE) && !(m_Flags & FXDIB_BICUBIC_INTERPOL)) { CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); @@ -786,5 +786,5 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } } m_Storer.Replace(pTransformed); - return FALSE; + return false; } diff --git a/core/src/fxge/ge/fx_ge_device.cpp b/core/src/fxge/ge/fx_ge_device.cpp index 0baa99cdc7..ecdd1b0183 100644 --- a/core/src/fxge/ge/fx_ge_device.cpp +++ b/core/src/fxge/ge/fx_ge_device.cpp @@ -35,7 +35,7 @@ void CFX_RenderDevice::InitDeviceInfo() m_ClipBox.bottom = m_Height; } } -FX_BOOL CFX_RenderDevice::StartRendering() +bool CFX_RenderDevice::StartRendering() { return m_pDeviceDriver->StartRendering(); } @@ -47,7 +47,7 @@ void CFX_RenderDevice::SaveState() { m_pDeviceDriver->SaveState(); } -void CFX_RenderDevice::RestoreState(FX_BOOL bKeepSaved) +void CFX_RenderDevice::RestoreState(bool bKeepSaved) { m_pDeviceDriver->RestoreState(bKeepSaved); UpdateClipBox(); @@ -60,7 +60,7 @@ 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 : FXDIB_Cmyk); @@ -74,37 +74,37 @@ FX_BOOL CFX_RenderDevice::CreateCompatibleBitmap(CFX_DIBitmap* pDIB, int width, return pDIB->Create(width, height, m_RenderCaps & FXRC_ALPHA_OUTPUT ? FXDIB_Argb : FXDIB_Rgb); #endif } -FX_BOOL CFX_RenderDevice::SetClip_PathFill(const CFX_PathData* pPathData, +bool CFX_RenderDevice::SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* 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(const CFX_PathData* pPathData, +bool CFX_RenderDevice::SetClip_PathStroke(const CFX_PathData* pPathData, const CFX_AffineMatrix* 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* pRect) +bool CFX_RenderDevice::SetClip_Rect(const FX_RECT* pRect) { CFX_PathData path; path.AppendRect((FX_FLOAT)(pRect->left), (FX_FLOAT)(pRect->bottom), (FX_FLOAT)(pRect->right), (FX_FLOAT)(pRect->top)); if (!SetClip_PathFill(&path, NULL, FXFILL_WINDING)) { - return FALSE; + return false; } UpdateClipBox(); - return TRUE; + return true; } void CFX_RenderDevice::UpdateClipBox() { @@ -116,7 +116,7 @@ void CFX_RenderDevice::UpdateClipBox() m_ClipBox.right = m_Width; m_ClipBox.bottom = m_Height; } -FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData, +bool CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState, FX_DWORD fill_color, FX_DWORD stroke_color, int fill_mode, @@ -149,7 +149,7 @@ FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData, y2 = pPoints[1].m_PointY; } DrawCosmeticLine(x1, y1, x2, y2, fill_color, fill_mode, alpha_flag, pIccTransform, blend_type); - return TRUE; + return true; } if ((pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) && stroke_alpha == 0) { CFX_FloatRect rect_f; @@ -184,13 +184,13 @@ FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData, } } if (FillRect(&rect_i, fill_color, alpha_flag, pIccTransform, 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; graphState.m_LineWidth = 0.0f; @@ -215,7 +215,7 @@ FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData, } if ((fill_mode & 3) && fill_alpha && stroke_alpha < 0xff && (fill_mode & FX_FILL_STROKE)) { if (!(m_RenderCaps & FXRC_GET_BITS)) { - return FALSE; + return false; } CFX_FloatRect bbox; if (pGraphState) { @@ -232,19 +232,19 @@ FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData, FX_RECT rect = bbox.GetOutterRect(); 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, NULL)) { - return FALSE; + return false; } Backdrop.Copy(&bitmap); } CFX_FxgeDevice bitmap_device; - bitmap_device.Attach(&bitmap, 0, FALSE, &Backdrop, TRUE); + bitmap_device.Attach(&bitmap, 0, false, &Backdrop, true); CFX_AffineMatrix matrix; if (pObject2Device) { matrix = *pObject2Device; @@ -252,51 +252,51 @@ FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData, matrix.TranslateI(-rect.left, -rect.top); matrix.Concat(fScaleX, 0, 0, fScaleY, 0, 0); if (!bitmap_device.GetDeviceDriver()->DrawPath(pPathData, &matrix, pGraphState, fill_color, stroke_color, fill_mode, alpha_flag, pIccTransform, blend_type)) { - return FALSE; + return false; } FX_RECT src_rect(0, 0, FXSYS_round(rect.Width() * fScaleX), FXSYS_round(rect.Height() * fScaleY)); return m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, rect.left, rect.top, FXDIB_BLEND_NORMAL); } return m_pDeviceDriver->DrawPath(pPathData, pObject2Device, pGraphState, fill_color, stroke_color, fill_mode, alpha_flag, pIccTransform, blend_type); } -FX_BOOL CFX_RenderDevice::SetPixel(int x, int y, FX_DWORD color, int alpha_flag, void* pIccTransform) +bool CFX_RenderDevice::SetPixel(int x, int y, FX_DWORD color, int alpha_flag, void* pIccTransform) { if (m_pDeviceDriver->SetPixel(x, y, color, alpha_flag, pIccTransform)) { - return TRUE; + return true; } FX_RECT rect(x, y, x + 1, y + 1); return FillRect(&rect, color, alpha_flag, pIccTransform); } -FX_BOOL CFX_RenderDevice::FillRect(const FX_RECT* pRect, FX_DWORD fill_color, int alpha_flag, void* pIccTransform, int blend_type) +bool CFX_RenderDevice::FillRect(const FX_RECT* pRect, FX_DWORD fill_color, int alpha_flag, void* pIccTransform, int blend_type) { if (m_pDeviceDriver->FillRect(pRect, fill_color, alpha_flag, pIccTransform, 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, alpha_flag, pIccTransform)) { - 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, FX_DWORD color, +bool CFX_RenderDevice::DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, FX_DWORD color, int fill_mode, int alpha_flag, void* pIccTransform, int blend_type) { if (((m_RenderCaps & FXRC_ALPHA_PATH) && (FXGETFLAG_COLORTYPE(alpha_flag) && FXGETFLAG_ALPHA_FILL(alpha_flag) == 0xff)) || color >= 0xff000000) if (m_pDeviceDriver->DrawCosmeticLine(x1, y1, x2, y2, color, alpha_flag, pIccTransform, blend_type)) { - return TRUE; + return true; } CFX_GraphStateData graph_state; CFX_PathData path; @@ -305,10 +305,10 @@ FX_BOOL CFX_RenderDevice::DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2 path.SetPoint(1, x2, y2, FXPT_LINETO); return m_pDeviceDriver->DrawPath(&path, NULL, &graph_state, 0, color, fill_mode, alpha_flag, pIccTransform, blend_type); } -FX_BOOL CFX_RenderDevice::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform) +bool CFX_RenderDevice::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform) { if (!(m_RenderCaps & FXRC_GET_BITS)) { - return FALSE; + return false; } return m_pDeviceDriver->GetDIBits(pBitmap, left, top, pIccTransform); } @@ -316,7 +316,7 @@ CFX_DIBitmap* CFX_RenderDevice::GetBackDrop() { return m_pDeviceDriver->GetBackDrop(); } -FX_BOOL CFX_RenderDevice::SetDIBits(const CFX_DIBSource* pBitmap, int left, int top, int blend_mode, +bool CFX_RenderDevice::SetDIBits(const CFX_DIBSource* pBitmap, int left, int top, int blend_mode, void* pIccTransform) { ASSERT(!pBitmap->IsAlphaMask()); @@ -326,7 +326,7 @@ FX_BOOL CFX_RenderDevice::SetDIBits(const CFX_DIBSource* pBitmap, int left, int FX_RECT dest_rect(left, top, FXSYS_round(left + pBitmap->GetWidth() / fScaleX), 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()); @@ -337,29 +337,29 @@ FX_BOOL CFX_RenderDevice::SetDIBits(const CFX_DIBSource* pBitmap, int left, int 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, NULL, FALSE, pIccTransform)) { - return FALSE; + blend_mode, NULL, false, pIccTransform)) { + return false; } FX_RECT src_rect(0, 0, bg_pixel_width, bg_pixel_height); return m_pDeviceDriver->SetDIBits(&background, 0, &src_rect, dest_rect.left, dest_rect.top, FXDIB_BLEND_NORMAL); } return m_pDeviceDriver->SetDIBits(pBitmap, 0, &src_rect, dest_rect.left, dest_rect.top, blend_mode, 0, pIccTransform); } -FX_BOOL CFX_RenderDevice::StretchDIBits(const CFX_DIBSource* pBitmap, int left, int top, +bool CFX_RenderDevice::StretchDIBits(const CFX_DIBSource* pBitmap, int left, int top, int dest_width, int dest_height, FX_DWORD flags, void* pIccTransform, int blend_mode) { @@ -367,17 +367,17 @@ FX_BOOL CFX_RenderDevice::StretchDIBits(const CFX_DIBSource* pBitmap, int left, 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, 0, pIccTransform, blend_mode); } -FX_BOOL CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap, int left, int top, FX_DWORD argb, +bool CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap, int left, int top, FX_DWORD argb, int alpha_flag, void* pIccTransform) { FX_RECT src_rect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight()); return m_pDeviceDriver->SetDIBits(pBitmap, argb, &src_rect, left, top, FXDIB_BLEND_NORMAL, alpha_flag, pIccTransform); } -FX_BOOL CFX_RenderDevice::StretchBitMask(const CFX_DIBSource* pBitmap, int left, int top, +bool CFX_RenderDevice::StretchBitMask(const CFX_DIBSource* pBitmap, int left, int top, int dest_width, int dest_height, FX_DWORD argb, FX_DWORD flags, int alpha_flag, void* pIccTransform) { @@ -386,13 +386,13 @@ FX_BOOL CFX_RenderDevice::StretchBitMask(const CFX_DIBSource* pBitmap, int left, clip_box.Intersect(dest_rect); return m_pDeviceDriver->StretchDIBits(pBitmap, argb, left, top, dest_width, dest_height, &clip_box, flags, alpha_flag, pIccTransform); } -FX_BOOL CFX_RenderDevice::StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD argb, +bool CFX_RenderDevice::StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD argb, const CFX_AffineMatrix* pMatrix, FX_DWORD flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_mode) { return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix, flags, handle, alpha_flag, pIccTransform, 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); } diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp index 6a950bf20b..7a5e0ccabd 100644 --- a/core/src/fxge/ge/fx_ge_font.cpp +++ b/core/src/fxge/ge/fx_ge_font.cpp @@ -13,8 +13,8 @@ CFX_Font::CFX_Font() { m_pSubstFont = NULL; m_Face = NULL; - m_bEmbedded = FALSE; - m_bVertical = FALSE; + m_bEmbedded = false; + m_bVertical = false; m_pFontData = NULL; m_pFontDataAllocation = NULL; m_dwSize = 0; @@ -24,7 +24,7 @@ CFX_Font::CFX_Font() m_pPlatformFontCollection = NULL; m_pDwFont = NULL; m_hHandle = NULL; - m_bDwLoaded = FALSE; + m_bDwLoaded = false; } CFX_Font::~CFX_Font() { @@ -61,10 +61,10 @@ void CFX_Font::DeleteFace() FXFT_Done_Face(m_Face); m_Face = NULL; } -FX_BOOL CFX_Font::LoadSubst(const CFX_ByteString& face_name, FX_BOOL bTrueType, FX_DWORD flags, - int weight, int italic_angle, int CharsetCP, FX_BOOL bVertical) +bool CFX_Font::LoadSubst(const CFX_ByteString& face_name, bool bTrueType, FX_DWORD flags, + int weight, int italic_angle, int CharsetCP, bool bVertical) { - m_bEmbedded = FALSE; + m_bEmbedded = false; m_bVertical = bVertical; m_pSubstFont = new CFX_SubstFont; m_Face = CFX_GEModule::Get()->GetFontMgr()->FindSubstFont(face_name, bTrueType, flags, weight, italic_angle, @@ -79,7 +79,7 @@ FX_BOOL CFX_Font::LoadSubst(const CFX_ByteString& face_name, FX_BOOL bTrueType, m_pFontData = FXFT_Get_Face_Stream_Base(m_Face); m_dwSize = FXFT_Get_Face_Stream_Size(m_Face); } - return TRUE; + return true; } extern "C" { unsigned long _FTStreamRead(FXFT_Stream stream, unsigned long offset, @@ -99,7 +99,7 @@ extern "C" { { } }; -FX_BOOL _LoadFile(FXFT_Library library, FXFT_Face* Face, IFX_FileRead* pFile, FXFT_Stream* stream) +bool _LoadFile(FXFT_Library library, FXFT_Face* Face, IFX_FileRead* pFile, FXFT_Stream* stream) { FXFT_Stream stream1 = (FXFT_Stream)FX_Alloc(uint8_t, sizeof (FXFT_StreamRec)); stream1->base = NULL; @@ -113,16 +113,16 @@ FX_BOOL _LoadFile(FXFT_Library library, FXFT_Face* Face, IFX_FileRead* pFile, FX args.stream = stream1; if (FXFT_Open_Face(library, &args, 0, Face)) { FX_Free(stream1); - return FALSE; + return false; } if (stream) { *stream = stream1; } - return TRUE; + return true; } -FX_BOOL CFX_Font::LoadFile(IFX_FileRead* pFile) +bool CFX_Font::LoadFile(IFX_FileRead* pFile) { - m_bEmbedded = FALSE; + m_bEmbedded = false; FXFT_Library library; if (CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary == NULL) { FXFT_Init_FreeType(&CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary); @@ -130,11 +130,11 @@ FX_BOOL CFX_Font::LoadFile(IFX_FileRead* pFile) library = CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary; FXFT_Stream stream = NULL; if (!_LoadFile(library, &m_Face, pFile, &stream)) { - return FALSE; + return false; } m_pOwnedStream = stream; FXFT_Set_Pixel_Sizes(m_Face, 0, 64); - return TRUE; + return true; } int CFX_Font::GetGlyphWidth(FX_DWORD glyph_index) { @@ -169,20 +169,20 @@ static FXFT_Face FT_LoadFont(uint8_t* pData, int size) } return face; } -FX_BOOL CFX_Font::LoadEmbedded(const uint8_t* data, FX_DWORD size) +bool CFX_Font::LoadEmbedded(const uint8_t* data, FX_DWORD size) { m_pFontDataAllocation = FX_Alloc(uint8_t, size); FXSYS_memcpy(m_pFontDataAllocation, data, size); m_Face = FT_LoadFont((uint8_t*)m_pFontDataAllocation, size); m_pFontData = (uint8_t*)m_pFontDataAllocation; - m_bEmbedded = TRUE; + m_bEmbedded = true; m_dwSize = size; return m_Face != NULL; } -FX_BOOL CFX_Font::IsTTFont() +bool CFX_Font::IsTTFont() { if (m_Face == NULL) { - return FALSE; + return false; } return FXFT_Is_Face_TT_OT(m_Face) == FXFT_FACE_FLAG_SFNT; } @@ -202,25 +202,25 @@ int CFX_Font::GetDescent() const int descent = EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Face_Descender(m_Face)); return descent; } -FX_BOOL CFX_Font::GetGlyphBBox(FX_DWORD glyph_index, FX_RECT &bbox) +bool CFX_Font::GetGlyphBBox(FX_DWORD glyph_index, FX_RECT &bbox) { if (m_Face == NULL) { - 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, @@ -246,7 +246,7 @@ FX_BOOL CFX_Font::GetGlyphBBox(FX_DWORD glyph_index, FX_RECT &bbox) return FXFT_Set_Pixel_Sizes(m_Face, 0, 64) == 0; } 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) { @@ -260,34 +260,34 @@ FX_BOOL CFX_Font::GetGlyphBBox(FX_DWORD glyph_index, FX_RECT &bbox) bbox.right = (FXFT_Get_Glyph_HoriBearingX(m_Face) + FXFT_Get_Glyph_Width(m_Face)) * 1000 / em; bbox.bottom = (FXFT_Get_Glyph_HoriBearingY(m_Face)) * 1000 / em; } - return TRUE; + return true; } -FX_BOOL CFX_Font::IsItalic() +bool CFX_Font::IsItalic() { if (m_Face == NULL) { - return FALSE; + return false; } - FX_BOOL ret = FXFT_Is_Face_Italic(m_Face) == FXFT_STYLE_FLAG_ITALIC; + bool ret = FXFT_Is_Face_Italic(m_Face) == FXFT_STYLE_FLAG_ITALIC; if (!ret) { CFX_ByteString str(FXFT_Get_Face_Style_Name(m_Face)); str.MakeLower(); if (str.Find("italic") != -1) { - ret = TRUE; + ret = true; } } return ret; } -FX_BOOL CFX_Font::IsBold() +bool CFX_Font::IsBold() { if (m_Face == NULL) { - return FALSE; + return false; } return FXFT_Is_Face_Bold(m_Face) == FXFT_STYLE_FLAG_BOLD; } -FX_BOOL CFX_Font::IsFixedWidth() +bool CFX_Font::IsFixedWidth() { if (m_Face == NULL) { - return FALSE; + return false; } return FXFT_Is_Face_fixedwidth(m_Face); } @@ -331,10 +331,10 @@ 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 == NULL) { - return FALSE; + return false; } int em = FXFT_Get_Face_UnitsPerEM(m_Face); if (em == 0) { @@ -348,7 +348,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() { diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index 14427a5e40..15f022e86b 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -18,9 +18,9 @@ CFX_SubstFont::CFX_SubstFont() m_SubstFlags = 0; m_Weight = 0; m_ItalicAngle = 0; - m_bSubstOfCJK = FALSE; + m_bSubstOfCJK = false; m_WeightCJK = 0; - m_bItlicCJK = FALSE; + m_bItlicCJK = false; } CTTFontDesc::~CTTFontDesc() { @@ -38,11 +38,11 @@ CTTFontDesc::~CTTFontDesc() FX_Free(m_pFontData); } } -FX_BOOL CTTFontDesc::ReleaseFace(FXFT_Face face) +bool CTTFontDesc::ReleaseFace(FXFT_Face face) { if (m_Type == 1) { if (m_SingleFace.m_pFace != face) { - return FALSE; + return false; } } else if (m_Type == 2) { int i; @@ -51,15 +51,15 @@ FX_BOOL CTTFontDesc::ReleaseFace(FXFT_Face face) break; } if (i == 16) { - return FALSE; + return false; } } m_RefCount --; if (m_RefCount) { - return FALSE; + return false; } delete this; - return TRUE; + return true; } CFX_FontMgr::CFX_FontMgr() { @@ -98,7 +98,7 @@ void CFX_FontMgr::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) { m_pBuiltinMapper->SetSystemFontInfo(pFontInfo); } -FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name, FX_BOOL bTrueType, +FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name, bool bTrueType, FX_DWORD flags, int weight, int italic_angle, int CharsetCP, CFX_SubstFont* pSubstFont) { if (m_FTLibrary == NULL) { @@ -115,7 +115,7 @@ FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name, FX_BOOL bT CharsetCP, pSubstFont); } FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name, - int weight, FX_BOOL bItalic, uint8_t*& pFontData) + int weight, bool bItalic, uint8_t*& pFontData) { CFX_ByteString key(face_name); key += ','; @@ -131,7 +131,7 @@ FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name, return NULL; } FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name, - int weight, FX_BOOL bItalic, uint8_t* pData, FX_DWORD size, int face_index) + int weight, bool bItalic, uint8_t* pData, FX_DWORD size, int face_index) { CTTFontDesc* pFontDesc = new CTTFontDesc; pFontDesc->m_Type = 1; @@ -433,10 +433,10 @@ void _FPDFAPI_GetInternalFontData(int id, const uint8_t*& data, FX_DWORD& size) { CFX_GEModule::Get()->GetFontMgr()->GetStandardFont(data, size, id); } -FX_BOOL CFX_FontMgr::GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index) +bool CFX_FontMgr::GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index) { if (index > 15 || index < 0) { - return FALSE; + return false; } { if (index >= 14) { @@ -452,14 +452,14 @@ FX_BOOL CFX_FontMgr::GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, size = g_FoxitFonts[index].m_dwSize; } } - return TRUE; + return true; } CFX_FontMapper::CFX_FontMapper() { FXSYS_memset(m_FoxitFaces, 0, sizeof m_FoxitFaces); m_MMFaces[0] = m_MMFaces[1] = NULL; m_pFontInfo = NULL; - m_bListLoaded = FALSE; + m_bListLoaded = false; m_pFontEnumerator = NULL; } CFX_FontMapper::~CFX_FontMapper() @@ -583,10 +583,10 @@ void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) return; } const uint8_t* ptr = name; - FX_BOOL bLocalized = FALSE; + bool bLocalized = false; for (int i = 0; i < name.GetLength(); i ++) if (ptr[i] > 0x80) { - bLocalized = TRUE; + bLocalized = true; break; } if (bLocalized) { @@ -620,7 +620,7 @@ void CFX_FontMapper::LoadInstalledFonts() return; } m_pFontInfo->EnumFontList(this); - m_bListLoaded = TRUE; + m_bListLoaded = true; } CFX_ByteString CFX_FontMapper::MatchInstalledFonts(const CFX_ByteString& norm_name) { @@ -847,7 +847,7 @@ CFX_ByteString ParseStyle(const FX_CHAR* pStyle, int iLen, int iIndex) } return buf.GetByteString(); } -int32_t GetStyleType(const CFX_ByteString &bsStyle, FX_BOOL bRevert) +int32_t GetStyleType(const CFX_ByteString &bsStyle, bool bRevert) { int32_t iLen = bsStyle.GetLength(); if (!iLen) { @@ -872,15 +872,15 @@ int32_t GetStyleType(const CFX_ByteString &bsStyle, FX_BOOL bRevert) } return -1; } -FX_BOOL CheckSupportThirdPartFont(CFX_ByteString name, int &PitchFamily) +bool CheckSupportThirdPartFont(CFX_ByteString name, int &PitchFamily) { if (name == FX_BSTRC("MyriadPro")) { PitchFamily &= ~FXFONT_FF_ROMAN; - return TRUE; + return true; } - return FALSE; + return false; } -FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTrueType, FX_DWORD flags, +FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, bool bTrueType, FX_DWORD flags, int weight, int italic_angle, int WindowCP, CFX_SubstFont* pSubstFont) { if (!(flags & FXFONT_USEEXTERNATTR)) { @@ -923,14 +923,14 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru } int iBaseFont = 0; CFX_ByteString family, style; - FX_BOOL bHasComma = FALSE; - FX_BOOL bHasHypen = FALSE; + bool bHasComma = false; + bool bHasHypen = false; int find = SubstName.Find(FX_BSTRC(","), 0); if (find >= 0) { family = SubstName.Left(find); _PDF_GetStandardFontName(family); style = SubstName.Mid(find + 1); - bHasComma = TRUE; + bHasComma = true; } else { family = SubstName; } @@ -939,9 +939,9 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru break; } int PitchFamily = 0; - FX_BOOL bItalic = FALSE; + bool bItalic = false; FX_DWORD nStyle = 0; - FX_BOOL bStyleAvail = FALSE; + bool bStyleAvail = false; if (iBaseFont < 12) { family = g_Base14FontNames[iBaseFont]; if ((iBaseFont % 4) == 1 || (iBaseFont % 4) == 2) { @@ -962,12 +962,12 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru if (find >= 0) { style = family.Mid(find + 1); family = family.Left(find); - bHasHypen = TRUE; + bHasHypen = true; } } if (!bHasHypen) { int nLen = family.GetLength(); - int32_t nRet = GetStyleType(family, TRUE); + int32_t nRet = GetStyleType(family, true); if (nRet > -1) { family = family.Left(nLen - g_FontStyles[nRet].len); if (nRet == 0) { @@ -995,17 +995,17 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru int nLen = style.GetLength(); const FX_CHAR* pStyle = style; int i = 0; - FX_BOOL bFirstItem = TRUE; + bool bFirstItem = true; CFX_ByteString buf; while (i < nLen) { buf = ParseStyle(pStyle, nLen, i); - int32_t nRet = GetStyleType(buf, FALSE); + int32_t nRet = GetStyleType(buf, false); if ((i && !bStyleAvail) || (!i && nRet < 0)) { family = SubstName; iBaseFont = 12; break; } else if (nRet >= 0) { - bStyleAvail = TRUE; + bStyleAvail = true; } if (nRet == 0) { if (nStyle & FX_FONT_STYLE_Bold) { @@ -1013,7 +1013,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru } else { nStyle |= FX_FONT_STYLE_Bold; } - bFirstItem = FALSE; + bFirstItem = false; } if (nRet == 1) { if (bFirstItem) { @@ -1031,7 +1031,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru } else { nStyle |= FX_FONT_STYLE_Bold; } - bFirstItem = FALSE; + bFirstItem = false; } i += buf.GetLength() + 1; } @@ -1042,9 +1042,9 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru weight = nStyle & FX_FONT_STYLE_BoldBold ? 900 : (nStyle & FX_FONT_STYLE_Bold ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL); } if (nStyle & FX_FONT_STYLE_Italic) { - bItalic = TRUE; + bItalic = true; } - FX_BOOL bCJK = FALSE; + bool bCJK = false; int iExact = 0; int Charset = FXFONT_ANSI_CHARSET; if (WindowCP) { @@ -1054,7 +1054,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru } if (Charset == FXFONT_SHIFTJIS_CHARSET || Charset == FXFONT_GB2312_CHARSET || Charset == FXFONT_HANGEUL_CHARSET || Charset == FXFONT_CHINESEBIG5_CHARSET) { - bCJK = TRUE; + bCJK = true; } if (m_pFontInfo == NULL) { pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; @@ -1069,21 +1069,21 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru if (!bCJK) { if (!CheckSupportThirdPartFont(family, PitchFamily)) { if (italic_angle != 0) { - bItalic = TRUE; + bItalic = true; } else { - bItalic = FALSE; + bItalic = false; } weight = old_weight; } } else { - pSubstFont->m_bSubstOfCJK = TRUE; + pSubstFont->m_bSubstOfCJK = true; if (nStyle) { pSubstFont->m_WeightCJK = weight; } else { pSubstFont->m_WeightCJK = FXFONT_FW_NORMAL; } if (nStyle & FX_FONT_STYLE_Italic) { - pSubstFont->m_bItlicCJK = TRUE; + pSubstFont->m_bItlicCJK = true; } } } else { @@ -1123,7 +1123,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru } } else { if (flags & FXFONT_ITALIC) { - bItalic = TRUE; + bItalic = true; } } iExact = !match.IsEmpty(); @@ -1134,9 +1134,9 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru if (hFont == NULL) { if (bCJK) { if (italic_angle != 0) { - bItalic = TRUE; + bItalic = true; } else { - bItalic = FALSE; + bItalic = false; } weight = old_weight; } @@ -1221,18 +1221,18 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru } pSubstFont->m_Family = SubstName; pSubstFont->m_Charset = Charset; - FX_BOOL bNeedUpdateWeight = FALSE; + bool bNeedUpdateWeight = false; if (FXFT_Is_Face_Bold(face)) { if (weight == FXFONT_FW_BOLD) { - bNeedUpdateWeight = FALSE; + bNeedUpdateWeight = false; } else { - bNeedUpdateWeight = TRUE; + bNeedUpdateWeight = true; } } else { if (weight == FXFONT_FW_NORMAL) { - bNeedUpdateWeight = FALSE; + bNeedUpdateWeight = false; } else { - bNeedUpdateWeight = TRUE; + bNeedUpdateWeight = true; } } if (bNeedUpdateWeight) { @@ -1262,7 +1262,7 @@ CFontFileFaceInfo::CFontFileFaceInfo() m_FileSize = 0; m_FontOffset = 0; m_Weight = 0; - m_bItalic = FALSE; + m_bItalic = false; m_PitchFamily = 0; } CFontFileFaceInfo::~CFontFileFaceInfo() @@ -1272,7 +1272,7 @@ CFontFileFaceInfo::~CFontFileFaceInfo() } m_Face = NULL; } -extern FX_BOOL _LoadFile(FXFT_Library library, FXFT_Face* Face, IFX_FileRead* pFile, FXFT_Stream* stream); +extern bool _LoadFile(FXFT_Library library, FXFT_Face* Face, IFX_FileRead* pFile, FXFT_Stream* stream); #if _FX_OS_ == _FX_ANDROID_ IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() { @@ -1300,13 +1300,13 @@ void CFX_FolderFontInfo::Release() { delete this; } -FX_BOOL CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) +bool CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) { m_pMapper = pMapper; for (int i = 0; i < m_PathList.GetSize(); i ++) { ScanPath(m_PathList[i]); } - return TRUE; + return true; } void CFX_FolderFontInfo::ScanPath(CFX_ByteString& path) { @@ -1315,7 +1315,7 @@ void CFX_FolderFontInfo::ScanPath(CFX_ByteString& path) return; } CFX_ByteString filename; - FX_BOOL bFolder; + bool bFolder; while (FX_GetNextFile(handle, filename, bFolder)) { if (bFolder) { if (filename == "." || filename == "..") { @@ -1451,7 +1451,7 @@ void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path, FXSYS_FILE* pFile, FX_ } m_FontList.SetAt(facename, pInfo); } -void* CFX_FolderFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, int& iExact) +void* CFX_FolderFontInfo::MapFont(int weight, bool bItalic, int charset, int pitch_family, const FX_CHAR* family, int& iExact) { return NULL; } @@ -1506,16 +1506,16 @@ FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, FX_DWORD table, uint8_t* b 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 == NULL) { - return FALSE; + return false; } CFontFaceInfo* pFont = (CFontFaceInfo*)hFont; name = pFont->m_FaceName; - return TRUE; + return true; } -FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) +bool CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) { - return FALSE; + return false; } diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp index 861afd259c..9f493a6cfc 100644 --- a/core/src/fxge/ge/fx_ge_linux.cpp +++ b/core/src/fxge/ge/fx_ge_linux.cpp @@ -30,9 +30,9 @@ Base14Substs[] = { class CFX_LinuxFontInfo : public CFX_FolderFontInfo { public: - void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, int& iExact) override; - FX_BOOL ParseFontCfg(); - void* FindFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL bMatchName); + void* MapFont(int weight, bool bItalic, int charset, int pitch_family, const FX_CHAR* family, int& iExact) override; + bool ParseFontCfg(); + void* FindFont(int weight, bool bItalic, int charset, int pitch_family, const FX_CHAR* family, bool bMatchName); }; #define LINUX_GPNAMESIZE 6 static const struct { @@ -77,7 +77,7 @@ static int32_t GetJapanesePreference(const FX_CHAR* facearr, int weight, int pic } return 2; } -void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, int& iExact) +void* CFX_LinuxFontInfo::MapFont(int weight, bool bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, int& iExact) { CFX_ByteString face = cstr_face; int iBaseFont; @@ -91,7 +91,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p return GetFont(face); } void* p = NULL; - FX_BOOL bCJK = TRUE; + bool bCJK = true; switch (charset) { case FXFONT_SHIFTJIS_CHARSET: { int32_t index = GetJapanesePreference(cstr_face, weight, pitch_family); @@ -129,7 +129,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p } break; default: - bCJK = FALSE; + bCJK = false; break; } if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH)) { @@ -157,7 +157,7 @@ static FX_DWORD _LinuxGetCharset(int charset) } return 0; } -static int32_t _LinuxGetSimilarValue(int weight, FX_BOOL bItalic, int pitch_family, FX_DWORD style) +static int32_t _LinuxGetSimilarValue(int weight, bool bItalic, int pitch_family, FX_DWORD style) { int32_t iSimilarValue = 0; if ((style & FXFONT_BOLD) == (weight > 400)) { @@ -177,7 +177,7 @@ static int32_t _LinuxGetSimilarValue(int weight, FX_BOOL bItalic, int pitch_fami } return iSimilarValue; } -void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL bMatchName) +void* CFX_LinuxFontInfo::FindFont(int weight, bool bItalic, int charset, int pitch_family, const FX_CHAR* family, bool bMatchName) { CFontFaceInfo* pFind = NULL; FX_DWORD charset_flag = _LinuxGetCharset(charset); @@ -217,9 +217,9 @@ IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() } return pInfo; } -FX_BOOL CFX_LinuxFontInfo::ParseFontCfg() +bool CFX_LinuxFontInfo::ParseFontCfg() { - return FALSE; + return false; } void CFX_GEModule::InitPlatform() { diff --git a/core/src/fxge/ge/fx_ge_path.cpp b/core/src/fxge/ge/fx_ge_path.cpp index b1410b3911..4bc9a88128 100644 --- a/core/src/fxge/ge/fx_ge_path.cpp +++ b/core/src/fxge/ge/fx_ge_path.cpp @@ -110,7 +110,7 @@ void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) m_Mask = new_mask; return; } - ASSERT(FALSE); + ASSERT(false); } CFX_PathData::CFX_PathData() { @@ -257,8 +257,8 @@ static void _UpdateLineJoinPoints(CFX_FloatRect& rect, FX_FLOAT start_x, FX_FLOA FX_FLOAT half_width, 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; @@ -342,12 +342,12 @@ CFX_FloatRect CFX_PathData::GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_l int iPoint = 0; FX_FLOAT half_width = line_width; int iStartPoint, iEndPoint, iMiddlePoint; - 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); @@ -357,12 +357,12 @@ CFX_FloatRect CFX_PathData::GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_l if (iPoint == m_PointCount - 1 || 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; @@ -389,10 +389,10 @@ void CFX_PathData::Transform(const CFX_AffineMatrix* pMatrix) pMatrix->Transform(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY); } } -FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath, CFX_AffineMatrix* pMatrix, FX_BOOL&bThin, FX_BOOL bAdjust) const +bool CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath, CFX_AffineMatrix* 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 && (m_pPoints[2].m_Flag & FXPT_TYPE) == FXPT_LINETO @@ -422,19 +422,19 @@ FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath, CFX_AffineMatrix* p NewPath.SetPoint(1, m_pPoints[1].m_PointX, m_pPoints[1].m_PointY, FXPT_LINETO); } 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 == m_pPoints[mid + i + 1].m_PointX && m_pPoints[mid - i - 1].m_PointY == 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(); @@ -444,8 +444,8 @@ FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath, CFX_AffineMatrix* p } if (!bZeroArea) { NewPath.Append(&t_path, NULL); - bThin = TRUE; - return TRUE; + bThin = true; + return true; } } int stratPoint = 0; @@ -488,7 +488,7 @@ FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath, CFX_AffineMatrix* p NewPath.AddPointCount(2); NewPath.SetPoint(new_count, m_pPoints[i - 1].m_PointX, 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) { @@ -497,42 +497,42 @@ FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath, CFX_AffineMatrix* p } } 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)) || (m_pPoints[0].m_PointX == m_pPoints[2].m_PointX && 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_AffineMatrix* pMatrix, CFX_FloatRect* pRect) const +bool CFX_PathData::IsRect(const CFX_AffineMatrix* pMatrix, CFX_FloatRect* pRect) const { if (pMatrix == NULL) { if (!IsRect()) { - return FALSE; + return false; } if (pRect) { pRect->left = m_pPoints[0].m_PointX; @@ -541,27 +541,27 @@ FX_BOOL CFX_PathData::IsRect(const CFX_AffineMatrix* pMatrix, CFX_FloatRect* pRe 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 ++) { pMatrix->Transform(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY, x[i], 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; } } } @@ -572,7 +572,7 @@ FX_BOOL CFX_PathData::IsRect(const CFX_AffineMatrix* pMatrix, CFX_FloatRect* pRe pRect->top = y[2]; pRect->Normalize(); } - return TRUE; + return true; } void CFX_PathData::Copy(const CFX_PathData &src) { diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp index ba5c5fbabb..e375288247 100644 --- a/core/src/fxge/ge/fx_ge_ps.cpp +++ b/core/src/fxge/ge/fx_ge_ps.cpp @@ -10,7 +10,7 @@ struct PSGlyph { CFX_Font* m_pFont; FX_DWORD m_GlyphIndex; - FX_BOOL m_bGlyphAdjust; + bool m_bGlyphAdjust; FX_FLOAT m_AdjustMatrix[4]; }; class CPSFont @@ -22,8 +22,8 @@ public: CFX_PSRenderer::CFX_PSRenderer() { m_pOutput = NULL; - m_bColorSet = m_bGraphStateSet = FALSE; - m_bInited = FALSE; + m_bColorSet = m_bGraphStateSet = false; + m_bInited = false; } CFX_PSRenderer::~CFX_PSRenderer() { @@ -33,7 +33,7 @@ CFX_PSRenderer::~CFX_PSRenderer() } } #define OUTPUT_PS(str) m_pOutput->OutputPS(str, sizeof str-1) -void CFX_PSRenderer::Init(IFX_PSOutput* pOutput, int pslevel, int width, int height, FX_BOOL bCmykOutput) +void CFX_PSRenderer::Init(IFX_PSOutput* pOutput, int pslevel, int width, int height, bool bCmykOutput) { m_PSLevel = pslevel; m_pOutput = pOutput; @@ -42,10 +42,10 @@ void CFX_PSRenderer::Init(IFX_PSOutput* pOutput, int pslevel, int width, int hei m_ClipBox.bottom = height; m_bCmykOutput = bCmykOutput; } -FX_BOOL CFX_PSRenderer::StartRendering() +bool CFX_PSRenderer::StartRendering() { if (m_bInited) { - return TRUE; + return true; } static const char init_str[] = "\nsave\n/im/initmatrix load def\n" "/n/newpath load def/m/moveto load def/l/lineto load def/c/curveto load def/h/closepath load def\n" @@ -57,15 +57,15 @@ FX_BOOL CFX_PSRenderer::StartRendering() "/cm/concat load def/Cm/currentmatrix load def/mx/matrix load def/sm/setmatrix load def\n" ; OUTPUT_PS(init_str); - m_bInited = TRUE; - return TRUE; + m_bInited = true; + return true; } void CFX_PSRenderer::EndRendering() { if (m_bInited) { OUTPUT_PS("\nrestore\n"); } - m_bInited = FALSE; + m_bInited = false; } void CFX_PSRenderer::SaveState() { @@ -73,7 +73,7 @@ void CFX_PSRenderer::SaveState() OUTPUT_PS("q\n"); m_ClipBoxStack.Add(m_ClipBox); } -void CFX_PSRenderer::RestoreState(FX_BOOL bKeepSaved) +void CFX_PSRenderer::RestoreState(bool bKeepSaved) { StartRendering(); if (bKeepSaved) { @@ -81,7 +81,7 @@ void CFX_PSRenderer::RestoreState(FX_BOOL bKeepSaved) } else { OUTPUT_PS("Q\n"); } - m_bColorSet = m_bGraphStateSet = FALSE; + m_bColorSet = m_bGraphStateSet = false; m_ClipBox = m_ClipBoxStack.GetAt(m_ClipBoxStack.GetSize() - 1); if (!bKeepSaved) { m_ClipBoxStack.RemoveAt(m_ClipBoxStack.GetSize() - 1); @@ -175,7 +175,7 @@ void CFX_PSRenderer::SetClip_PathStroke(const CFX_PathData* pPathData, OUTPUT_PS("strokepath W n\n"); } } -FX_BOOL CFX_PSRenderer::DrawPath(const CFX_PathData* pPathData, +bool CFX_PSRenderer::DrawPath(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState, FX_DWORD fill_color, @@ -189,13 +189,13 @@ FX_BOOL CFX_PSRenderer::DrawPath(const CFX_PathData* pPathData, int fill_alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(fill_color); int stroke_alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_STROKE(alpha_flag) : FXARGB_A(stroke_color); if (fill_alpha && fill_alpha < 255) { - return FALSE; + return false; } if (stroke_alpha && stroke_alpha < 255) { - return FALSE; + return false; } if (fill_alpha == 0 && stroke_alpha == 0) { - return FALSE; + return false; } if (stroke_alpha) { SetGraphState(pGraphState); @@ -233,7 +233,7 @@ FX_BOOL CFX_PSRenderer::DrawPath(const CFX_PathData* pPathData, } } OUTPUT_PS("\n"); - return TRUE; + return true; } void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState) { @@ -259,7 +259,7 @@ void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState) buf << pGraphState->m_MiterLimit << FX_BSTRC(" M\n"); } m_CurGraphState.Copy(*pGraphState); - m_bGraphStateSet = TRUE; + m_bGraphStateSet = true; if (buf.GetSize()) { m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } @@ -305,7 +305,7 @@ static void PSCompressData(int PSLevel, uint8_t* src_buf, FX_DWORD src_size, } } } -FX_BOOL CFX_PSRenderer::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD color, int left, int top, +bool CFX_PSRenderer::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD color, int left, int top, int alpha_flag, void* pIccTransform) { StartRendering(); @@ -313,7 +313,7 @@ FX_BOOL CFX_PSRenderer::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD color, (FX_FLOAT)(left), (FX_FLOAT)(top + pSource->GetHeight())); return DrawDIBits(pSource, color, &matrix, 0, alpha_flag, pIccTransform); } -FX_BOOL CFX_PSRenderer::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD color, int dest_left, int dest_top, +bool CFX_PSRenderer::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD color, int dest_left, int dest_top, int dest_width, int dest_height, FX_DWORD flags, int alpha_flag, void* pIccTransform) { @@ -322,20 +322,20 @@ FX_BOOL CFX_PSRenderer::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD col (FX_FLOAT)(dest_left), (FX_FLOAT)(dest_top + dest_height)); return DrawDIBits(pSource, color, &matrix, flags, alpha_flag, pIccTransform); } -FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, +bool CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, const CFX_AffineMatrix* pMatrix, FX_DWORD flags, int alpha_flag, void* pIccTransform) { StartRendering(); if ((pMatrix->a == 0 && pMatrix->b == 0) || (pMatrix->c == 0 && pMatrix->d == 0)) { - return TRUE; + return true; } if (pSource->HasAlpha()) { - return FALSE; + return false; } int alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_FILL(color) : FXARGB_A(color); if (pSource->IsAlphaMask() && (alpha < 255 || pSource->GetBPP() != 1)) { - return FALSE; + return false; } OUTPUT_PS("q\n"); CFX_ByteTextBuf buf; @@ -358,7 +358,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, FaxCompressData(src_buf, width, height, output_buf, output_size); if (pSource->IsAlphaMask()) { SetColor(color, alpha_flag, pIccTransform); - m_bColorSet = FALSE; + m_bColorSet = false; buf << FX_BSTRC(" true["); } else { buf << FX_BSTRC(" 1["); @@ -406,7 +406,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, } if (pConverted == NULL) { OUTPUT_PS("\nQ\n"); - return FALSE; + return false; } int Bpp = pConverted->GetBPP() / 8; uint8_t* output_buf = NULL; @@ -462,14 +462,14 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, FX_Free(output_buf); } OUTPUT_PS("\nQ\n"); - return TRUE; + return true; } void CFX_PSRenderer::SetColor(FX_DWORD color, int alpha_flag, void* pIccTransform) { if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { pIccTransform = NULL; } - FX_BOOL bCMYK = FALSE; + bool bCMYK = false; if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); @@ -490,7 +490,7 @@ void CFX_PSRenderer::SetColor(FX_DWORD color, int alpha_flag, void* pIccTransfor << FXARGB_B(color) / 255.0 << FX_BSTRC(" rg\n"); } if (bCMYK == m_bCmykOutput) { - m_bColorSet = TRUE; + m_bColorSet = true; m_LastColor = color; } m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); @@ -588,7 +588,7 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, CFX_Font* pFont, << FX_BSTRC("/") << ps_glyphindex << FX_BSTRC(" put\n"); m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } -FX_BOOL CFX_PSRenderer::DrawText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, +bool CFX_PSRenderer::DrawText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, int alpha_flag, void* pIccTransform) @@ -596,10 +596,10 @@ FX_BOOL CFX_PSRenderer::DrawText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX StartRendering(); int alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); if (alpha < 255) { - return FALSE; + return false; } if ((pObject2Device->a == 0 && pObject2Device->b == 0) || (pObject2Device->c == 0 && pObject2Device->d == 0)) { - return TRUE; + return true; } SetColor(color, alpha_flag, pIccTransform); CFX_ByteTextBuf buf; @@ -628,7 +628,7 @@ FX_BOOL CFX_PSRenderer::DrawText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX } buf << FX_BSTRC("Q\n"); m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); - return TRUE; + return true; } void CFX_PSRenderer::WritePSBinary(const uint8_t* data, int len) { diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index 59a4cfb37d..c5da66a4ce 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -46,7 +46,7 @@ private: FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, int nChars, int anti_alias, FX_FLOAT retinaScaleX, FX_FLOAT retinaScaleY) { FX_RECT rect(0, 0, 0, 0); - FX_BOOL bStarted = FALSE; + bool bStarted = false; for (int iChar = 0; iChar < nChars; iChar ++) { FXTEXT_GLYPHPOS& glyph = pGlyphAndPos[iChar]; const CFX_GlyphBitmap* pGlyph = glyph.m_pGlyph; @@ -66,7 +66,7 @@ FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, int nChars, int anti_a rect.right = char_right; rect.top = char_top; rect.bottom = char_bottom; - bStarted = TRUE; + bStarted = true; } else { if (rect.left > char_left) { rect.left = char_left; @@ -87,9 +87,9 @@ FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, int nChars, int anti_a static void _AdjustGlyphSpace(FXTEXT_GLYPHPOS* pGlyphAndPos, int nChars) { ASSERT(nChars > 1); - FX_BOOL bVertical = FALSE; + bool bVertical = false; if (pGlyphAndPos[nChars - 1].m_OriginX == pGlyphAndPos[0].m_OriginX) { - bVertical = TRUE; + bVertical = true; } else if (pGlyphAndPos[nChars - 1].m_OriginY != pGlyphAndPos[0].m_OriginY) { return; } @@ -155,7 +155,7 @@ void _Color2Argb(FX_ARGB& argb, FX_DWORD color, int alpha_flag, void* pIccTransf bgra[3] = (alpha_flag >> 24) ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXGETFLAG_ALPHA_STROKE(alpha_flag); argb = FXARGB_MAKE(bgra[3], bgra[2], bgra[1], bgra[0]); } -FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pCharPos, +bool CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, FX_FLOAT font_size, const CFX_AffineMatrix* pText2Device, FX_DWORD fill_color, FX_DWORD text_flags, @@ -171,12 +171,12 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar #endif #endif if (m_pDeviceDriver->DrawDeviceText(nChars, pCharPos, pFont, pCache, pText2Device, font_size, fill_color, alpha_flag, pIccTransform)) { - return TRUE; + return true; } } int alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(fill_color); if (alpha < 255) { - return FALSE; + return false; } } else if (!(text_flags & FXTEXT_NO_NATIVETEXT)) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ @@ -186,7 +186,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar #endif #endif if (m_pDeviceDriver->DrawDeviceText(nChars, pCharPos, pFont, pCache, pText2Device, font_size, fill_color, alpha_flag, pIccTransform)) { - return TRUE; + return true; } } CFX_AffineMatrix char2device, deviceCtm, text2Device; @@ -204,24 +204,24 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar } } int anti_alias = FXFT_RENDER_MODE_MONO; - FX_BOOL bNormal = FALSE; + bool bNormal = false; if ((text_flags & FXTEXT_NOSMOOTH) == 0) { if (m_DeviceClass == FXDC_DISPLAY && m_bpp > 1) { - FX_BOOL bClearType; + bool bClearType; if (pFont->GetFace() == NULL && !(pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_CLEARTYPE)) { - bClearType = FALSE; + bClearType = false; } else { bClearType = text_flags & FXTEXT_CLEARTYPE; } if ((m_RenderCaps & (FXRC_ALPHA_OUTPUT | FXRC_CMYK_OUTPUT))) { anti_alias = FXFT_RENDER_MODE_LCD; - bNormal = TRUE; + bNormal = true; } else if (m_bpp < 16) { anti_alias = FXFT_RENDER_MODE_NORMAL; } else { - if (bClearType == FALSE) { + if (bClearType == false) { anti_alias = FXFT_RENDER_MODE_LCD; - bNormal = TRUE; + bNormal = true; } else { anti_alias = FXFT_RENDER_MODE_LCD; } @@ -278,7 +278,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar bmp_rect.Intersect(m_ClipBox); if (bmp_rect.IsEmpty()) { FX_Free(pGlyphAndPos); - return TRUE; + return true; } int pixel_width = FXSYS_round(bmp_rect.Width() * scale_x); int pixel_height = FXSYS_round(bmp_rect.Height() * scale_y); @@ -288,7 +288,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar CFX_DIBitmap bitmap; if (!bitmap.Create(pixel_width, pixel_height, FXDIB_1bppMask)) { FX_Free(pGlyphAndPos); - return FALSE; + return false; } bitmap.Clear(0); for (iChar = 0; iChar < nChars; iChar ++) { @@ -308,19 +308,19 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar if (m_bpp == 8) { if (!bitmap.Create(pixel_width, pixel_height, FXDIB_8bppMask)) { FX_Free(pGlyphAndPos); - return FALSE; + return false; } } else { if (!CreateCompatibleBitmap(&bitmap, pixel_width, pixel_height)) { FX_Free(pGlyphAndPos); - return FALSE; + return false; } } if (!bitmap.HasAlpha() && !bitmap.IsAlphaMask()) { bitmap.Clear(0xFFFFFFFF); if (!GetDIBits(&bitmap, bmp_rect.left, bmp_rect.top)) { FX_Free(pGlyphAndPos); - return FALSE; + return false; } } else { bitmap.Clear(0); @@ -352,13 +352,13 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar int nrows = pGlyph->GetHeight(); if (anti_alias == FXFT_RENDER_MODE_NORMAL) { if (!bitmap.CompositeMask(left, top, ncols, nrows, pGlyph, fill_color, - 0, 0, FXDIB_BLEND_NORMAL, NULL, FALSE, alpha_flag, pIccTransform)) { + 0, 0, FXDIB_BLEND_NORMAL, NULL, false, alpha_flag, pIccTransform)) { FX_Free(pGlyphAndPos); - return FALSE; + return false; } continue; } - FX_BOOL bBGRStripe = text_flags & FXTEXT_BGR_STRIPE; + bool bBGRStripe = text_flags & FXTEXT_BGR_STRIPE; ncols /= 3; int x_subpixel = (int)(glyph.m_fOriginX * 3) % 3; uint8_t* src_buf = pGlyph->GetBuffer(); @@ -945,9 +945,9 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar SetDIBits(&bitmap, bmp_rect.left, bmp_rect.top); } FX_Free(pGlyphAndPos); - return TRUE; + return true; } -FX_BOOL CFX_RenderDevice::DrawTextPath(int nChars, const FXTEXT_CHARPOS* pCharPos, +bool CFX_RenderDevice::DrawTextPath(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, FX_FLOAT font_size, const CFX_AffineMatrix* pText2User, const CFX_AffineMatrix* pUser2Device, const CFX_GraphStateData* pGraphState, @@ -973,7 +973,7 @@ FX_BOOL CFX_RenderDevice::DrawTextPath(int nChars, const FXTEXT_CHARPOS* pCharPo matrix.Concat(*pText2User); CFX_PathData TransformedPath(*pPath); TransformedPath.Transform(&matrix); - FX_BOOL bHasAlpha = FXGETFLAG_COLORTYPE(alpha_flag) ? + bool bHasAlpha = FXGETFLAG_COLORTYPE(alpha_flag) ? (FXGETFLAG_ALPHA_FILL(alpha_flag) || FXGETFLAG_ALPHA_STROKE(alpha_flag)) : (fill_color || stroke_color); if (bHasAlpha) { @@ -989,24 +989,24 @@ FX_BOOL CFX_RenderDevice::DrawTextPath(int nChars, const FXTEXT_CHARPOS* pCharPo } fill_mode |= FX_FILL_TEXT_MODE; if (!DrawPath(&TransformedPath, pUser2Device, pGraphState, fill_color, stroke_color, fill_mode, alpha_flag, pIccTransform, blend_type)) { - return FALSE; + return false; } } if (pClippingPath) { pClippingPath->Append(&TransformedPath, pUser2Device); } } - return TRUE; + return true; } CFX_FontCache::~CFX_FontCache() { - FreeCache(TRUE); + FreeCache(true); } CFX_FaceCache* CFX_FontCache::GetCachedFace(CFX_Font* pFont) { FXFT_Face internal_face = pFont->GetFace(); - const FX_BOOL bExternal = internal_face == nullptr; + const bool bExternal = internal_face == nullptr; FXFT_Face face = bExternal ? (FXFT_Face)pFont->GetSubstFont()->m_ExtHandle : internal_face; CFX_FTCacheMap& map = bExternal ? m_ExtFaceMap : m_FTFaceMap; @@ -1028,7 +1028,7 @@ CFX_FaceCache* CFX_FontCache::GetCachedFace(CFX_Font* pFont) void CFX_FontCache::ReleaseCachedFace(CFX_Font* pFont) { FXFT_Face internal_face = pFont->GetFace(); - const FX_BOOL bExternal = internal_face == nullptr; + const bool bExternal = internal_face == nullptr; FXFT_Face face = bExternal ? (FXFT_Face)pFont->GetSubstFont()->m_ExtHandle : internal_face; CFX_FTCacheMap& map = bExternal ? m_ExtFaceMap : m_FTFaceMap; @@ -1043,7 +1043,7 @@ void CFX_FontCache::ReleaseCachedFace(CFX_Font* pFont) } } -void CFX_FontCache::FreeCache(FX_BOOL bRelease) +void CFX_FontCache::FreeCache(bool bRelease) { for (auto it = m_FTFaceMap.begin(); it != m_FTFaceMap.end();) { auto curr_it = it++; @@ -1095,7 +1095,7 @@ void CFX_FaceCache::InitPlatform() } #endif CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap(CFX_Font* pFont, const CFX_AffineMatrix* pMatrix, - CFX_ByteStringC& FaceGlyphsKey, FX_DWORD glyph_index, FX_BOOL bFontStyle, + CFX_ByteStringC& FaceGlyphsKey, FX_DWORD glyph_index, bool bFontStyle, int dest_width, int anti_alias) { CFX_SizeGlyphCache* pSizeCache = NULL; @@ -1114,7 +1114,7 @@ CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap(CFX_Font* pFont, const CFX_Aff pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); return pGlyphBitmap; } -const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD glyph_index, FX_BOOL bFontStyle, const CFX_AffineMatrix* pMatrix, +const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD glyph_index, bool bFontStyle, const CFX_AffineMatrix* pMatrix, int dest_width, int anti_alias, int& text_flags) { if (glyph_index == (FX_DWORD) - 1) { @@ -1311,7 +1311,7 @@ static void _ContrastAdjust(uint8_t* pDataIn, uint8_t* pDataOut, int nWid, int n } } } -CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_index, FX_BOOL bFontStyle, +CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_index, bool bFontStyle, const CFX_AffineMatrix* pMatrix, int dest_width, int anti_alias) { if (m_Face == NULL) { @@ -1322,7 +1322,7 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde ft_matrix.xy = (signed long)(pMatrix->GetC() / 64 * 65536); ft_matrix.yx = (signed long)(pMatrix->GetB() / 64 * 65536); ft_matrix.yy = (signed long)(pMatrix->GetD() / 64 * 65536); - FX_BOOL bUseCJKSubFont = FALSE; + bool bUseCJKSubFont = false; const CFX_SubstFont* pSubstFont = pFont->GetSubstFont(); if (pSubstFont) { bUseCJKSubFont = pSubstFont->m_bSubstOfCJK && bFontStyle; @@ -1422,18 +1422,18 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde } return pGlyphBitmap; } -FX_BOOL _OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, +bool _OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, int glyph_index, FX_ARGB argb) { CFX_DIBitmap* pDib = (CFX_DIBitmap*)dib; FXFT_Face face = pFont->GetFace(); int error = FXFT_Load_Glyph(face, glyph_index, FXFT_LOAD_NO_BITMAP); if (error) { - return FALSE; + return false; } error = FXFT_Render_Glyph(face, FXFT_RENDER_MODE_NORMAL); if (error) { - return FALSE; + return false; } int bmwidth = FXFT_Get_Bitmap_Width(FXFT_Get_Glyph_Bitmap(face)); int bmheight = FXFT_Get_Bitmap_Rows(FXFT_Get_Glyph_Bitmap(face)); @@ -1451,13 +1451,13 @@ FX_BOOL _OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, FXSYS_memcpy(dest_scan, src_scan, dest_pitch); } pDib->CompositeMask(x + left, y - top, bmwidth, bmheight, &mask, argb, 0, 0); - return TRUE; + return true; } -FX_BOOL OutputText(void* dib, int x, int y, CFX_Font* pFont, double font_size, +bool OutputText(void* dib, int x, int y, CFX_Font* pFont, double font_size, CFX_AffineMatrix* pText_matrix, unsigned short const* text, unsigned long argb) { if (!pFont) { - return FALSE; + return false; } FXFT_Face face = pFont->GetFace(); FXFT_Select_Charmap(pFont->m_Face, FXFT_ENCODING_UNICODE); @@ -1490,9 +1490,9 @@ FX_BOOL OutputText(void* dib, int x, int y, CFX_Font* pFont, double font_size, } if (pText_matrix) ResetTransform(face); - return TRUE; + return true; } -FX_BOOL OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, double font_size, +bool OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, double font_size, CFX_AffineMatrix* pMatrix, unsigned long glyph_index, unsigned long argb) { FXFT_Matrix ft_matrix; @@ -1507,7 +1507,7 @@ FX_BOOL OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, double font_size, ft_matrix.yy = (signed long)(font_size / 64 * 65536); } ScopedFontTransform scoped_transform(pFont->m_Face, &ft_matrix); - FX_BOOL ret = _OutputGlyph(dib, x, y, pFont, + bool ret = _OutputGlyph(dib, x, y, pFont, glyph_index, argb); return ret; } @@ -1533,7 +1533,7 @@ const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph return pGlyphPath; } typedef struct { - FX_BOOL m_bCount; + bool m_bCount; int m_PointCount; FX_PATHPOINT* m_pPoints; int m_CurX; @@ -1684,7 +1684,7 @@ CFX_PathData* CFX_Font::LoadGlyphPath(FX_DWORD glyph_index, int dest_width) 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) { @@ -1692,7 +1692,7 @@ CFX_PathData* CFX_Font::LoadGlyphPath(FX_DWORD glyph_index, int dest_width) } 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; diff --git a/core/src/fxge/ge/text_int.h b/core/src/fxge/ge/text_int.h index 12fac6a60a..2e861baf1b 100644 --- a/core/src/fxge/ge/text_int.h +++ b/core/src/fxge/ge/text_int.h @@ -32,12 +32,12 @@ public: m_RefCount = 0; } ~CTTFontDesc(); - FX_BOOL ReleaseFace(FXFT_Face face); + bool ReleaseFace(FXFT_Face face); int m_Type; union { struct { - FX_BOOL m_bItalic; - FX_BOOL m_bBold; + bool m_bItalic; + bool m_bBold; FXFT_Face m_pFace; } m_SingleFace; struct { @@ -63,9 +63,9 @@ private: { return Unicode; } - virtual FX_BOOL IsUnicodeCompatible() const + virtual bool IsUnicodeCompatible() const { - return TRUE; + return true; } }; #define CHARSET_FLAG_ANSI 1 @@ -97,7 +97,7 @@ public: FX_DWORD m_FileSize; FX_DWORD m_FontOffset; int m_Weight; - FX_BOOL m_bItalic; + bool m_bItalic; int m_PitchFamily; CFX_ByteString m_FontTables; }; diff --git a/core/src/fxge/skia/fx_skia_blitter_new.cpp b/core/src/fxge/skia/fx_skia_blitter_new.cpp index 3437eb497d..13bb753e45 100644 --- a/core/src/fxge/skia/fx_skia_blitter_new.cpp +++ b/core/src/fxge/skia/fx_skia_blitter_new.cpp @@ -1298,7 +1298,7 @@ //-------------------------------------------------------------------- - FX_BOOL CFX_SkiaRenderer::Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDevice, const CFX_ClipRgn* pClipRgn, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bRgbByteOrder, + bool CFX_SkiaRenderer::Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDevice, const CFX_ClipRgn* pClipRgn, FX_DWORD color, bool bFullCover, bool bRgbByteOrder, int alpha_flag, void* pIccTransform) //The alpha flag must be fill_flag if exist. { m_pDevice = pDevice; @@ -1331,8 +1331,8 @@ 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); @@ -1377,7 +1377,7 @@ pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&m_Color, 1); } else { // Object RGB if (!pIccTransform) - return FALSE; + return false; color = FXARGB_TODIB(color); pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1); } @@ -1385,7 +1385,7 @@ m_Green = ((uint8_t*)&m_Color)[1]; m_Blue = ((uint8_t*)&m_Color)[2]; m_Gray = ((uint8_t*)&m_Color)[3]; - return TRUE; + return true; } if (pIccTransform) { color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); @@ -1496,8 +1496,8 @@ break; } if (composite_span == NULL) - return FALSE; - return TRUE; + return false; + return true; } /*----------------------------------------------------------------------------------------------------*/ @@ -1595,7 +1595,7 @@ blitV(x, y, height, rightAlpha); } - FX_BOOL CFX_SkiaA8Renderer::Init(CFX_DIBitmap* pDevice, int Left, int Top) + bool CFX_SkiaA8Renderer::Init(CFX_DIBitmap* pDevice, int Left, int Top) { m_pDevice = pDevice; m_Left = Left; @@ -1604,6 +1604,6 @@ m_dstWidth = m_Left + pDevice->GetWidth(); m_dstHeight = m_Top + pDevice->GetHeight(); } - return TRUE; + return true; } #endif diff --git a/core/src/fxge/skia/fx_skia_blitter_new.h b/core/src/fxge/skia/fx_skia_blitter_new.h index e60c6398d2..cd411da9f5 100644 --- a/core/src/fxge/skia/fx_skia_blitter_new.h +++ b/core/src/fxge/skia/fx_skia_blitter_new.h @@ -15,9 +15,9 @@ protected: m_Blue, // Yellow m_Gray; // Black FX_DWORD m_Color; // FX_ARGB or FX_CMYK - FX_BOOL m_bFullCover; + bool m_bFullCover; int m_ProcessFilter; - FX_BOOL m_bRgbByteOrder; + bool m_bRgbByteOrder; FX_RECT m_ClipBox; CFX_DIBitmap* m_pDevice; @@ -205,7 +205,7 @@ public: //-------------------------------------------------------------------- - FX_BOOL Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDevice, const CFX_ClipRgn* pClipRgn, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bRgbByteOrder, + bool Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDevice, const CFX_ClipRgn* pClipRgn, FX_DWORD color, bool bFullCover, bool bRgbByteOrder, int alpha_flag = 0, void* pIccTransform = NULL); //The alpha flag must be fill_flag if exist. }; class CFX_SkiaA8Renderer : public SkBlitter @@ -218,7 +218,7 @@ public: virtual void blitRect(int x, int y, int width, int height); virtual void blitAntiRect(int x, int y, int width, int height, SkAlpha leftAlpha, SkAlpha rightAlpha); //-------------------------------------------------------------------- - FX_BOOL Init(CFX_DIBitmap* pDevice, int Left, int Top); + bool Init(CFX_DIBitmap* pDevice, int Left, int Top); CFX_DIBitmap* m_pDevice; int m_Left; int m_Top; diff --git a/core/src/fxge/skia/fx_skia_device.cpp b/core/src/fxge/skia/fx_skia_device.cpp index 41ce077976..72478b1097 100644 --- a/core/src/fxge/skia/fx_skia_device.cpp +++ b/core/src/fxge/skia/fx_skia_device.cpp @@ -46,24 +46,24 @@ class SuperBlitter_skia public: static void DrawPath(const SkPath& srcPath, SkBlitter* blitter, const SkRasterClip& rect, const SkPaint& origPaint); }; -FX_BOOL FxSkDrawTreatAsHairline(const SkPaint& paint, SkScalar* coverage) { +bool FxSkDrawTreatAsHairline(const SkPaint& paint, SkScalar* coverage) { if (SkPaint::kStroke_Style != paint.getStyle()) - return FALSE; + return false; FXSYS_assert(coverage); SkScalar strokeWidth = paint.getStrokeWidth(); if (0 == strokeWidth) { *coverage = SK_Scalar1; - return TRUE; + return true; } // if we get here, we need to try to fake a thick-stroke with a modulated // hairline if (!paint.isAntiAlias()) - return FALSE; + return false; if (strokeWidth <= SK_Scalar1) { *coverage = strokeWidth; - return TRUE; + return true; } - return FALSE; + return false; } void SuperBlitter_skia::DrawPath(const SkPath& srcPath, SkBlitter* blitter, const SkRasterClip& rect, const SkPaint& origPaint) @@ -167,7 +167,7 @@ void CSkia_PathData::BuildPath(const CFX_PathData* pPathData, const CFX_AffineMa static void SkRasterizeStroke(SkPaint& spaint, SkPath* dstPathData, SkPath& path_data, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState, FX_FIXFLOAT scale = FIX8_ONE, - FX_BOOL bStrokeAdjust = FALSE, FX_BOOL bTextMode = FALSE) + bool bStrokeAdjust = false, bool bTextMode = false) { SkPaint::Cap cap; switch (pGraphState->m_LineCap) { @@ -203,7 +203,7 @@ static void SkRasterizeStroke(SkPaint& spaint, SkPath* dstPathData, SkPath& path stroker.setJoin(join); stroker.setMiterLimit(pGraphState->m_MiterLimit); stroker.setWidth(width); - stroker.setDoFill(FALSE); + stroker.setDoFill(false); stroker.strokePath(path_data, dstPathData); SkMatrix smatrix; smatrix.setAll(pObject2Device->a, pObject2Device->c, pObject2Device->e, pObject2Device->b, pObject2Device->d, pObject2Device->f, 0, 0, 1); @@ -235,7 +235,7 @@ static void SkRasterizeStroke(SkPaint& spaint, SkPath* dstPathData, SkPath& path } } -CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) +CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, bool bRgbByteOrder, CFX_DIBitmap* pOriDevice, bool bGroupKnockout) { m_pAggDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, pOriDevice, bGroupKnockout); } @@ -243,7 +243,7 @@ CFX_SkiaDeviceDriver::~CFX_SkiaDeviceDriver() { delete m_pAggDriver; } -FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, +bool CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FIXFLOAT font_size, FX_DWORD color, int alpha_flag, void* pIccTransform) { @@ -259,7 +259,7 @@ void CFX_SkiaDeviceDriver::SaveState() m_pAggDriver->SaveState(); } -void CFX_SkiaDeviceDriver::RestoreState(FX_BOOL bKeepSaved) +void CFX_SkiaDeviceDriver::RestoreState(bool bKeepSaved) { m_pAggDriver->RestoreState(bKeepSaved); } @@ -294,7 +294,7 @@ void CFX_SkiaDeviceDriver::SetClipMask(SkPath& skPath, SkPaint* spaint) m_pAggDriver->m_pClipRgn->IntersectMaskF(clip_box.fLeft, clip_box.fTop, mask); } -FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, // path info +bool CFX_SkiaDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, // path info const CFX_AffineMatrix* pObject2Device, // optional transformation int fill_mode // fill mode, WINDING or ALTERNATE ) @@ -308,7 +308,7 @@ FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, // rectf.Intersect(CFX_FloatRect(0, 0, (FX_FIXFLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH), (FX_FIXFLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT))); FX_RECT rect = rectf.GetOutterRect(); m_pAggDriver->m_pClipRgn->IntersectRect(rect); - return TRUE; + return true; } } CSkia_PathData path_data; @@ -318,15 +318,15 @@ FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, // SkPaint spaint; spaint.setColor(0xffffffff); - spaint.setAntiAlias(TRUE); + spaint.setAntiAlias(true); spaint.setStyle(SkPaint::kFill_Style); SetClipMask(path_data.m_PathData, &spaint); - return TRUE; + return true; } -FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData, // path info +bool CFX_SkiaDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData, // path info const CFX_AffineMatrix* pObject2Device, // optional transformation const CFX_GraphStateData* pGraphState // graphic state, for pen attributes ) @@ -342,36 +342,36 @@ FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData, SkPaint spaint; spaint.setColor(0xffffffff); spaint.setStyle(SkPaint::kStroke_Style); - spaint.setAntiAlias(TRUE); + spaint.setAntiAlias(true); SkPath dst_path; - SkRasterizeStroke(spaint, &dst_path, path_data.m_PathData, pObject2Device, pGraphState, 1, FALSE, 0); + SkRasterizeStroke(spaint, &dst_path, path_data.m_PathData, pObject2Device, pGraphState, 1, false, 0); spaint.setStyle(SkPaint::kFill_Style); SetClipMask(dst_path, &spaint); - return TRUE; + return true; } -FX_BOOL CFX_SkiaDeviceDriver::RenderRasterizer(rasterizer_scanline_aa& rasterizer, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout, +bool CFX_SkiaDeviceDriver::RenderRasterizer(rasterizer_scanline_aa& rasterizer, FX_DWORD color, bool bFullCover, bool bGroupKnockout, int alpha_flag, void* pIccTransform) { return m_pAggDriver->RenderRasterizer(rasterizer, color, bFullCover, bGroupKnockout,alpha_flag, pIccTransform); } -FX_BOOL CFX_SkiaDeviceDriver::RenderRasterizerSkia(SkPath& skPath, const SkPaint& origPaint, SkIRect& rect, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout, - int alpha_flag, void* pIccTransform, FX_BOOL bFill) +bool CFX_SkiaDeviceDriver::RenderRasterizerSkia(SkPath& skPath, const SkPaint& origPaint, SkIRect& rect, FX_DWORD color, bool bFullCover, bool bGroupKnockout, + int alpha_flag, void* pIccTransform, bool bFill) { CFX_DIBitmap* pt = bGroupKnockout?m_pAggDriver->GetBackDrop():NULL; CFX_SkiaRenderer render; if (!render.Init(m_pAggDriver->m_pBitmap, pt, m_pAggDriver->m_pClipRgn, color, bFullCover, m_pAggDriver->m_bRgbByteOrder, alpha_flag, pIccTransform)) - return FALSE; + return false; SkRasterClip rasterClip(rect); SuperBlitter_skia::DrawPath(skPath, (SkBlitter*)&render, rasterClip, origPaint); - return TRUE; + return true; } -FX_BOOL CFX_SkiaDeviceDriver::DrawPath(const CFX_PathData* pPathData, // path info +bool CFX_SkiaDeviceDriver::DrawPath(const CFX_PathData* pPathData, // path info const CFX_AffineMatrix* pObject2Device, // optional transformation const CFX_GraphStateData* pGraphState, // graphic state, for pen attributes FX_DWORD fill_color, // fill color @@ -381,7 +381,7 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawPath(const CFX_PathData* pPathData, // path in void* pIccTransform ) { - if (GetBuffer() == NULL) return TRUE; + if (GetBuffer() == NULL) return true; FOXIT_DEBUG1("CFX_SkiaDeviceDriver::DrawPath: entering"); SkIRect rect; rect.set(0, 0, GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); @@ -396,11 +396,11 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawPath(const CFX_PathData* pPathData, // path in path_data.m_PathData.setFillType((fill_mode&3) == FXFILL_WINDING? SkPath::kWinding_FillType:SkPath::kEvenOdd_FillType); SkPaint spaint; - spaint.setAntiAlias(TRUE); + spaint.setAntiAlias(true); spaint.setStyle(SkPaint::kFill_Style); spaint.setColor(fill_color); - if (!RenderRasterizerSkia(path_data.m_PathData, spaint, rect, fill_color, fill_mode & FXFILL_FULLCOVER, FALSE, alpha_flag, pIccTransform)) - return FALSE; + if (!RenderRasterizerSkia(path_data.m_PathData, spaint, rect, fill_color, fill_mode & FXFILL_FULLCOVER, false, alpha_flag, pIccTransform)) + return false; } int stroke_alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_STROKE(alpha_flag) : FXARGB_A(stroke_color); @@ -427,48 +427,48 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawPath(const CFX_PathData* pPathData, // path in SkPaint spaint; spaint.setColor(stroke_color); spaint.setStyle(SkPaint::kStroke_Style); - spaint.setAntiAlias(TRUE); + spaint.setAntiAlias(true); SkPath dst_path; - SkRasterizeStroke(spaint, &dst_path, path_data.m_PathData, &matrix2, pGraphState, matrix1.a, FALSE, 0); + SkRasterizeStroke(spaint, &dst_path, path_data.m_PathData, &matrix2, pGraphState, matrix1.a, false, 0); spaint.setStyle(SkPaint::kFill_Style); int fill_flag = FXGETFLAG_COLORTYPE(alpha_flag)<<8 | FXGETFLAG_ALPHA_STROKE(alpha_flag); - if (!RenderRasterizerSkia(dst_path, spaint, rect, stroke_color, fill_mode & FXFILL_FULLCOVER, FALSE, fill_flag, pIccTransform, FALSE)) - return FALSE; + if (!RenderRasterizerSkia(dst_path, spaint, rect, stroke_color, fill_mode & FXFILL_FULLCOVER, false, fill_flag, pIccTransform, false)) + return false; } - return TRUE; + return true; } -FX_BOOL CFX_SkiaDeviceDriver::SetPixel(int x, int y, FX_DWORD color, +bool CFX_SkiaDeviceDriver::SetPixel(int x, int y, FX_DWORD color, int alpha_flag, void* pIccTransform) { return m_pAggDriver->SetPixel(x, y, color, alpha_flag, pIccTransform); } -FX_BOOL CFX_SkiaDeviceDriver::FillRect(const FX_RECT* pRect, FX_DWORD fill_color, int alpha_flag, void* pIccTransform) +bool CFX_SkiaDeviceDriver::FillRect(const FX_RECT* pRect, FX_DWORD fill_color, int alpha_flag, void* pIccTransform) { return m_pAggDriver->FillRect(pRect, fill_color, alpha_flag, pIccTransform); } -FX_BOOL CFX_SkiaDeviceDriver::GetClipBox(FX_RECT* pRect) +bool CFX_SkiaDeviceDriver::GetClipBox(FX_RECT* pRect) { return m_pAggDriver->GetClipBox(pRect); } -FX_BOOL CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform, FX_BOOL bDEdge) +bool CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform, bool bDEdge) { return m_pAggDriver->GetDIBits(pBitmap, left, top, pIccTransform, bDEdge); } -FX_BOOL CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD argb, const FX_RECT* pSrcRect, int left, int top, int blend_type, +bool CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD argb, const FX_RECT* pSrcRect, int left, int top, int blend_type, int alpha_flag, void* pIccTransform) { return m_pAggDriver->SetDIBits(pBitmap, argb, pSrcRect, left, top, blend_type, alpha_flag, pIccTransform); } -FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD argb, int dest_left, int dest_top, +bool CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD argb, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform) { @@ -477,7 +477,7 @@ FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWO alpha_flag, pIccTransform); } -FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD argb, +bool CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD argb, const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform) { @@ -485,7 +485,7 @@ FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitm pMatrix, render_flags, handle, alpha_flag, pIccTransform); } -FX_BOOL CFX_SkiaDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) +bool CFX_SkiaDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) { return m_pAggDriver->ContinueDIBits(pHandle, pPause); } @@ -497,31 +497,31 @@ void CFX_SkiaDeviceDriver::CancelDIBits(void* pHandle) CFX_SkiaDevice::CFX_SkiaDevice() { - m_bOwnedBitmap = FALSE; + m_bOwnedBitmap = false; } -FX_BOOL CFX_SkiaDevice::Attach(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) +bool CFX_SkiaDevice::Attach(CFX_DIBitmap* pBitmap, int dither_bits, bool bRgbByteOrder, CFX_DIBitmap* pOriDevice, bool bGroupKnockout) { if (pBitmap == NULL) - return FALSE; + return false; SetBitmap(pBitmap); CFX_SkiaDeviceDriver* pDriver = new CFX_SkiaDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, pOriDevice, bGroupKnockout); SetDeviceDriver(pDriver); - return TRUE; + return true; } -FX_BOOL CFX_SkiaDevice::Create(int width, int height, FXDIB_Format format, int dither_bits, CFX_DIBitmap* pOriDevice) +bool CFX_SkiaDevice::Create(int width, int height, FXDIB_Format format, int dither_bits, CFX_DIBitmap* pOriDevice) { - m_bOwnedBitmap = TRUE; + m_bOwnedBitmap = true; CFX_DIBitmap* pBitmap = new CFX_DIBitmap; if (!pBitmap->Create(width, height, format)) { delete pBitmap; - return FALSE; + return false; } SetBitmap(pBitmap); - CFX_SkiaDeviceDriver* pDriver = new CFX_SkiaDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE); + CFX_SkiaDeviceDriver* pDriver = new CFX_SkiaDeviceDriver(pBitmap, dither_bits, false, pOriDevice, false); SetDeviceDriver(pDriver); - return TRUE; + return true; } CFX_SkiaDevice::~CFX_SkiaDevice() { diff --git a/core/src/fxge/skia/fx_skia_device.h b/core/src/fxge/skia/fx_skia_device.h index ab51e51a33..7278671dc7 100644 --- a/core/src/fxge/skia/fx_skia_device.h +++ b/core/src/fxge/skia/fx_skia_device.h @@ -9,7 +9,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { public: - CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout); + CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, bool bRgbByteOrder, CFX_DIBitmap* pOriDevice, bool bGroupKnockout); virtual ~CFX_SkiaDeviceDriver(); /** Options */ @@ -17,22 +17,22 @@ public: /** Save and restore all graphic states */ virtual void SaveState(); - virtual void RestoreState(FX_BOOL bKeepSaved); + virtual void RestoreState(bool bKeepSaved); /** Set clipping path using filled region */ - virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, // path info + virtual bool SetClip_PathFill(const CFX_PathData* pPathData, // path info const CFX_AffineMatrix* pObject2Device, // optional transformation int fill_mode // fill mode, WINDING or ALTERNATE ); /** Set clipping path using stroked region */ - virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, // path info + virtual bool SetClip_PathStroke(const CFX_PathData* pPathData, // path info const CFX_AffineMatrix* pObject2Device, // optional transformation const CFX_GraphStateData* pGraphState // graphic state, for pen attributes ); /** Draw a path */ - virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, + virtual bool DrawPath(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState, FX_DWORD fill_color, @@ -42,44 +42,44 @@ public: void* pIccTransform = NULL ); - virtual FX_BOOL SetPixel(int x, int y, FX_DWORD color, + virtual bool SetPixel(int x, int y, FX_DWORD color, int alpha_flag = 0, void* pIccTransform = NULL); - virtual FX_BOOL FillRect(const FX_RECT* pRect, FX_DWORD fill_color, + virtual bool FillRect(const FX_RECT* pRect, FX_DWORD fill_color, int alpha_flag = 0, void* pIccTransform = NULL); /** Draw a single pixel (device dependant) line */ - virtual FX_BOOL DrawCosmeticLine(FX_FIXFLOAT x1, FX_FIXFLOAT y1, FX_FIXFLOAT x2, FX_FIXFLOAT y2, FX_DWORD color, - int alpha_flag, void* pIccTransform, int blend_type) { return FALSE; } + virtual bool DrawCosmeticLine(FX_FIXFLOAT x1, FX_FIXFLOAT y1, FX_FIXFLOAT x2, FX_FIXFLOAT y2, FX_DWORD color, + int alpha_flag, void* pIccTransform, int blend_type) { return false; } - virtual FX_BOOL GetClipBox(FX_RECT* pRect); + virtual bool GetClipBox(FX_RECT* pRect); /** Load device buffer into a DIB */ - virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform = NULL, FX_BOOL bDEdge = FALSE); + virtual bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform = NULL, bool bDEdge = false); virtual CFX_DIBitmap* GetBackDrop() { return m_pAggDriver->GetBackDrop(); } - virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, + virtual bool SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, int dest_left, int dest_top, int blend_type, int alpha_flag = 0, void* pIccTransform = NULL); - virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, + virtual bool StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag = 0, void* pIccTransform = NULL); - virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, + virtual bool StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, const CFX_AffineMatrix* pMatrix, FX_DWORD flags, void*& handle, int alpha_flag = 0, void* pIccTransform = NULL); - virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); + 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, + virtual bool DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FIXFLOAT font_size, FX_DWORD color, int alpha_flag = 0, void* pIccTransform = NULL); - virtual FX_BOOL RenderRasterizer(rasterizer_scanline_aa& rasterizer, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout, + virtual bool RenderRasterizer(rasterizer_scanline_aa& rasterizer, FX_DWORD color, bool bFullCover, bool bGroupKnockout, int alpha_flag, void* pIccTransform); - virtual FX_BOOL RenderRasterizerSkia(SkPath& skPath, const SkPaint& origPaint, SkIRect& rect, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout, - int alpha_flag, void* pIccTransform, FX_BOOL bFill = TRUE); + virtual bool RenderRasterizerSkia(SkPath& skPath, const SkPaint& origPaint, SkIRect& rect, FX_DWORD color, bool bFullCover, bool bGroupKnockout, + int alpha_flag, void* pIccTransform, bool bFill = true); void SetClipMask(rasterizer_scanline_aa& rasterizer); void SetClipMask(SkPath& skPath, SkPaint* spaint); virtual uint8_t* GetBuffer() const {return m_pAggDriver->GetBuffer();} diff --git a/core/src/fxge/win32/dwrite_int.h b/core/src/fxge/win32/dwrite_int.h index dc2a338935..4896161547 100644 --- a/core/src/fxge/win32/dwrite_int.h +++ b/core/src/fxge/win32/dwrite_int.h @@ -35,15 +35,15 @@ public: void Load(); void Unload(); - FX_BOOL IsAvailable() + bool IsAvailable() { return m_pDWriteFactory != NULL; } void* DwCreateFontFaceFromStream(uint8_t* pData, FX_DWORD 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_AffineMatrix* pMatrix, + bool DwRendingString(void* renderTarget, CFX_ClipRgn* pClipRgn, FX_RECT& stringRect, CFX_AffineMatrix* pMatrix, void *font, FX_FLOAT font_size, FX_ARGB text_color, int glyph_count, unsigned short* glyph_indices, FX_FLOAT baselineOriginX, FX_FLOAT baselineOriginY, diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index 18bcc595a4..e6667b17ec 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -24,18 +24,18 @@ public: CWin32FontInfo(); ~CWin32FontInfo(); virtual void Release(); - virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); - virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact); + virtual bool EnumFontList(CFX_FontMapper* pMapper); + virtual void* MapFont(int weight, bool bItalic, int charset, int pitch_family, const FX_CHAR* face, bool& bExact); virtual void* GetFont(const FX_CHAR* face) { return NULL; } virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size); virtual void DeleteFont(void* hFont); - virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); - virtual FX_BOOL GetFontCharset(void* hFont, int& charset); - FX_BOOL IsOpenTypeFromDiv(const LOGFONTA *plf); - FX_BOOL IsSupportFontFormDiv(const LOGFONTA* plf); + virtual bool GetFaceName(void* hFont, CFX_ByteString& name); + virtual bool GetFontCharset(void* hFont, int& charset); + bool IsOpenTypeFromDiv(const LOGFONTA *plf); + bool IsSupportFontFormDiv(const LOGFONTA* plf); void AddInstalledFont(const LOGFONTA *plf, FX_DWORD FontType); void GetGBPreference(CFX_ByteString& face, int weight, int picth_family); void GetJapanesePreference(CFX_ByteString& face, int weight, int picth_family); @@ -59,10 +59,10 @@ void CWin32FontInfo::Release() delete this; } #define TT_MAKE_TAG(x1, x2, x3, x4) (((FX_DWORD)x1<<24)|((FX_DWORD)x2<<16)|((FX_DWORD)x3<<8)|(FX_DWORD)x4) -FX_BOOL CWin32FontInfo::IsOpenTypeFromDiv(const LOGFONTA *plf) +bool CWin32FontInfo::IsOpenTypeFromDiv(const LOGFONTA *plf) { HFONT hFont = CreateFontIndirectA(plf); - FX_BOOL ret = FALSE; + bool ret = false; FX_DWORD font_size = GetFontData(hFont, 0, NULL, 0); if (font_size != GDI_ERROR && font_size >= sizeof(FX_DWORD)) { FX_DWORD lVersion = 0; @@ -74,16 +74,16 @@ FX_BOOL CWin32FontInfo::IsOpenTypeFromDiv(const LOGFONTA *plf) lVersion == TT_MAKE_TAG('t', 't', 'c', 'f') || lVersion == TT_MAKE_TAG('t', 'r', 'u', 'e') || lVersion == 0x00020000) { - ret = TRUE; + ret = true; } } DeleteFont(hFont); return ret; } -FX_BOOL CWin32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) +bool CWin32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) { HFONT hFont = CreateFontIndirectA(plf); - FX_BOOL ret = FALSE; + bool ret = false; FX_DWORD font_size = GetFontData(hFont, 0, NULL, 0); if (font_size != GDI_ERROR && font_size >= sizeof(FX_DWORD)) { FX_DWORD lVersion = 0; @@ -95,10 +95,10 @@ FX_BOOL CWin32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) lVersion == TT_MAKE_TAG('t', 't', 'c', 'f') || lVersion == TT_MAKE_TAG('t', 'r', 'u', 'e') || lVersion == 0x00020000) { - ret = TRUE; + ret = true; } else if ((lVersion & 0xFFFF0000) == TT_MAKE_TAG(0x80, 0x01, 0x00, 0x00) || (lVersion & 0xFFFF0000) == TT_MAKE_TAG('%', '!', 0, 0)) { - ret = TRUE; + ret = true; } } DeleteFont(hFont); @@ -139,7 +139,7 @@ static int CALLBACK FontEnumProc( pFontInfo->AddInstalledFont(plf, FontType); return 1; } -FX_BOOL CWin32FontInfo::EnumFontList(CFX_FontMapper* pMapper) +bool CWin32FontInfo::EnumFontList(CFX_FontMapper* pMapper) { m_pMapper = pMapper; LOGFONTA lf; @@ -151,7 +151,7 @@ FX_BOOL CWin32FontInfo::EnumFontList(CFX_FontMapper* pMapper) if (pMapper->GetFontEnumerator()) { pMapper->GetFontEnumerator()->Finish(); } - return TRUE; + return true; } static const struct { const FX_CHAR* m_pFaceName; @@ -163,22 +163,22 @@ VariantNames[] = { static const struct { const FX_CHAR* m_pName; const FX_CHAR* m_pWinName; - FX_BOOL m_bBold; - FX_BOOL m_bItalic; + bool m_bBold; + bool m_bItalic; } Base14Substs[] = { - {"Courier", "Courier New", FALSE, FALSE}, - {"Courier-Bold", "Courier New", TRUE, FALSE}, - {"Courier-BoldOblique", "Courier New", TRUE, TRUE}, - {"Courier-Oblique", "Courier New", FALSE, TRUE}, - {"Helvetica", "Arial", FALSE, FALSE}, - {"Helvetica-Bold", "Arial", TRUE, FALSE}, - {"Helvetica-BoldOblique", "Arial", TRUE, TRUE}, - {"Helvetica-Oblique", "Arial", FALSE, TRUE}, - {"Times-Roman", "Times New Roman", FALSE, FALSE}, - {"Times-Bold", "Times New Roman", TRUE, FALSE}, - {"Times-BoldItalic", "Times New Roman", TRUE, TRUE}, - {"Times-Italic", "Times New Roman", FALSE, TRUE}, + {"Courier", "Courier New", false, false}, + {"Courier-Bold", "Courier New", true, false}, + {"Courier-BoldOblique", "Courier New", true, true}, + {"Courier-Oblique", "Courier New", false, true}, + {"Helvetica", "Arial", false, false}, + {"Helvetica-Bold", "Arial", true, false}, + {"Helvetica-BoldOblique", "Arial", true, true}, + {"Helvetica-Oblique", "Arial", false, true}, + {"Times-Roman", "Times New Roman", false, false}, + {"Times-Bold", "Times New Roman", true, false}, + {"Times-BoldItalic", "Times New Roman", true, true}, + {"Times-Italic", "Times New Roman", false, true}, }; CFX_ByteString CWin32FontInfo::FindFont(const CFX_ByteString& name) { @@ -212,17 +212,17 @@ extern "C" { return FXSYS_stricmp((const FX_CHAR*)key, ((_FontNameMap*)element)->m_pSrcFontName); } } -FX_BOOL _GetSubFontName(CFX_ByteString& name) +bool _GetSubFontName(CFX_ByteString& name) { int size = sizeof g_JpFontNameMap; void* pFontnameMap = (void*)g_JpFontNameMap; _FontNameMap* found = (_FontNameMap*)FXSYS_bsearch(name.c_str(), pFontnameMap, size / sizeof (_FontNameMap), sizeof (_FontNameMap), compareString); if (found == NULL) { - return FALSE; + return false; } name = found->m_pSubFontName; - return TRUE; + return true; } void CWin32FontInfo::GetGBPreference(CFX_ByteString& face, int weight, int picth_family) { @@ -285,7 +285,7 @@ void CWin32FontInfo::GetJapanesePreference(CFX_ByteString& face, int weight, int face = "MS PMincho"; } } -void* CWin32FontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, FX_BOOL& bExact) +void* CWin32FontInfo::MapFont(int weight, bool bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, bool& bExact) { CFX_ByteString face = cstr_face; int iBaseFont; @@ -294,7 +294,7 @@ void* CWin32FontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitc face = Base14Substs[iBaseFont].m_pWinName; weight = Base14Substs[iBaseFont].m_bBold ? FW_BOLD : FW_NORMAL; bItalic = Base14Substs[iBaseFont].m_bItalic; - bExact = TRUE; + bExact = true; break; } if (charset == ANSI_CHARSET || charset == SYMBOL_CHARSET) { @@ -373,26 +373,26 @@ FX_DWORD CWin32FontInfo::GetFontData(void* hFont, FX_DWORD table, uint8_t* buffe } return size; } -FX_BOOL CWin32FontInfo::GetFaceName(void* hFont, CFX_ByteString& name) +bool CWin32FontInfo::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 CWin32FontInfo::GetFontCharset(void* hFont, int& charset) +bool CWin32FontInfo::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; } IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() { @@ -466,16 +466,16 @@ void* CGdiDeviceDriver::GetClipRgn() } return (void*)hClipRgn; } -FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(const CFX_DIBitmap* pBitmap1, const FX_RECT* pSrcRect, int left, int top, void* pIccTransform) +bool CGdiDeviceDriver::GDI_SetDIBits(const CFX_DIBitmap* pBitmap1, const FX_RECT* pSrcRect, int left, int top, void* pIccTransform) { if (m_DeviceClass == FXDC_PRINTER) { - CFX_DIBitmap* pBitmap = pBitmap1->FlipImage(FALSE, TRUE); + CFX_DIBitmap* pBitmap = pBitmap1->FlipImage(false, true); if (pBitmap == NULL) { - return FALSE; + return false; } if ((pBitmap->IsCmykImage() || pIccTransform) && !pBitmap->ConvertFormat(FXDIB_Rgb, pIccTransform)) { - return FALSE; + return false; } int width = pSrcRect->Width(), height = pSrcRect->Height(); int pitch = pBitmap->GetPitch(); @@ -493,7 +493,7 @@ FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(const CFX_DIBitmap* pBitmap1, const FX_R CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; if ((pBitmap->IsCmykImage() || pIccTransform) && (pBitmap = pBitmap->CloneConvert(FXDIB_Rgb, NULL, pIccTransform)) == NULL) { - return FALSE; + return false; } int width = pSrcRect->Width(), height = pSrcRect->Height(); int pitch = pBitmap->GetPitch(); @@ -505,18 +505,18 @@ FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(const CFX_DIBitmap* pBitmap1, const FX_R delete pBitmap; } } - return TRUE; + return true; } -FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1, int dest_left, int dest_top, +bool CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1, int dest_left, int dest_top, int dest_width, int dest_height, FX_DWORD flags, void* pIccTransform) { CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; if (pBitmap == NULL || dest_width == 0 || dest_height == 0) { - return FALSE; + return false; } if ((pBitmap->IsCmykImage() || pIccTransform) && !pBitmap->ConvertFormat(FXDIB_Rgb, pIccTransform)) { - return FALSE; + return false; } CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); if ((int64_t)abs(dest_width) * abs(dest_height) < (int64_t)pBitmap1->GetWidth() * pBitmap1->GetHeight() * 4 || @@ -538,15 +538,15 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1, int de if (del) { delete pToStrechBitmap; } - return TRUE; + return true; } -FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(const CFX_DIBitmap* pBitmap1, int dest_left, int dest_top, +bool CGdiDeviceDriver::GDI_StretchBitMask(const CFX_DIBitmap* pBitmap1, int dest_left, int dest_top, int dest_width, int dest_height, FX_DWORD bitmap_color, FX_DWORD flags, int alpha_flag, void* pIccTransform) { CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; if (pBitmap == NULL || dest_width == 0 || dest_height == 0) { - return FALSE; + return false; } _Color2Argb(bitmap_color, bitmap_color, alpha_flag | (1 << 24), pIccTransform); int width = pBitmap->GetWidth(), height = pBitmap->GetHeight(); @@ -592,16 +592,16 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(const CFX_DIBitmap* pBitmap1, int d SelectObject(m_hDC, hOld); DeleteObject(hPattern); - return TRUE; + return true; } BOOL CGdiDeviceDriver::GetClipBox(FX_RECT* pRect) { return ::GetClipBox(m_hDC, (RECT*)pRect); } -FX_BOOL CGdiDeviceDriver::SetClipRgn(void* hRgn) +bool CGdiDeviceDriver::SetClipRgn(void* hRgn) { ::SelectClipRgn(m_hDC, (HRGN)hRgn); - return TRUE; + return true; } static HPEN _CreatePen(const CFX_GraphStateData* pGraphState, const CFX_AffineMatrix* pMatrix, FX_DWORD argb) { @@ -749,11 +749,11 @@ void CGdiDeviceDriver::DrawLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT MoveToEx(m_hDC, FXSYS_round(x1), FXSYS_round(y1), NULL); LineTo(m_hDC, FXSYS_round(x2), FXSYS_round(y2)); } -static FX_BOOL _MatrixNoScaled(const CFX_AffineMatrix* pMatrix) +static bool _MatrixNoScaled(const CFX_AffineMatrix* pMatrix) { return pMatrix->GetA() == 1.0f && pMatrix->GetB() == 0 && pMatrix->GetC() == 0 && pMatrix->GetD() == 1.0f; } -FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, +bool CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, const CFX_AffineMatrix* pMatrix, const CFX_GraphStateData* pGraphState, FX_DWORD fill_color, @@ -765,7 +765,7 @@ FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, ) { if (blend_type != FXDIB_BLEND_NORMAL) { - return FALSE; + return false; } _Color2Argb(fill_color, fill_color, alpha_flag | (1 << 24), pIccTransform); _Color2Argb(stroke_color, stroke_color, alpha_flag, pIccTransform); @@ -786,9 +786,9 @@ 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 || ((m_DeviceClass != FXDC_PRINTER && !(fill_mode & FXFILL_FULLCOVER)) || (pGraphState && pGraphState->m_DashCount))) { @@ -797,7 +797,7 @@ FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) && pPathData->IsRect()) ) { if (pPlatform->m_GdiplusExt.DrawPath(m_hDC, pPathData, pMatrix, pGraphState, fill_color, stroke_color, fill_mode)) { - return TRUE; + return true; } } } @@ -852,29 +852,29 @@ FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, hBrush = (HBRUSH)SelectObject(m_hDC, hBrush); DeleteObject(hBrush); } - return TRUE; + return true; } -FX_BOOL CGdiDeviceDriver::FillRect(const FX_RECT* pRect, FX_DWORD fill_color, int alpha_flag, void* pIccTransform, int blend_type) +bool CGdiDeviceDriver::FillRect(const FX_RECT* pRect, FX_DWORD fill_color, int alpha_flag, void* pIccTransform, int blend_type) { if (blend_type != FXDIB_BLEND_NORMAL) { - return FALSE; + return false; } _Color2Argb(fill_color, fill_color, alpha_flag | (1 << 24), pIccTransform); 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, +bool CGdiDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pMatrix, int fill_mode ) @@ -884,15 +884,15 @@ FX_BOOL CGdiDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, if (pPathData->IsRect(pMatrix, &rectf)) { FX_RECT rect = rectf.GetOutterRect(); 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(const CFX_PathData* pPathData, +bool CGdiDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData, const CFX_AffineMatrix* pMatrix, const CFX_GraphStateData* pGraphState ) @@ -902,23 +902,23 @@ FX_BOOL CGdiDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData, _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, FX_DWORD color, +bool CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, FX_DWORD color, int alpha_flag, void* pIccTransform, int blend_type) { if (blend_type != FXDIB_BLEND_NORMAL) { - return FALSE; + return false; } _Color2Argb(color, color, alpha_flag | (1 << 24), pIccTransform); 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); @@ -926,12 +926,12 @@ FX_BOOL CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2 LineTo(m_hDC, FXSYS_round(x2), FXSYS_round(y2)); hPen = (HPEN)SelectObject(m_hDC, hPen); DeleteObject(hPen); - return TRUE; + return true; } -FX_BOOL CGdiDeviceDriver::DeleteDeviceRgn(void* pRgn) +bool CGdiDeviceDriver::DeleteDeviceRgn(void* pRgn) { DeleteObject((HGDIOBJ)pRgn); - return TRUE; + return true; } CGdiDisplayDriver::CGdiDisplayDriver(HDC hDC) : CGdiDeviceDriver(hDC, FXDC_DISPLAY) { @@ -940,9 +940,9 @@ CGdiDisplayDriver::CGdiDisplayDriver(HDC hDC) : CGdiDeviceDriver(hDC, FXDC_DISPL m_RenderCaps |= FXRC_ALPHA_PATH | FXRC_ALPHA_IMAGE; } } -FX_BOOL CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform, FX_BOOL bDEdge) +bool CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform, bool bDEdge) { - FX_BOOL ret = FALSE; + bool ret = false; int width = pBitmap->GetWidth(); int height = pBitmap->GetHeight(); HBITMAP hbmp = CreateCompatibleBitmap(m_hDC, width, height); @@ -969,7 +969,7 @@ FX_BOOL CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, v ::GetDIBits(hDCMemory, hbmp, 0, height, bitmap.GetBuffer(), &bmi, DIB_RGB_COLORS); ret = pBitmap->TransferBitmap(0, 0, width, height, &bitmap, 0, 0, pIccTransform); } else { - ret = FALSE; + ret = false; } } if (pBitmap->HasAlpha() && ret) { @@ -979,22 +979,22 @@ FX_BOOL CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, v DeleteObject(hDCMemory); return ret; } -FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type, +bool CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type, int alpha_flag, void* pIccTransform) { ASSERT(blend_type == FXDIB_BLEND_NORMAL); if (pSource->IsAlphaMask()) { int width = pSource->GetWidth(), height = pSource->GetHeight(); int alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); - FX_BOOL bGDI = pSource->GetBPP() == 1 && alpha == 255; + bool bGDI = pSource->GetBPP() == 1 && alpha == 255; if (!bGDI) { CFX_DIBitmap background; if (!background.Create(width, height, FXDIB_Rgb32) || !GetDIBits(&background, left, top, NULL) || !background.CompositeMask(0, 0, width, height, pSource, color, - 0, 0, FXDIB_BLEND_NORMAL, NULL, FALSE, + 0, 0, FXDIB_BLEND_NORMAL, NULL, false, alpha_flag, pIccTransform)) { - return FALSE; + return false; } FX_RECT src_rect(0, 0, width, height); return SetDIBits(&background, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL, 0, NULL); @@ -1008,8 +1008,8 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD colo CFX_DIBitmap bitmap; if (!bitmap.Create(width, height, FXDIB_Rgb) || !GetDIBits(&bitmap, left, top, NULL) || - !bitmap.CompositeBitmap(0, 0, width, height, pSource, pSrcRect->left, pSrcRect->top, FXDIB_BLEND_NORMAL, NULL, FALSE, pIccTransform)) { - return FALSE; + !bitmap.CompositeBitmap(0, 0, width, height, pSource, pSrcRect->left, pSrcRect->top, FXDIB_BLEND_NORMAL, NULL, false, pIccTransform)) { + return false; } FX_RECT src_rect(0, 0, width, height); return SetDIBits(&bitmap, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL, 0, NULL); @@ -1019,9 +1019,9 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD colo if (pBitmap) { return GDI_SetDIBits(pBitmap, pSrcRect, left, top, pIccTransform); } - return FALSE; + return false; } -FX_BOOL CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource, FX_DWORD color, int dest_left, int dest_top, +bool CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource, FX_DWORD color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, int render_flags, int alpha_flag, void* pIccTransform, int blend_type) { @@ -1035,14 +1035,14 @@ FX_BOOL CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource, F bitmap_clip.Offset(-dest_left, -dest_top); CFX_DIBitmap* pStretched = pSource->StretchTo(dest_width, dest_height, render_flags, &bitmap_clip); if (pStretched == NULL) { - return TRUE; + return true; } FX_RECT src_rect(0, 0, pStretched->GetWidth(), pStretched->GetHeight()); - FX_BOOL ret = SetDIBits(pStretched, color, &src_rect, pClipRect->left, pClipRect->top, FXDIB_BLEND_NORMAL, alpha_flag, pIccTransform); + bool ret = SetDIBits(pStretched, color, &src_rect, pClipRect->left, pClipRect->top, FXDIB_BLEND_NORMAL, alpha_flag, pIccTransform); delete pStretched; return ret; } -FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD color, int dest_left, int dest_top, +bool CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform, int blend_type) { @@ -1063,17 +1063,17 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD int clip_width = clip_rect.Width(), clip_height = clip_rect.Height(); CFX_DIBitmap* pStretched = pSource->StretchTo(dest_width, dest_height, flags, &clip_rect); if (pStretched == NULL) { - return TRUE; + return true; } CFX_DIBitmap background; if (!background.Create(clip_width, clip_height, FXDIB_Rgb32) || !GetDIBits(&background, image_rect.left + clip_rect.left, image_rect.top + clip_rect.top, NULL) || - !background.CompositeMask(0, 0, clip_width, clip_height, pStretched, color, 0, 0, FXDIB_BLEND_NORMAL, NULL, FALSE, alpha_flag, pIccTransform)) { + !background.CompositeMask(0, 0, clip_width, clip_height, pStretched, color, 0, 0, FXDIB_BLEND_NORMAL, NULL, false, alpha_flag, pIccTransform)) { delete pStretched; - return FALSE; + return false; } FX_RECT src_rect(0, 0, clip_width, clip_height); - FX_BOOL ret = SetDIBits(&background, 0, &src_rect, image_rect.left + clip_rect.left, image_rect.top + clip_rect.top, FXDIB_BLEND_NORMAL, 0, NULL); + bool ret = SetDIBits(&background, 0, &src_rect, image_rect.left + clip_rect.left, image_rect.top + clip_rect.top, FXDIB_BLEND_NORMAL, 0, NULL); delete pStretched; return ret; } @@ -1083,7 +1083,7 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD CFX_DIBExtractor temp(pSource); CFX_DIBitmap* pBitmap = temp; if (pBitmap == NULL) { - return FALSE; + return false; } return pPlatform->m_GdiplusExt.StretchDIBits(m_hDC, pBitmap, dest_left, dest_top, dest_width, dest_height, pClipRect, flags); } @@ -1095,7 +1095,7 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD if (pBitmap) { return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_height, flags, pIccTransform); } - return FALSE; + return false; } #define GET_PS_FEATURESETTING 4121 #define FEATURESETTING_PSLEVEL 2 @@ -1134,7 +1134,7 @@ int GetPSLevel(HDC hDC) return 2; } int CFX_WindowsDevice::m_psLevel = 2; -CFX_WindowsDevice::CFX_WindowsDevice(HDC hDC, FX_BOOL bCmykOutput, FX_BOOL bForcePSOutput, int psLevel) +CFX_WindowsDevice::CFX_WindowsDevice(HDC hDC, bool bCmykOutput, bool bForcePSOutput, int psLevel) { m_bForcePSOutput = bForcePSOutput; m_psLevel = psLevel; @@ -1154,7 +1154,7 @@ HDC CFX_WindowsDevice::GetDC() const } return (HDC)pRDD->GetPlatformSurface(); } -IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC, FX_BOOL bCmykOutput) +IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC, bool bCmykOutput) { int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY); int obj_type = ::GetObjectType(hDC); diff --git a/core/src/fxge/win32/fx_win32_dib.cpp b/core/src/fxge/win32/fx_win32_dib.cpp index 3dcfce4802..610c69e4b1 100644 --- a/core/src/fxge/win32/fx_win32_dib.cpp +++ b/core/src/fxge/win32/fx_win32_dib.cpp @@ -49,19 +49,19 @@ CFX_ByteString CFX_WindowsDIB::GetBitmapInfo(const CFX_DIBitmap* pBitmap) result.ReleaseBuffer(len); return result; } -CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData, FX_BOOL bAlpha) +CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData, 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 NULL; @@ -93,7 +93,7 @@ CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData, FX_BOOL } 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) { @@ -174,7 +174,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args) } CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC, HBITMAP hBitmap, FX_DWORD* pPalette, FX_DWORD palsize) { - FX_BOOL bCreatedDC = hDC == NULL; + bool bCreatedDC = hDC == NULL; if (hDC == NULL) { hDC = CreateCompatibleDC(NULL); } diff --git a/core/src/fxge/win32/fx_win32_dwrite.cpp b/core/src/fxge/win32/fx_win32_dwrite.cpp index 65a35d86a1..8533343926 100644 --- a/core/src/fxge/win32/fx_win32_dwrite.cpp +++ b/core/src/fxge/win32/fx_win32_dwrite.cpp @@ -133,7 +133,7 @@ LPVOID CDWriteExt::DwCreateFontFaceFromStream(uint8_t* pData, FX_DWORD size, int IDWriteFactory* pDwFactory = (IDWriteFactory*)m_pDWriteFactory; IDWriteFontFile* pDwFontFile = NULL; IDWriteFontFace* pDwFontFace = NULL; - BOOL isSupportedFontType = FALSE; + BOOL isSupportedFontType = false; DWRITE_FONT_FILE_TYPE fontFileType; DWRITE_FONT_FACE_TYPE fontFaceType; UINT32 numberOfFaces; @@ -174,10 +174,10 @@ failed: SafeRelease(&pDwFontFile); return NULL; } -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 = NULL; @@ -212,14 +212,14 @@ FX_BOOL CDWriteExt::DwCreateRenderingTarget(CFX_DIBitmap* pBitmap, void** render 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_AffineMatrix* pMatrix, +bool CDWriteExt::DwRendingString(void* renderTarget, CFX_ClipRgn* pClipRgn, FX_RECT& stringRect, CFX_AffineMatrix* pMatrix, void *font, FX_FLOAT font_size, FX_ARGB text_color, int glyph_count, unsigned short* glyph_indices, FX_FLOAT baselineOriginX, FX_FLOAT baselineOriginY, @@ -227,7 +227,7 @@ FX_BOOL CDWriteExt::DwRendingString(void* renderTarget, CFX_ClipRgn* pClipRgn, F FX_FLOAT* glyph_advances) { if (renderTarget == NULL) { - return TRUE; + return true; } CDwGdiTextRenderer* pTextRenderer = (CDwGdiTextRenderer*)renderTarget; DWRITE_MATRIX transform; @@ -247,7 +247,7 @@ FX_BOOL CDWriteExt::DwRendingString(void* renderTarget, CFX_ClipRgn* pClipRgn, F 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, @@ -258,7 +258,7 @@ FX_BOOL CDWriteExt::DwRendingString(void* renderTarget, CFX_ClipRgn* pClipRgn, F &glyphRun, RGB(FXARGB_R(text_color), FXARGB_G(text_color), FXARGB_B(text_color)) ); - return SUCCEEDED(hr) ? TRUE : FALSE; + return SUCCEEDED(hr) ? true : false; } void CDWriteExt::DwDeleteRenderingTarget(void* renderTarget) { diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp index d76d52e50b..94fac69157 100644 --- a/core/src/fxge/win32/fx_win32_gdipext.cpp +++ b/core/src/fxge/win32/fx_win32_gdipext.cpp @@ -274,12 +274,12 @@ void* CGdiplusExt::GdiAddFontMemResourceEx(void *pFontdata, FX_DWORD size, void* } return NULL; } -FX_BOOL CGdiplusExt::GdiRemoveFontMemResourceEx(void* handle) +bool CGdiplusExt::GdiRemoveFontMemResourceEx(void* handle) { if (m_pGdiRemoveFontMemResourseEx) { return ((FuncType_GdiRemoveFontMemResourceEx)m_pGdiRemoveFontMemResourseEx)((HANDLE)handle); } - return FALSE; + return false; } static GpBrush* _GdipCreateBrush(DWORD argb) { @@ -291,11 +291,11 @@ static GpBrush* _GdipCreateBrush(DWORD argb) 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; } @@ -382,7 +382,7 @@ static void OutputImageMask(GpGraphics* pGraphics, BOOL bMonoDevice, const CFX_D if (src_width * src_height > 10000) { pStretched = _StretchMonoToGray(dest_width, dest_height, pBitmap, &image_clip); } else { - pStretched = pBitmap->StretchTo(dest_width, dest_height, FALSE, &image_clip); + pStretched = pBitmap->StretchTo(dest_width, dest_height, false, &image_clip); } GpBitmap* bitmap; CallFunc(GdipCreateBitmapFromScan0)(image_clip.Width(), image_clip.Height(), @@ -536,7 +536,7 @@ void CGdiplusExt::DeleteMemFont(LPVOID pCollection) CGdiplusExt& GdiplusExt = ((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; @@ -551,41 +551,41 @@ 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) { @@ -608,16 +608,16 @@ void CGdiplusExt::GdipSetPageUnit(void* graphics, FX_DWORD unit) CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; CallFunc(GdipSetPageUnit)((GpGraphics*)graphics, (GpUnit)unit); } -FX_BOOL CGdiplusExt::GdipDrawDriverString(void *graphics, unsigned short *text, int length, +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)((GpGraphics*)graphics, (GDIPCONST UINT16 *)text, (INT)length, (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(FX_DWORD fill_argb, void** pBrush) { @@ -684,7 +684,7 @@ void CGdiplusExt::GdipDeleteGraphics(void* graphics) CGdiplusExt& GdiplusExt = ((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, +bool CGdiplusExt::StretchBitMask(HDC hDC, BOOL bMonoDevice, const CFX_DIBitmap* pBitmap, int dest_left, int dest_top, int dest_width, int dest_height, FX_DWORD argb, const FX_RECT* pClipRect, int flags) { ASSERT(pBitmap->GetBPP() == 1); @@ -699,9 +699,9 @@ FX_BOOL CGdiplusExt::StretchBitMask(HDC hDC, BOOL bMonoDevice, const CFX_DIBitma } 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, +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; @@ -719,9 +719,9 @@ FX_BOOL CGdiplusExt::StretchDIBits(HDC hDC, const CFX_DIBitmap* pBitmap, int des OutputImage(pGraphics, pBitmap, &src_rect, dest_left, dest_top, dest_width, dest_height); CallFunc(GdipDeleteGraphics)(pGraphics); CallFunc(GdipDeleteGraphics)(pGraphics); - return TRUE; + return true; } -static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState, const CFX_AffineMatrix* pMatrix, DWORD argb, FX_BOOL bTextMode = FALSE) +static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState, const CFX_AffineMatrix* pMatrix, DWORD argb, bool bTextMode = false) { CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; FX_FLOAT width = pGraphState ? pGraphState->m_LineWidth : 1.0f; @@ -735,7 +735,7 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState, const CFX_Af CallFunc(GdipCreatePen1)((ARGB)argb, width, UnitWorld, &pPen); LineCap lineCap; DashCap dashCap = DashCapFlat; - FX_BOOL bDashExtend = FALSE; + bool bDashExtend = false; switch(pGraphState->m_LineCap) { case CFX_GraphStateData::LineCapButt: lineCap = LineCapFlat; @@ -743,11 +743,11 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState, const CFX_Af 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); @@ -839,10 +839,10 @@ static BOOL IsSmallTriangle(PointF* points, const CFX_AffineMatrix* pMatrix, int if (distance_square < (1.0f * 2 + 1.0f / 4)) { v1 = i; v2 = pair1; - return TRUE; + return true; } } - return FALSE; + return false; } BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, @@ -854,7 +854,7 @@ BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData, { int nPoints = pPathData->GetPointCount(); if (nPoints == 0) { - return TRUE; + return true; } FX_PATHPOINT* pPoints = pPathData->GetPoints(); GpGraphics* pGraphics = NULL; @@ -870,9 +870,9 @@ BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData, 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; @@ -900,7 +900,7 @@ BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData, if(point_type == FXPT_MOVETO) { types[i] = PathPointTypeStart; nSubPathes ++; - bSubClose = FALSE; + bSubClose = false; startpoint = i; } else if (point_type == FXPT_LINETO) { types[i] = PathPointTypeLine; @@ -910,31 +910,31 @@ BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData, continue; } 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); @@ -949,7 +949,7 @@ BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData, CallFunc(GdipDrawLineI)(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 = NULL; @@ -961,7 +961,7 @@ BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData, FX_Free(points); FX_Free(types); CallFunc(GdipDeleteGraphics)(pGraphics); - return FALSE; + return false; } if (new_fill_mode) { GpBrush* pBrush = _GdipCreateBrush(fill_argb); @@ -994,7 +994,7 @@ BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData, FX_Free(types); CallFunc(GdipDeletePath)(pGpPath); CallFunc(GdipDeleteGraphics)(pGraphics); - return TRUE; + return true; } class GpStream final : public IStream { @@ -1229,7 +1229,7 @@ static void FreeDIBitmap(PREVIEW3_DIBITMAP* pInfo) } FX_Free(pInfo); } -CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData, FX_BOOL bAlpha); +CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData, bool bAlpha); CFX_DIBitmap* CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) { PREVIEW3_DIBITMAP* pInfo = ::LoadDIBitmap(args); diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp index 86dbf9bb0a..63c3849237 100644 --- a/core/src/fxge/win32/fx_win32_print.cpp +++ b/core/src/fxge/win32/fx_win32_print.cpp @@ -18,7 +18,7 @@ CGdiPrinterDriver::CGdiPrinterDriver(HDC hDC) : CGdiDeviceDriver(hDC, FXDC_PRINT { m_HorzSize = ::GetDeviceCaps(m_hDC, HORZSIZE); m_VertSize = ::GetDeviceCaps(m_hDC, VERTSIZE); - m_bSupportROP = TRUE; + m_bSupportROP = true; } int CGdiPrinterDriver::GetDeviceCaps(int caps_id) { @@ -30,7 +30,7 @@ int CGdiPrinterDriver::GetDeviceCaps(int caps_id) } return CGdiDeviceDriver::GetDeviceCaps(caps_id); } -FX_BOOL CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type, +bool CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type, int alpha_flag, void* pIccTransform) { if (pSource->IsAlphaMask()) { @@ -41,28 +41,28 @@ FX_BOOL CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD colo ASSERT(pSource != NULL && !pSource->IsAlphaMask() && pSrcRect != NULL); ASSERT(blend_type == FXDIB_BLEND_NORMAL); if (pSource->HasAlpha()) { - return FALSE; + return false; } CFX_DIBExtractor temp(pSource); CFX_DIBitmap* pBitmap = temp; if (pBitmap == NULL) { - return FALSE; + return false; } return GDI_SetDIBits(pBitmap, pSrcRect, left, top, pIccTransform); } -FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD color, int dest_left, int dest_top, +bool CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform, int blend_type) { if (pSource->IsAlphaMask()) { int alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); if (pSource->GetBPP() != 1 || alpha != 255 || !m_bSupportROP) { - return FALSE; + return false; } if (dest_width < 0 || dest_height < 0) { CFX_DIBitmap* pFlipped = pSource->FlipImage(dest_width < 0, dest_height < 0); if (pFlipped == NULL) { - return FALSE; + return false; } if (dest_width < 0) { dest_left += dest_width; @@ -70,24 +70,24 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD if (dest_height < 0) { dest_top += dest_height; } - FX_BOOL ret = GDI_StretchBitMask(pFlipped, dest_left, dest_top, abs(dest_width), abs(dest_height), color, flags, alpha_flag, pIccTransform); + bool ret = GDI_StretchBitMask(pFlipped, dest_left, dest_top, abs(dest_width), abs(dest_height), color, flags, alpha_flag, pIccTransform); delete pFlipped; return ret; } CFX_DIBExtractor temp(pSource); CFX_DIBitmap* pBitmap = temp; if (pBitmap == NULL) { - return FALSE; + return false; } return GDI_StretchBitMask(pBitmap, dest_left, dest_top, dest_width, dest_height, color, flags, alpha_flag, pIccTransform); } if (pSource->HasAlpha()) { - return FALSE; + return false; } if (dest_width < 0 || dest_height < 0) { CFX_DIBitmap* pFlipped = pSource->FlipImage(dest_width < 0, dest_height < 0); if (pFlipped == NULL) { - return FALSE; + return false; } if (dest_width < 0) { dest_left += dest_width; @@ -95,14 +95,14 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD if (dest_height < 0) { dest_top += dest_height; } - FX_BOOL ret = GDI_StretchDIBits(pFlipped, dest_left, dest_top, abs(dest_width), abs(dest_height), flags, pIccTransform); + bool ret = GDI_StretchDIBits(pFlipped, dest_left, dest_top, abs(dest_width), abs(dest_height), flags, pIccTransform); delete pFlipped; return ret; } CFX_DIBExtractor temp(pSource); CFX_DIBitmap* pBitmap = temp; if (pBitmap == NULL) { - return FALSE; + return false; } return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_height, flags, pIccTransform); } @@ -189,18 +189,18 @@ static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, const CFX_Af } return pTempBitmap; } -FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD color, +bool CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD color, const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type) { if (bitmap_alpha < 255 || pSource->HasAlpha() || (pSource->IsAlphaMask() && (pSource->GetBPP() != 1 || !m_bSupportROP))) { - return FALSE; + return false; } CFX_FloatRect unit_rect = pMatrix->GetUnitRect(); FX_RECT full_rect = unit_rect.GetOutterRect(); 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, bFlipX ? -full_rect.Width() : full_rect.Width(), bFlipY ? -full_rect.Height() : full_rect.Height(), NULL, 0, alpha_flag, pIccTransform, blend_type); @@ -208,9 +208,9 @@ FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_ if (FXSYS_fabs(pMatrix->a) < 0.5f && FXSYS_fabs(pMatrix->d) < 0.5f) { CFX_DIBitmap* pTransformed = pSource->SwapXY(pMatrix->c > 0, pMatrix->b < 0); if (pTransformed == NULL) { - return FALSE; + return false; } - FX_BOOL ret = StretchDIBits(pTransformed, color, full_rect.left, full_rect.top, full_rect.Width(), full_rect.Height(), NULL, 0, + bool ret = StretchDIBits(pTransformed, color, full_rect.left, full_rect.top, full_rect.Width(), full_rect.Height(), NULL, 0, alpha_flag, pIccTransform, blend_type); delete pTransformed; return ret; @@ -218,20 +218,20 @@ FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_ if (pSource->GetBPP() == 1) { CFX_DIBitmap* pTransformed = Transform1bppBitmap(pSource, pMatrix); if (pIccTransform == NULL) { - return FALSE; + return false; } SaveState(); CFX_PathData path; path.AppendRect(0, 0, 1.0f, 1.0f); SetClip_PathFill(&path, pMatrix, WINDING); - FX_BOOL ret = StretchDIBits(pTransformed, color, full_rect.left, full_rect.top, full_rect.Width(), full_rect.Height(), NULL, 0, + bool ret = StretchDIBits(pTransformed, color, full_rect.left, full_rect.top, full_rect.Width(), full_rect.Height(), NULL, 0, alpha_flag, pIccTransform, blend_type); RestoreState(); delete pTransformed; handle = NULL; return ret; } - return FALSE; + return false; } CPSOutput::CPSOutput(HDC hDC) { @@ -266,14 +266,14 @@ void CPSOutput::OutputPS(const FX_CHAR* string, int len) CPSPrinterDriver::CPSPrinterDriver() { m_pPSOutput = NULL; - m_bCmykOutput = FALSE; + m_bCmykOutput = false; } CPSPrinterDriver::~CPSPrinterDriver() { EndRendering(); delete m_pPSOutput; } -FX_BOOL CPSPrinterDriver::Init(HDC hDC, int pslevel, FX_BOOL bCmykOutput) +bool CPSPrinterDriver::Init(HDC hDC, int pslevel, bool bCmykOutput) { m_hDC = hDC; m_HorzSize = ::GetDeviceCaps(m_hDC, HORZSIZE); @@ -305,7 +305,7 @@ FX_BOOL CPSPrinterDriver::Init(HDC hDC, int pslevel, FX_BOOL bCmykOutput) } } ::DeleteObject(hRgn); - return TRUE; + return true; } int CPSPrinterDriver::GetDeviceCaps(int caps_id) { @@ -327,7 +327,7 @@ int CPSPrinterDriver::GetDeviceCaps(int caps_id) } return 0; } -FX_BOOL CPSPrinterDriver::StartRendering() +bool CPSPrinterDriver::StartRendering() { return m_PSRenderer.StartRendering(); } @@ -339,69 +339,69 @@ void CPSPrinterDriver::SaveState() { m_PSRenderer.SaveState(); } -void CPSPrinterDriver::RestoreState(FX_BOOL bKeepSaved) +void CPSPrinterDriver::RestoreState(bool bKeepSaved) { m_PSRenderer.RestoreState(bKeepSaved); } -FX_BOOL CPSPrinterDriver::SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, +bool CPSPrinterDriver::SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, int fill_mode) { m_PSRenderer.SetClip_PathFill(pPathData, pObject2Device, fill_mode); - return TRUE; + return true; } -FX_BOOL CPSPrinterDriver::SetClip_PathStroke(const CFX_PathData* pPathData, +bool CPSPrinterDriver::SetClip_PathStroke(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState) { m_PSRenderer.SetClip_PathStroke(pPathData, pObject2Device, pGraphState); - return TRUE; + return true; } -FX_BOOL CPSPrinterDriver::DrawPath(const CFX_PathData* pPathData, +bool CPSPrinterDriver::DrawPath(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState, FX_ARGB fill_color, FX_ARGB stroke_color, int fill_mode, int alpha_flag, void* pIccTransform, int blend_type) { if (blend_type != FXDIB_BLEND_NORMAL) { - return FALSE; + return false; } return m_PSRenderer.DrawPath(pPathData, pObject2Device, pGraphState, fill_color, stroke_color, fill_mode & 3, alpha_flag, pIccTransform); } -FX_BOOL CPSPrinterDriver::GetClipBox(FX_RECT* pRect) +bool CPSPrinterDriver::GetClipBox(FX_RECT* pRect) { *pRect = m_PSRenderer.GetClipBox(); - return TRUE; + return true; } -FX_BOOL CPSPrinterDriver::SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type, +bool CPSPrinterDriver::SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type, int alpha_flag, void* pIccTransform) { if (blend_type != FXDIB_BLEND_NORMAL) { - return FALSE; + return false; } return m_PSRenderer.SetDIBits(pBitmap, color, left, top, alpha_flag, pIccTransform); } -FX_BOOL CPSPrinterDriver::StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, +bool CPSPrinterDriver::StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform, int blend_type) { if (blend_type != FXDIB_BLEND_NORMAL) { - return FALSE; + return false; } return m_PSRenderer.StretchDIBits(pBitmap, color, dest_left, dest_top, dest_width, dest_height, flags, alpha_flag, pIccTransform); } -FX_BOOL CPSPrinterDriver::StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, +bool CPSPrinterDriver::StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type) { if (blend_type != FXDIB_BLEND_NORMAL) { - return FALSE; + return false; } if (bitmap_alpha < 255) { - return FALSE; + return false; } handle = NULL; return m_PSRenderer.DrawDIBits(pBitmap, color, pMatrix, render_flags, alpha_flag, pIccTransform); } -FX_BOOL CPSPrinterDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, +bool CPSPrinterDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, int alpha_flag, void* pIccTransform) { diff --git a/core/src/fxge/win32/win32_int.h b/core/src/fxge/win32/win32_int.h index 569c4f6baa..f9b6a639b9 100644 --- a/core/src/fxge/win32/win32_int.h +++ b/core/src/fxge/win32/win32_int.h @@ -13,15 +13,15 @@ public: CGdiplusExt(); ~CGdiplusExt(); void Load(); - FX_BOOL IsAvailable() + bool IsAvailable() { return m_hModule != NULL; } - FX_BOOL StretchBitMask(HDC hDC, BOOL bMonoDevice, const CFX_DIBitmap* pBitmap, int dest_left, int dest_top, + bool StretchBitMask(HDC hDC, BOOL bMonoDevice, const CFX_DIBitmap* pBitmap, int dest_left, int dest_top, int dest_width, int dest_height, FX_DWORD argb, const FX_RECT* pClipRect, int flags); - FX_BOOL StretchDIBits(HDC hDC, const CFX_DIBitmap* pBitmap, int dest_left, int dest_top, + 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, + bool DrawPath(HDC hDC, const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState, FX_DWORD fill_argb, @@ -31,26 +31,26 @@ public: void* LoadMemFont(uint8_t* pData, FX_DWORD 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, FX_DWORD 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(FX_DWORD fill_argb, void** pBrush); void GdipDeleteBrush(void* pBrush); void GdipCreateMatrix(FX_FLOAT a, FX_FLOAT b, FX_FLOAT c, FX_FLOAT d, FX_FLOAT e, 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, FX_DWORD size, void* pdv, FX_DWORD* num_face); - FX_BOOL GdiRemoveFontMemResourceEx(void* handle); + bool GdiRemoveFontMemResourceEx(void* handle); void* m_Functions[100]; void* m_pGdiAddFontMemResourceEx; void* m_pGdiRemoveFontMemResourseEx; @@ -63,7 +63,7 @@ protected: class CWin32Platform { public: - FX_BOOL m_bHalfTone; + bool m_bHalfTone; CGdiplusExt m_GdiplusExt; CDWriteExt m_DWriteExt; }; @@ -75,22 +75,22 @@ protected: { SaveDC(m_hDC); } - virtual void RestoreState(FX_BOOL bKeepSaved = FALSE) + virtual void RestoreState(bool bKeepSaved = false) { RestoreDC(m_hDC, -1); if (bKeepSaved) { SaveDC(m_hDC); } } - virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, + virtual bool SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, int fill_mode ); - virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, + virtual bool SetClip_PathStroke(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState ); - virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, + virtual bool DrawPath(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState, FX_DWORD fill_color, @@ -100,26 +100,26 @@ protected: void* pIccTransform, int blend_type ); - virtual FX_BOOL FillRect(const FX_RECT* pRect, + virtual bool FillRect(const FX_RECT* pRect, FX_DWORD fill_color, int alpha_flag, void* pIccTransform, int blend_type); - virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, FX_DWORD color, + virtual bool DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, FX_DWORD color, int alpha_flag, void* pIccTransform, int blend_type); virtual void* GetClipRgn() ; - virtual FX_BOOL SetClipRgn(void* pRgn) ; - virtual FX_BOOL GetClipBox(FX_RECT* pRect); - virtual FX_BOOL DeleteDeviceRgn(void* pRgn); + virtual bool SetClipRgn(void* pRgn) ; + virtual bool GetClipBox(FX_RECT* pRect); + virtual bool DeleteDeviceRgn(void* pRgn); virtual void DrawLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2); virtual void* GetPlatformSurface() { return (void*)m_hDC; } - FX_BOOL GDI_SetDIBits(const CFX_DIBitmap* pBitmap, const FX_RECT* pSrcRect, int left, int top, + bool GDI_SetDIBits(const CFX_DIBitmap* pBitmap, const FX_RECT* pSrcRect, int left, int top, void* pIccTransform); - FX_BOOL GDI_StretchDIBits(const CFX_DIBitmap* pBitmap, int dest_left, int dest_top, + bool GDI_StretchDIBits(const CFX_DIBitmap* pBitmap, int dest_left, int dest_top, int dest_width, int dest_height, FX_DWORD flags, void* pIccTransform); - FX_BOOL GDI_StretchBitMask(const CFX_DIBitmap* pBitmap, int dest_left, int dest_top, + bool GDI_StretchBitMask(const CFX_DIBitmap* pBitmap, int dest_left, int dest_top, int dest_width, int dest_height, FX_DWORD bitmap_color, FX_DWORD flags, int alpha_flag, void* pIccTransform); HDC m_hDC; @@ -133,19 +133,19 @@ class CGdiDisplayDriver : public CGdiDeviceDriver public: CGdiDisplayDriver(HDC hDC); protected: - virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform = NULL, FX_BOOL bDEdge = FALSE); - virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type, + virtual bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform = NULL, bool bDEdge = false); + virtual bool SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type, int alpha_flag, void* pIccTransform); - virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, + virtual bool StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform, int blend_type); - virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, + virtual bool StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type) { - return FALSE; + return false; } - FX_BOOL UseFoxitStretchEngine(const CFX_DIBSource* pSource, FX_DWORD color, int dest_left, int dest_top, + bool UseFoxitStretchEngine(const CFX_DIBSource* pSource, FX_DWORD color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, int render_flags, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL); }; @@ -155,16 +155,16 @@ public: CGdiPrinterDriver(HDC hDC); protected: virtual int GetDeviceCaps(int caps_id); - virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type, + virtual bool SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type, int alpha_flag, void* pIccTransform); - virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, + virtual bool StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform, int blend_type); - virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, + virtual bool StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type); int m_HorzSize, m_VertSize; - FX_BOOL m_bSupportROP; + bool m_bSupportROP; }; class CPSOutput : public IFX_PSOutput { @@ -184,27 +184,27 @@ class CPSPrinterDriver : public IFX_RenderDeviceDriver { public: CPSPrinterDriver(); - FX_BOOL Init(HDC hDC, int ps_level, FX_BOOL bCmykOutput); + bool Init(HDC hDC, int ps_level, bool bCmykOutput); ~CPSPrinterDriver(); protected: - virtual FX_BOOL IsPSPrintDriver() + virtual bool IsPSPrintDriver() { - return TRUE; + return true; } virtual int GetDeviceCaps(int caps_id); - virtual FX_BOOL StartRendering(); + virtual bool StartRendering(); virtual void EndRendering(); virtual void SaveState(); - virtual void RestoreState(FX_BOOL bKeepSaved = FALSE); - virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, + virtual void RestoreState(bool bKeepSaved = false); + virtual bool SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, int fill_mode ); - virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, + virtual bool SetClip_PathStroke(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState ); - virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, + virtual bool DrawPath(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState, FX_DWORD fill_color, @@ -214,16 +214,16 @@ protected: void* pIccTransform, int blend_type ); - virtual FX_BOOL GetClipBox(FX_RECT* pRect); - virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type, + virtual bool GetClipBox(FX_RECT* pRect); + virtual bool SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type, int alpha_flag, void* pIccTransform); - virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, + virtual bool StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform, int blend_type); - virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, + virtual bool StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type); - virtual FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, + virtual bool DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, int alpha_flag, void* pIccTransform); virtual void* GetPlatformSurface() @@ -231,7 +231,7 @@ protected: return (void*)m_hDC; } HDC m_hDC; - FX_BOOL m_bCmykOutput; + bool m_bCmykOutput; int m_Width, m_Height, m_nBitsPerPixel; int m_HorzSize, m_VertSize; CPSOutput* m_pPSOutput; |