diff options
author | tsepez <tsepez@chromium.org> | 2016-11-02 15:17:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-02 15:17:30 -0700 |
commit | 12f3e4a58f05850b93af35619cb04f0231d86acc (patch) | |
tree | 9851d8e46e5c168f5d148864caa2eebf814529dd /core/fxge/win32 | |
parent | 3b3ce1a242f8445848d3f23d6c35ba01d7c645f4 (diff) | |
download | pdfium-12f3e4a58f05850b93af35619cb04f0231d86acc.tar.xz |
Remove FX_BOOL from core
Review-Url: https://codereview.chromium.org/2477443002
Diffstat (limited to 'core/fxge/win32')
-rw-r--r-- | core/fxge/win32/dwrite_int.h | 30 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_device.cpp | 270 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_dib.cpp | 10 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_dwrite.cpp | 42 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_gdipext.cpp | 168 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_print.cpp | 102 | ||||
-rw-r--r-- | core/fxge/win32/win32_int.h | 290 |
7 files changed, 456 insertions, 456 deletions
diff --git a/core/fxge/win32/dwrite_int.h b/core/fxge/win32/dwrite_int.h index f49fda44dd..86ead89947 100644 --- a/core/fxge/win32/dwrite_int.h +++ b/core/fxge/win32/dwrite_int.h @@ -34,26 +34,26 @@ class CDWriteExt { void Load(); void Unload(); - FX_BOOL IsAvailable() { return !!m_pDWriteFactory; } + bool IsAvailable() { return !!m_pDWriteFactory; } void* DwCreateFontFaceFromStream(uint8_t* pData, uint32_t size, int simulation_style); - FX_BOOL DwCreateRenderingTarget(CFX_DIBitmap* pSrc, void** renderTarget); + bool DwCreateRenderingTarget(CFX_DIBitmap* pSrc, void** renderTarget); void DwDeleteRenderingTarget(void* renderTarget); - FX_BOOL DwRendingString(void* renderTarget, - CFX_ClipRgn* pClipRgn, - FX_RECT& stringRect, - CFX_Matrix* pMatrix, - void* font, - FX_FLOAT font_size, - FX_ARGB text_color, - int glyph_count, - unsigned short* glyph_indices, - FX_FLOAT baselineOriginX, - FX_FLOAT baselineOriginY, - void* glyph_offsets, - FX_FLOAT* glyph_advances); + bool DwRendingString(void* renderTarget, + CFX_ClipRgn* pClipRgn, + FX_RECT& stringRect, + CFX_Matrix* pMatrix, + void* font, + FX_FLOAT font_size, + FX_ARGB text_color, + int glyph_count, + unsigned short* glyph_indices, + FX_FLOAT baselineOriginX, + FX_FLOAT baselineOriginY, + void* glyph_offsets, + FX_FLOAT* glyph_advances); void DwDeleteFont(void* pFont); protected: diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index 900828c3fc..004f344d67 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -319,7 +319,7 @@ unsigned clip_liang_barsky(FX_FLOAT x1, } #endif // _SKIA_SUPPORT_ -FX_BOOL MatrixNoScaled(const CFX_Matrix* pMatrix) { +bool MatrixNoScaled(const CFX_Matrix* pMatrix) { return pMatrix->GetA() == 1.0f && pMatrix->GetB() == 0 && pMatrix->GetC() == 0 && pMatrix->GetD() == 1.0f; } @@ -331,7 +331,7 @@ class CFX_Win32FallbackFontInfo final : public CFX_FolderFontInfo { // CFX_FolderFontInfo: void* MapFont(int weight, - FX_BOOL bItalic, + bool bItalic, int charset, int pitch_family, const FX_CHAR* family, @@ -344,9 +344,9 @@ class CFX_Win32FontInfo final : public IFX_SystemFontInfo { ~CFX_Win32FontInfo() override; // IFX_SystemFontInfo - FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override; + bool EnumFontList(CFX_FontMapper* pMapper) override; void* MapFont(int weight, - FX_BOOL bItalic, + bool bItalic, int charset, int pitch_family, const FX_CHAR* face, @@ -356,12 +356,12 @@ class CFX_Win32FontInfo final : public IFX_SystemFontInfo { uint32_t table, uint8_t* buffer, uint32_t size) override; - FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; - FX_BOOL GetFontCharset(void* hFont, int& charset) override; + bool GetFaceName(void* hFont, CFX_ByteString& name) override; + bool GetFontCharset(void* hFont, int& charset) override; void DeleteFont(void* hFont) override; - FX_BOOL IsOpenTypeFromDiv(const LOGFONTA* plf); - FX_BOOL IsSupportFontFormDiv(const LOGFONTA* plf); + bool IsOpenTypeFromDiv(const LOGFONTA* plf); + bool IsSupportFontFormDiv(const LOGFONTA* plf); void AddInstalledFont(const LOGFONTA* plf, uint32_t FontType); void GetGBPreference(CFX_ByteString& face, int weight, int picth_family); void GetJapanesePreference(CFX_ByteString& face, @@ -390,9 +390,9 @@ CFX_Win32FontInfo::~CFX_Win32FontInfo() { DeleteDC(m_hDC); } -FX_BOOL CFX_Win32FontInfo::IsOpenTypeFromDiv(const LOGFONTA* plf) { +bool CFX_Win32FontInfo::IsOpenTypeFromDiv(const LOGFONTA* plf) { HFONT hFont = CreateFontIndirectA(plf); - FX_BOOL ret = FALSE; + bool ret = false; uint32_t font_size = GetFontData(hFont, 0, nullptr, 0); if (font_size != GDI_ERROR && font_size >= sizeof(uint32_t)) { uint32_t lVersion = 0; @@ -404,16 +404,16 @@ FX_BOOL CFX_Win32FontInfo::IsOpenTypeFromDiv(const LOGFONTA* plf) { if (lVersion == FXBSTR_ID('O', 'T', 'T', 'O') || lVersion == 0x00010000 || lVersion == FXBSTR_ID('t', 't', 'c', 'f') || lVersion == FXBSTR_ID('t', 'r', 'u', 'e') || lVersion == 0x00020000) { - ret = TRUE; + ret = true; } } DeleteFont(hFont); return ret; } -FX_BOOL CFX_Win32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) { +bool CFX_Win32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) { HFONT hFont = CreateFontIndirectA(plf); - FX_BOOL ret = FALSE; + bool ret = false; uint32_t font_size = GetFontData(hFont, 0, nullptr, 0); if (font_size != GDI_ERROR && font_size >= sizeof(uint32_t)) { uint32_t lVersion = 0; @@ -427,7 +427,7 @@ FX_BOOL CFX_Win32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) { lVersion == FXBSTR_ID('t', 'r', 'u', 'e') || lVersion == 0x00020000 || (lVersion & 0xFFFF0000) == FXBSTR_ID(0x80, 0x01, 0x00, 0x00) || (lVersion & 0xFFFF0000) == FXBSTR_ID('%', '!', 0, 0)) { - ret = TRUE; + ret = true; } } DeleteFont(hFont); @@ -453,7 +453,7 @@ void CFX_Win32FontInfo::AddInstalledFont(const LOGFONTA* plf, m_LastFamily = name; } -FX_BOOL CFX_Win32FontInfo::EnumFontList(CFX_FontMapper* pMapper) { +bool CFX_Win32FontInfo::EnumFontList(CFX_FontMapper* pMapper) { m_pMapper = pMapper; LOGFONTA lf; FXSYS_memset(&lf, 0, sizeof(LOGFONTA)); @@ -462,7 +462,7 @@ FX_BOOL CFX_Win32FontInfo::EnumFontList(CFX_FontMapper* pMapper) { lf.lfPitchAndFamily = 0; EnumFontFamiliesExA(m_hDC, &lf, (FONTENUMPROCA)FontEnumProc, (uintptr_t) this, 0); - return TRUE; + return true; } CFX_ByteString CFX_Win32FontInfo::FindFont(const CFX_ByteString& name) { @@ -483,7 +483,7 @@ CFX_ByteString CFX_Win32FontInfo::FindFont(const CFX_ByteString& name) { } void* CFX_Win32FallbackFontInfo::MapFont(int weight, - FX_BOOL bItalic, + bool bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, @@ -493,14 +493,14 @@ void* CFX_Win32FallbackFontInfo::MapFont(int weight, iExact = 1; return font; } - FX_BOOL bCJK = TRUE; + bool bCJK = true; switch (charset) { case FXFONT_SHIFTJIS_CHARSET: case FXFONT_GB2312_CHARSET: case FXFONT_CHINESEBIG5_CHARSET: case FXFONT_HANGUL_CHARSET: default: - bCJK = FALSE; + bCJK = false; break; } return FindFont(weight, bItalic, charset, pitch_family, cstr_face, !bCJK); @@ -575,7 +575,7 @@ void CFX_Win32FontInfo::GetJapanesePreference(CFX_ByteString& face, } void* CFX_Win32FontInfo::MapFont(int weight, - FX_BOOL bItalic, + bool bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, @@ -587,7 +587,7 @@ void* CFX_Win32FontInfo::MapFont(int weight, face = g_Base14Substs[iBaseFont].m_pWinName; weight = g_Base14Substs[iBaseFont].m_bBold ? FW_BOLD : FW_NORMAL; bItalic = g_Base14Substs[iBaseFont].m_bItalic; - iExact = TRUE; + iExact = true; break; } if (charset == FXFONT_ANSI_CHARSET || charset == FXFONT_SYMBOL_CHARSET) { @@ -672,25 +672,25 @@ uint32_t CFX_Win32FontInfo::GetFontData(void* hFont, return size; } -FX_BOOL CFX_Win32FontInfo::GetFaceName(void* hFont, CFX_ByteString& name) { +bool CFX_Win32FontInfo::GetFaceName(void* hFont, CFX_ByteString& name) { char facebuf[100]; HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont); int ret = ::GetTextFaceA(m_hDC, 100, facebuf); ::SelectObject(m_hDC, hOldFont); if (ret == 0) { - return FALSE; + return false; } name = facebuf; - return TRUE; + return true; } -FX_BOOL CFX_Win32FontInfo::GetFontCharset(void* hFont, int& charset) { +bool CFX_Win32FontInfo::GetFontCharset(void* hFont, int& charset) { TEXTMETRIC tm; HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont); ::GetTextMetrics(m_hDC, &tm); ::SelectObject(m_hDC, hOldFont); charset = tm.tmCharSet; - return TRUE; + return true; } } // namespace @@ -787,17 +787,17 @@ void CGdiDeviceDriver::RestoreState(bool bKeepSaved) { SaveDC(m_hDC); } -FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1, - const FX_RECT* pSrcRect, - int left, - int top) { +bool CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1, + const FX_RECT* pSrcRect, + int left, + int top) { if (m_DeviceClass == FXDC_PRINTER) { - std::unique_ptr<CFX_DIBitmap> pBitmap(pBitmap1->FlipImage(FALSE, TRUE)); + std::unique_ptr<CFX_DIBitmap> pBitmap(pBitmap1->FlipImage(false, true)); if (!pBitmap) - return FALSE; + return false; if (pBitmap->IsCmykImage() && !pBitmap->ConvertFormat(FXDIB_Rgb)) - return FALSE; + return false; int width = pSrcRect->Width(), height = pSrcRect->Height(); LPBYTE pBuffer = pBitmap->GetBuffer(); @@ -815,7 +815,7 @@ FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1, if (pBitmap->IsCmykImage()) { pBitmap = pBitmap->CloneConvert(FXDIB_Rgb); if (!pBitmap) - return FALSE; + return false; } int width = pSrcRect->Width(), height = pSrcRect->Height(); LPBYTE pBuffer = pBitmap->GetBuffer(); @@ -828,21 +828,21 @@ FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1, delete pBitmap; } } - return TRUE; + return true; } -FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(CFX_DIBitmap* pBitmap1, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - uint32_t flags) { +bool CGdiDeviceDriver::GDI_StretchDIBits(CFX_DIBitmap* pBitmap1, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + uint32_t flags) { CFX_DIBitmap* pBitmap = pBitmap1; if (!pBitmap || dest_width == 0 || dest_height == 0) - return FALSE; + return false; if (pBitmap->IsCmykImage() && !pBitmap->ConvertFormat(FXDIB_Rgb)) - return FALSE; + return false; CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); if ((int64_t)abs(dest_width) * abs(dest_height) < @@ -869,19 +869,19 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(CFX_DIBitmap* pBitmap1, SRCCOPY); if (del) delete pToStrechBitmap; - return TRUE; + return true; } -FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(CFX_DIBitmap* pBitmap1, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - uint32_t bitmap_color, - uint32_t flags) { +bool CGdiDeviceDriver::GDI_StretchBitMask(CFX_DIBitmap* pBitmap1, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + uint32_t bitmap_color, + uint32_t flags) { CFX_DIBitmap* pBitmap = pBitmap1; if (!pBitmap || dest_width == 0 || dest_height == 0) - return FALSE; + return false; int width = pBitmap->GetWidth(), height = pBitmap->GetHeight(); struct { @@ -929,10 +929,10 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(CFX_DIBitmap* pBitmap1, SelectObject(m_hDC, hOld); DeleteObject(hPattern); - return TRUE; + return true; } -FX_BOOL CGdiDeviceDriver::GetClipBox(FX_RECT* pRect) { +bool CGdiDeviceDriver::GetClipBox(FX_RECT* pRect) { return !!(::GetClipBox(m_hDC, (RECT*)pRect)); } @@ -986,15 +986,15 @@ void CGdiDeviceDriver::DrawLine(FX_FLOAT x1, LineTo(m_hDC, FXSYS_round(x2), FXSYS_round(y2)); } -FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, - const CFX_Matrix* pMatrix, - const CFX_GraphStateData* pGraphState, - uint32_t fill_color, - uint32_t stroke_color, - int fill_mode, - int blend_type) { +bool CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, + const CFX_Matrix* pMatrix, + const CFX_GraphStateData* pGraphState, + uint32_t fill_color, + uint32_t stroke_color, + int fill_mode, + int blend_type) { if (blend_type != FXDIB_BLEND_NORMAL) - return FALSE; + return false; CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData(); @@ -1018,10 +1018,10 @@ FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, } int fill_alpha = FXARGB_A(fill_color); int stroke_alpha = FXARGB_A(stroke_color); - FX_BOOL bDrawAlpha = (fill_alpha > 0 && fill_alpha < 255) || - (stroke_alpha > 0 && stroke_alpha < 255 && pGraphState); + bool bDrawAlpha = (fill_alpha > 0 && fill_alpha < 255) || + (stroke_alpha > 0 && stroke_alpha < 255 && pGraphState); if (!pPlatform->m_GdiplusExt.IsAvailable() && bDrawAlpha) - return FALSE; + return false; if (pPlatform->m_GdiplusExt.IsAvailable()) { if (bDrawAlpha || @@ -1035,7 +1035,7 @@ FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, if (pPlatform->m_GdiplusExt.DrawPath(m_hDC, pPathData, pMatrix, pGraphState, fill_color, stroke_color, fill_mode)) { - return TRUE; + return true; } } } @@ -1087,48 +1087,48 @@ FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, hBrush = (HBRUSH)SelectObject(m_hDC, hBrush); DeleteObject(hBrush); } - return TRUE; + return true; } -FX_BOOL CGdiDeviceDriver::FillRectWithBlend(const FX_RECT* pRect, - uint32_t fill_color, - int blend_type) { +bool CGdiDeviceDriver::FillRectWithBlend(const FX_RECT* pRect, + uint32_t fill_color, + int blend_type) { if (blend_type != FXDIB_BLEND_NORMAL) - return FALSE; + return false; int alpha; FX_COLORREF rgb; ArgbDecode(fill_color, alpha, rgb); if (alpha == 0) - return TRUE; + return true; if (alpha < 255) - return FALSE; + return false; HBRUSH hBrush = CreateSolidBrush(rgb); ::FillRect(m_hDC, (RECT*)pRect, hBrush); DeleteObject(hBrush); - return TRUE; + return true; } -FX_BOOL CGdiDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, - const CFX_Matrix* pMatrix, - int fill_mode) { +bool CGdiDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, + const CFX_Matrix* pMatrix, + int fill_mode) { if (pPathData->GetPointCount() == 5) { CFX_FloatRect rectf; if (pPathData->IsRect(pMatrix, &rectf)) { FX_RECT rect = rectf.GetOuterRect(); IntersectClipRect(m_hDC, rect.left, rect.top, rect.right, rect.bottom); - return TRUE; + return true; } } SetPathToDC(m_hDC, pPathData, pMatrix); SetPolyFillMode(m_hDC, fill_mode & 3); SelectClipPath(m_hDC, RGN_AND); - return TRUE; + return true; } -FX_BOOL CGdiDeviceDriver::SetClip_PathStroke( +bool CGdiDeviceDriver::SetClip_PathStroke( const CFX_PathData* pPathData, const CFX_Matrix* pMatrix, const CFX_GraphStateData* pGraphState) { @@ -1137,26 +1137,26 @@ FX_BOOL CGdiDeviceDriver::SetClip_PathStroke( SetPathToDC(m_hDC, pPathData, pMatrix); WidenPath(m_hDC); SetPolyFillMode(m_hDC, WINDING); - FX_BOOL ret = !!SelectClipPath(m_hDC, RGN_AND); + bool ret = !!SelectClipPath(m_hDC, RGN_AND); hPen = (HPEN)SelectObject(m_hDC, hPen); DeleteObject(hPen); return ret; } -FX_BOOL CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - uint32_t color, - int blend_type) { +bool CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, + FX_FLOAT y1, + FX_FLOAT x2, + FX_FLOAT y2, + uint32_t color, + int blend_type) { if (blend_type != FXDIB_BLEND_NORMAL) - return FALSE; + return false; int a; FX_COLORREF rgb; ArgbDecode(color, a, rgb); if (a == 0) - return TRUE; + return true; HPEN hPen = CreatePen(PS_SOLID, 1, rgb); hPen = (HPEN)SelectObject(m_hDC, hPen); @@ -1164,7 +1164,7 @@ FX_BOOL CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, LineTo(m_hDC, FXSYS_round(x2), FXSYS_round(y2)); hPen = (HPEN)SelectObject(m_hDC, hPen); DeleteObject(hPen); - return TRUE; + return true; } CGdiDisplayDriver::CGdiDisplayDriver(HDC hDC) @@ -1178,8 +1178,8 @@ CGdiDisplayDriver::CGdiDisplayDriver(HDC hDC) CGdiDisplayDriver::~CGdiDisplayDriver() {} -FX_BOOL CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) { - FX_BOOL ret = FALSE; +bool CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) { + bool ret = false; int width = pBitmap->GetWidth(); int height = pBitmap->GetHeight(); HBITMAP hbmp = CreateCompatibleBitmap(m_hDC, width, height); @@ -1205,7 +1205,7 @@ FX_BOOL CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) { DIB_RGB_COLORS); ret = pBitmap->TransferBitmap(0, 0, width, height, &bitmap, 0, 0); } else { - ret = FALSE; + ret = false; } } if (pBitmap->HasAlpha() && ret) @@ -1216,12 +1216,12 @@ FX_BOOL CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) { return ret; } -FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, - uint32_t color, - const FX_RECT* pSrcRect, - int left, - int top, - int blend_type) { +bool CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, + uint32_t color, + const FX_RECT* pSrcRect, + int left, + int top, + int blend_type) { ASSERT(blend_type == FXDIB_BLEND_NORMAL); if (pSource->IsAlphaMask()) { int width = pSource->GetWidth(), height = pSource->GetHeight(); @@ -1231,9 +1231,9 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, if (!background.Create(width, height, FXDIB_Rgb32) || !GetDIBits(&background, left, top) || !background.CompositeMask(0, 0, width, height, pSource, color, 0, 0, - FXDIB_BLEND_NORMAL, nullptr, FALSE, 0, + FXDIB_BLEND_NORMAL, nullptr, false, 0, nullptr)) { - return FALSE; + return false; } FX_RECT src_rect(0, 0, width, height); return SetDIBits(&background, 0, &src_rect, left, top, @@ -1252,8 +1252,8 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, !GetDIBits(&bitmap, left, top) || !bitmap.CompositeBitmap(0, 0, width, height, pSource, pSrcRect->left, pSrcRect->top, FXDIB_BLEND_NORMAL, nullptr, - FALSE, nullptr)) { - return FALSE; + false, nullptr)) { + return false; } FX_RECT src_rect(0, 0, width, height); return SetDIBits(&bitmap, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL); @@ -1261,18 +1261,18 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, CFX_DIBExtractor temp(pSource); CFX_DIBitmap* pBitmap = temp.GetBitmap(); if (!pBitmap) - return FALSE; + return false; return GDI_SetDIBits(pBitmap, pSrcRect, left, top); } -FX_BOOL CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource, - uint32_t color, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - int render_flags) { +bool CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource, + uint32_t color, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + int render_flags) { FX_RECT bitmap_clip = *pClipRect; if (dest_width < 0) dest_left += dest_width; @@ -1284,22 +1284,22 @@ FX_BOOL CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource, std::unique_ptr<CFX_DIBitmap> pStretched( pSource->StretchTo(dest_width, dest_height, render_flags, &bitmap_clip)); if (!pStretched) - return TRUE; + return true; FX_RECT src_rect(0, 0, pStretched->GetWidth(), pStretched->GetHeight()); return SetDIBits(pStretched.get(), color, &src_rect, pClipRect->left, pClipRect->top, FXDIB_BLEND_NORMAL); } -FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, - uint32_t color, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - uint32_t flags, - int blend_type) { +bool CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, + uint32_t color, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + uint32_t flags, + int blend_type) { ASSERT(pSource && pClipRect); if (flags || dest_width > 10000 || dest_width < -10000 || dest_height > 10000 || dest_height < -10000) { @@ -1319,7 +1319,7 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, std::unique_ptr<CFX_DIBitmap> pStretched( pSource->StretchTo(dest_width, dest_height, flags, &clip_rect)); if (!pStretched) - return TRUE; + return true; CFX_DIBitmap background; if (!background.Create(clip_width, clip_height, FXDIB_Rgb32) || @@ -1327,8 +1327,8 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, image_rect.top + clip_rect.top) || !background.CompositeMask( 0, 0, clip_width, clip_height, pStretched.get(), color, 0, 0, - FXDIB_BLEND_NORMAL, nullptr, FALSE, 0, nullptr)) { - return FALSE; + FXDIB_BLEND_NORMAL, nullptr, false, 0, nullptr)) { + return false; } FX_RECT src_rect(0, 0, clip_width, clip_height); @@ -1343,7 +1343,7 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, CFX_DIBExtractor temp(pSource); CFX_DIBitmap* pBitmap = temp.GetBitmap(); if (!pBitmap) - return FALSE; + return false; return pPlatform->m_GdiplusExt.StretchDIBits( m_hDC, pBitmap, dest_left, dest_top, dest_width, dest_height, pClipRect, flags); @@ -1354,19 +1354,19 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, CFX_DIBExtractor temp(pSource); CFX_DIBitmap* pBitmap = temp.GetBitmap(); if (!pBitmap) - return FALSE; + return false; return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_height, flags); } -FX_BOOL CGdiDisplayDriver::StartDIBits(const CFX_DIBSource* pBitmap, - int bitmap_alpha, - uint32_t color, - const CFX_Matrix* pMatrix, - uint32_t render_flags, - void*& handle, - int blend_type) { - return FALSE; +bool CGdiDisplayDriver::StartDIBits(const CFX_DIBSource* pBitmap, + int bitmap_alpha, + uint32_t color, + const CFX_Matrix* pMatrix, + uint32_t render_flags, + void*& handle, + int blend_type) { + return false; } CFX_WindowsDevice::CFX_WindowsDevice(HDC hDC) { diff --git a/core/fxge/win32/fx_win32_dib.cpp b/core/fxge/win32/fx_win32_dib.cpp index 1f5688ddd2..40c9ca6e31 100644 --- a/core/fxge/win32/fx_win32_dib.cpp +++ b/core/fxge/win32/fx_win32_dib.cpp @@ -53,20 +53,20 @@ CFX_ByteString CFX_WindowsDIB::GetBitmapInfo(const CFX_DIBitmap* pBitmap) { CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData, - FX_BOOL bAlpha) { + bool bAlpha) { int width = pbmi->bmiHeader.biWidth; int height = pbmi->bmiHeader.biHeight; - BOOL bBottomUp = TRUE; + BOOL bBottomUp = true; if (height < 0) { height = -height; - bBottomUp = FALSE; + bBottomUp = false; } int pitch = (width * pbmi->bmiHeader.biBitCount + 31) / 32 * 4; CFX_DIBitmap* pBitmap = new CFX_DIBitmap; FXDIB_Format format = bAlpha ? (FXDIB_Format)(pbmi->bmiHeader.biBitCount + 0x200) : (FXDIB_Format)pbmi->bmiHeader.biBitCount; - FX_BOOL ret = pBitmap->Create(width, height, format); + bool ret = pBitmap->Create(width, height, format); if (!ret) { delete pBitmap; return nullptr; @@ -99,7 +99,7 @@ CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, } CFX_DIBitmap* CFX_WindowsDIB::LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData) { - return _FX_WindowsDIB_LoadFromBuf(pbmi, pData, FALSE); + return _FX_WindowsDIB_LoadFromBuf(pbmi, pData, false); } HBITMAP CFX_WindowsDIB::GetDDBitmap(const CFX_DIBitmap* pBitmap, HDC hDC) { diff --git a/core/fxge/win32/fx_win32_dwrite.cpp b/core/fxge/win32/fx_win32_dwrite.cpp index b12e5d7d15..dc0f5ed745 100644 --- a/core/fxge/win32/fx_win32_dwrite.cpp +++ b/core/fxge/win32/fx_win32_dwrite.cpp @@ -149,7 +149,7 @@ LPVOID CDWriteExt::DwCreateFontFaceFromStream(uint8_t* pData, IDWriteFactory* pDwFactory = (IDWriteFactory*)m_pDWriteFactory; IDWriteFontFile* pDwFontFile = nullptr; IDWriteFontFace* pDwFontFace = nullptr; - BOOL isSupportedFontType = FALSE; + BOOL isSupportedFontType = false; DWRITE_FONT_FILE_TYPE fontFileType; DWRITE_FONT_FACE_TYPE fontFaceType; UINT32 numberOfFaces; @@ -180,10 +180,10 @@ failed: return nullptr; } -FX_BOOL CDWriteExt::DwCreateRenderingTarget(CFX_DIBitmap* pBitmap, - void** renderTarget) { +bool CDWriteExt::DwCreateRenderingTarget(CFX_DIBitmap* pBitmap, + void** renderTarget) { if (pBitmap->GetFormat() > FXDIB_Argb) { - return FALSE; + return false; } IDWriteFactory* pDwFactory = (IDWriteFactory*)m_pDWriteFactory; IDWriteGdiInterop* pGdiInterop = nullptr; @@ -214,29 +214,29 @@ FX_BOOL CDWriteExt::DwCreateRenderingTarget(CFX_DIBitmap* pBitmap, SafeRelease(&pGdiInterop); SafeRelease(&pBitmapRenderTarget); SafeRelease(&pRenderingParams); - return TRUE; + return true; failed: SafeRelease(&pGdiInterop); SafeRelease(&pBitmapRenderTarget); SafeRelease(&pRenderingParams); - return FALSE; + return false; } -FX_BOOL CDWriteExt::DwRendingString(void* renderTarget, - CFX_ClipRgn* pClipRgn, - FX_RECT& stringRect, - CFX_Matrix* pMatrix, - void* font, - FX_FLOAT font_size, - FX_ARGB text_color, - int glyph_count, - unsigned short* glyph_indices, - FX_FLOAT baselineOriginX, - FX_FLOAT baselineOriginY, - void* glyph_offsets, - FX_FLOAT* glyph_advances) { +bool CDWriteExt::DwRendingString(void* renderTarget, + CFX_ClipRgn* pClipRgn, + FX_RECT& stringRect, + CFX_Matrix* pMatrix, + void* font, + FX_FLOAT font_size, + FX_ARGB text_color, + int glyph_count, + unsigned short* glyph_indices, + FX_FLOAT baselineOriginX, + FX_FLOAT baselineOriginY, + void* glyph_offsets, + FX_FLOAT* glyph_advances) { if (!renderTarget) { - return TRUE; + return true; } CDwGdiTextRenderer* pTextRenderer = (CDwGdiTextRenderer*)renderTarget; DWRITE_MATRIX transform; @@ -256,7 +256,7 @@ FX_BOOL CDWriteExt::DwRendingString(void* renderTarget, glyphRun.glyphIndices = glyph_indices; glyphRun.glyphAdvances = glyph_advances; glyphRun.glyphOffsets = (DWRITE_GLYPH_OFFSET*)glyph_offsets; - glyphRun.isSideways = FALSE; + glyphRun.isSideways = false; glyphRun.bidiLevel = 0; hr = pTextRenderer->DrawGlyphRun( stringRect, pClipRgn, pMatrix ? &transform : nullptr, baselineOriginX, diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp index 3dce58ffe3..f3bf2deae2 100644 --- a/core/fxge/win32/fx_win32_gdipext.cpp +++ b/core/fxge/win32/fx_win32_gdipext.cpp @@ -446,7 +446,7 @@ void* CGdiplusExt::GdiAddFontMemResourceEx(void* pFontdata, (DWORD*)num_face); } -FX_BOOL CGdiplusExt::GdiRemoveFontMemResourceEx(void* handle) { +bool CGdiplusExt::GdiRemoveFontMemResourceEx(void* handle) { return m_pGdiRemoveFontMemResourseEx && m_pGdiRemoveFontMemResourseEx((HANDLE)handle); } @@ -462,11 +462,11 @@ static CFX_DIBitmap* _StretchMonoToGray(int dest_width, int dest_height, const CFX_DIBitmap* pSource, FX_RECT* pClipRect) { - FX_BOOL bFlipX = dest_width < 0; + bool bFlipX = dest_width < 0; if (bFlipX) { dest_width = -dest_width; } - FX_BOOL bFlipY = dest_height < 0; + bool bFlipY = dest_height < 0; if (bFlipY) { dest_height = -dest_height; } @@ -564,7 +564,7 @@ static void OutputImageMask(GpGraphics* pGraphics, _StretchMonoToGray(dest_width, dest_height, pBitmap, &image_clip); } else { pStretched = - pBitmap->StretchTo(dest_width, dest_height, FALSE, &image_clip); + pBitmap->StretchTo(dest_width, dest_height, false, &image_clip); } GpBitmap* bitmap; CallFunc(GdipCreateBitmapFromScan0)(image_clip.Width(), image_clip.Height(), @@ -729,7 +729,7 @@ void CGdiplusExt::DeleteMemFont(LPVOID pCollection) { ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; CallFunc(GdipDeletePrivateFontCollection)((GpFontCollection**)&pCollection); } -FX_BOOL CGdiplusExt::GdipCreateBitmap(CFX_DIBitmap* pBitmap, void** bitmap) { +bool CGdiplusExt::GdipCreateBitmap(CFX_DIBitmap* pBitmap, void** bitmap) { CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; PixelFormat format; @@ -744,53 +744,53 @@ FX_BOOL CGdiplusExt::GdipCreateBitmap(CFX_DIBitmap* pBitmap, void** bitmap) { format = PixelFormat32bppARGB; break; default: - return FALSE; + return false; } GpStatus status = CallFunc(GdipCreateBitmapFromScan0)( pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap->GetPitch(), format, pBitmap->GetBuffer(), (GpBitmap**)bitmap); if (status == Ok) { - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CGdiplusExt::GdipCreateFromImage(void* bitmap, void** graphics) { +bool CGdiplusExt::GdipCreateFromImage(void* bitmap, void** graphics) { CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; GpStatus status = CallFunc(GdipGetImageGraphicsContext)( (GpBitmap*)bitmap, (GpGraphics**)graphics); if (status == Ok) { - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CGdiplusExt::GdipCreateFontFamilyFromName(const FX_WCHAR* name, - void* pFontCollection, - void** pFamily) { +bool CGdiplusExt::GdipCreateFontFamilyFromName(const FX_WCHAR* name, + void* pFontCollection, + void** pFamily) { CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; GpStatus status = CallFunc(GdipCreateFontFamilyFromName)( (GDIPCONST WCHAR*)name, (GpFontCollection*)pFontCollection, (GpFontFamily**)pFamily); if (status == Ok) { - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CGdiplusExt::GdipCreateFontFromFamily(void* pFamily, - FX_FLOAT font_size, - int fontstyle, - int flag, - void** pFont) { +bool CGdiplusExt::GdipCreateFontFromFamily(void* pFamily, + FX_FLOAT font_size, + int fontstyle, + int flag, + void** pFont) { CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; GpStatus status = CallFunc(GdipCreateFont)((GpFontFamily*)pFamily, font_size, fontstyle, Unit(flag), (GpFont**)pFont); if (status == Ok) { - return TRUE; + return true; } - return FALSE; + return false; } void CGdiplusExt::GdipGetFontSize(void* pFont, FX_FLOAT* size) { REAL get_size; @@ -814,14 +814,14 @@ void CGdiplusExt::GdipSetPageUnit(void* graphics, uint32_t unit) { ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; CallFunc(GdipSetPageUnit)((GpGraphics*)graphics, (GpUnit)unit); } -FX_BOOL CGdiplusExt::GdipDrawDriverString(void* graphics, - unsigned short* text, - int length, - void* font, - void* brush, - void* positions, - int flags, - const void* matrix) { +bool CGdiplusExt::GdipDrawDriverString(void* graphics, + unsigned short* text, + int length, + void* font, + void* brush, + void* positions, + int flags, + const void* matrix) { CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; GpStatus status = CallFunc(GdipDrawDriverString)( @@ -829,9 +829,9 @@ FX_BOOL CGdiplusExt::GdipDrawDriverString(void* graphics, (GDIPCONST GpFont*)font, (GDIPCONST GpBrush*)brush, (GDIPCONST PointF*)positions, (INT)flags, (GDIPCONST GpMatrix*)matrix); if (status == Ok) { - return TRUE; + return true; } - return FALSE; + return false; } void CGdiplusExt::GdipCreateBrush(uint32_t fill_argb, void** pBrush) { CGdiplusExt& GdiplusExt = @@ -909,16 +909,16 @@ void CGdiplusExt::GdipDeleteGraphics(void* graphics) { ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; CallFunc(GdipDeleteGraphics)((GpGraphics*)graphics); } -FX_BOOL CGdiplusExt::StretchBitMask(HDC hDC, - BOOL bMonoDevice, - const CFX_DIBitmap* pBitmap, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - uint32_t argb, - const FX_RECT* pClipRect, - int flags) { +bool CGdiplusExt::StretchBitMask(HDC hDC, + BOOL bMonoDevice, + const CFX_DIBitmap* pBitmap, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + uint32_t argb, + const FX_RECT* pClipRect, + int flags) { ASSERT(pBitmap->GetBPP() == 1); CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; @@ -934,16 +934,16 @@ FX_BOOL CGdiplusExt::StretchBitMask(HDC hDC, OutputImageMask(pGraphics, bMonoDevice, pBitmap, dest_left, dest_top, dest_width, dest_height, argb, pClipRect); CallFunc(GdipDeleteGraphics)(pGraphics); - return TRUE; + return true; } -FX_BOOL CGdiplusExt::StretchDIBits(HDC hDC, - const CFX_DIBitmap* pBitmap, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - int flags) { +bool CGdiplusExt::StretchDIBits(HDC hDC, + const CFX_DIBitmap* pBitmap, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + int flags) { GpGraphics* pGraphics; CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; @@ -963,12 +963,12 @@ FX_BOOL CGdiplusExt::StretchDIBits(HDC hDC, dest_height); CallFunc(GdipDeleteGraphics)(pGraphics); CallFunc(GdipDeleteGraphics)(pGraphics); - return TRUE; + return true; } static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState, const CFX_Matrix* pMatrix, DWORD argb, - FX_BOOL bTextMode = FALSE) { + bool bTextMode = false) { CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; FX_FLOAT width = pGraphState ? pGraphState->m_LineWidth : 1.0f; @@ -984,7 +984,7 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState, CallFunc(GdipCreatePen1)((ARGB)argb, width, UnitWorld, &pPen); LineCap lineCap = LineCapFlat; DashCap dashCap = DashCapFlat; - FX_BOOL bDashExtend = FALSE; + bool bDashExtend = false; switch (pGraphState->m_LineCap) { case CFX_GraphStateData::LineCapButt: lineCap = LineCapFlat; @@ -992,11 +992,11 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState, case CFX_GraphStateData::LineCapRound: lineCap = LineCapRound; dashCap = DashCapRound; - bDashExtend = TRUE; + bDashExtend = true; break; case CFX_GraphStateData::LineCapSquare: lineCap = LineCapSquare; - bDashExtend = TRUE; + bDashExtend = true; break; } CallFunc(GdipSetPenLineCap197819)(pPen, lineCap, lineCap, dashCap); @@ -1071,10 +1071,10 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState, CallFunc(GdipSetPenMiterLimit)(pPen, pGraphState->m_MiterLimit); return pPen; } -static FX_BOOL IsSmallTriangle(PointF* points, - const CFX_Matrix* pMatrix, - int& v1, - int& v2) { +static bool IsSmallTriangle(PointF* points, + const CFX_Matrix* pMatrix, + int& v1, + int& v2) { int pairs[] = {1, 2, 0, 2, 0, 1}; for (int i = 0; i < 3; i++) { int pair1 = pairs[i * 2]; @@ -1091,21 +1091,21 @@ static FX_BOOL IsSmallTriangle(PointF* points, if (distance_square < (1.0f * 2 + 1.0f / 4)) { v1 = i; v2 = pair1; - return TRUE; + return true; } } - return FALSE; + return false; } -FX_BOOL CGdiplusExt::DrawPath(HDC hDC, - const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - const CFX_GraphStateData* pGraphState, - uint32_t fill_argb, - uint32_t stroke_argb, - int fill_mode) { +bool CGdiplusExt::DrawPath(HDC hDC, + const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + const CFX_GraphStateData* pGraphState, + uint32_t fill_argb, + uint32_t stroke_argb, + int fill_mode) { int nPoints = pPathData->GetPointCount(); if (nPoints == 0) { - return TRUE; + return true; } FX_PATHPOINT* pPoints = pPathData->GetPoints(); GpGraphics* pGraphics = nullptr; @@ -1124,9 +1124,9 @@ FX_BOOL CGdiplusExt::DrawPath(HDC hDC, PointF* points = FX_Alloc(PointF, nPoints); BYTE* types = FX_Alloc(BYTE, nPoints); int nSubPathes = 0; - FX_BOOL bSubClose = FALSE; + bool bSubClose = false; int pos_subclose = 0; - FX_BOOL bSmooth = FALSE; + bool bSmooth = false; int startpoint = 0; for (int i = 0; i < nPoints; i++) { points[i].X = pPoints[i].m_PointX; @@ -1154,7 +1154,7 @@ FX_BOOL CGdiplusExt::DrawPath(HDC hDC, if (point_type == FXPT_MOVETO) { types[i] = PathPointTypeStart; nSubPathes++; - bSubClose = FALSE; + bSubClose = false; startpoint = i; } else if (point_type == FXPT_LINETO) { types[i] = PathPointTypeLine; @@ -1166,32 +1166,32 @@ FX_BOOL CGdiplusExt::DrawPath(HDC hDC, } if (!bSmooth && points[i].X != points[i - 1].X && points[i].Y != points[i - 1].Y) { - bSmooth = TRUE; + bSmooth = true; } } else if (point_type == FXPT_BEZIERTO) { types[i] = PathPointTypeBezier; - bSmooth = TRUE; + bSmooth = true; } if (pPoints[i].m_Flag & FXPT_CLOSEFIGURE) { if (bSubClose) { types[pos_subclose] &= ~PathPointTypeCloseSubpath; } else { - bSubClose = TRUE; + bSubClose = true; } pos_subclose = i; types[i] |= PathPointTypeCloseSubpath; if (!bSmooth && points[i].X != points[startpoint].X && points[i].Y != points[startpoint].Y) { - bSmooth = TRUE; + bSmooth = true; } } } if (fill_mode & FXFILL_NOPATHSMOOTH) { - bSmooth = FALSE; + bSmooth = false; CallFunc(GdipSetSmoothingMode)(pGraphics, SmoothingModeNone); } else if (!(fill_mode & FXFILL_FULLCOVER)) { if (!bSmooth && (fill_mode & 3)) { - bSmooth = TRUE; + bSmooth = true; } if (bSmooth || (pGraphState && pGraphState->m_LineWidth > 2)) { CallFunc(GdipSetSmoothingMode)(pGraphics, SmoothingModeAntiAlias); @@ -1207,7 +1207,7 @@ FX_BOOL CGdiplusExt::DrawPath(HDC hDC, pGraphics, pPen, FXSYS_round(points[v1].X), FXSYS_round(points[v1].Y), FXSYS_round(points[v2].X), FXSYS_round(points[v2].Y)); CallFunc(GdipDeletePen)(pPen); - return TRUE; + return true; } } GpPath* pGpPath = nullptr; @@ -1220,7 +1220,7 @@ FX_BOOL CGdiplusExt::DrawPath(HDC hDC, FX_Free(points); FX_Free(types); CallFunc(GdipDeleteGraphics)(pGraphics); - return FALSE; + return false; } if (new_fill_mode) { GpBrush* pBrush = _GdipCreateBrush(fill_argb); @@ -1256,7 +1256,7 @@ FX_BOOL CGdiplusExt::DrawPath(HDC hDC, FX_Free(types); CallFunc(GdipDeletePath)(pGpPath); CallFunc(GdipDeleteGraphics)(pGraphics); - return TRUE; + return true; } class GpStream final : public IStream { @@ -1497,7 +1497,7 @@ static void FreeDIBitmap(PREVIEW3_DIBITMAP* pInfo) { CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData, - FX_BOOL bAlpha); + bool bAlpha); CFX_DIBitmap* CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) { PREVIEW3_DIBITMAP* pInfo = ::LoadDIBitmap(args); if (!pInfo) { diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp index ab12a92b1c..5a1a01a418 100644 --- a/core/fxge/win32/fx_win32_print.cpp +++ b/core/fxge/win32/fx_win32_print.cpp @@ -66,12 +66,12 @@ int CGdiPrinterDriver::GetDeviceCaps(int caps_id) const { return CGdiDeviceDriver::GetDeviceCaps(caps_id); } -FX_BOOL CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource, - uint32_t color, - const FX_RECT* pSrcRect, - int left, - int top, - int blend_type) { +bool CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource, + uint32_t color, + const FX_RECT* pSrcRect, + int left, + int top, + int blend_type) { if (pSource->IsAlphaMask()) { FX_RECT clip_rect(left, top, left + pSrcRect->Width(), top + pSrcRect->Height()); @@ -83,35 +83,35 @@ FX_BOOL CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource, ASSERT(pSource && !pSource->IsAlphaMask() && pSrcRect); ASSERT(blend_type == FXDIB_BLEND_NORMAL); if (pSource->HasAlpha()) - return FALSE; + return false; CFX_DIBExtractor temp(pSource); CFX_DIBitmap* pBitmap = temp.GetBitmap(); if (!pBitmap) - return FALSE; + return false; return GDI_SetDIBits(pBitmap, pSrcRect, left, top); } -FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource, - uint32_t color, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - uint32_t flags, - int blend_type) { +bool CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource, + uint32_t color, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + uint32_t flags, + int blend_type) { if (pSource->IsAlphaMask()) { int alpha = FXARGB_A(color); if (pSource->GetBPP() != 1 || alpha != 255) - return FALSE; + return false; if (dest_width < 0 || dest_height < 0) { std::unique_ptr<CFX_DIBitmap> pFlipped( pSource->FlipImage(dest_width < 0, dest_height < 0)); if (!pFlipped) - return FALSE; + return false; if (dest_width < 0) dest_left += dest_width; @@ -126,19 +126,19 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource, CFX_DIBExtractor temp(pSource); CFX_DIBitmap* pBitmap = temp.GetBitmap(); if (!pBitmap) - return FALSE; + return false; return GDI_StretchBitMask(pBitmap, dest_left, dest_top, dest_width, dest_height, color, flags); } if (pSource->HasAlpha()) - return FALSE; + return false; if (dest_width < 0 || dest_height < 0) { std::unique_ptr<CFX_DIBitmap> pFlipped( pSource->FlipImage(dest_width < 0, dest_height < 0)); if (!pFlipped) - return FALSE; + return false; if (dest_width < 0) dest_left += dest_width; @@ -152,28 +152,28 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource, CFX_DIBExtractor temp(pSource); CFX_DIBitmap* pBitmap = temp.GetBitmap(); if (!pBitmap) - return FALSE; + return false; return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_height, flags); } -FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, - int bitmap_alpha, - uint32_t color, - const CFX_Matrix* pMatrix, - uint32_t render_flags, - void*& handle, - int blend_type) { +bool CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, + int bitmap_alpha, + uint32_t color, + const CFX_Matrix* pMatrix, + uint32_t render_flags, + void*& handle, + int blend_type) { if (bitmap_alpha < 255 || pSource->HasAlpha() || (pSource->IsAlphaMask() && (pSource->GetBPP() != 1))) { - return FALSE; + return false; } CFX_FloatRect unit_rect = pMatrix->GetUnitRect(); FX_RECT full_rect = unit_rect.GetOuterRect(); if (FXSYS_fabs(pMatrix->b) < 0.5f && pMatrix->a != 0 && FXSYS_fabs(pMatrix->c) < 0.5f && pMatrix->d != 0) { - FX_BOOL bFlipX = pMatrix->a < 0; - FX_BOOL bFlipY = pMatrix->d > 0; + bool bFlipX = pMatrix->a < 0; + bool bFlipY = pMatrix->d > 0; return StretchDIBits(pSource, color, bFlipX ? full_rect.right : full_rect.left, bFlipY ? full_rect.bottom : full_rect.top, @@ -182,30 +182,30 @@ FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, nullptr, 0, blend_type); } if (FXSYS_fabs(pMatrix->a) >= 0.5f || FXSYS_fabs(pMatrix->d) >= 0.5f) - return FALSE; + return false; std::unique_ptr<CFX_DIBitmap> pTransformed( pSource->SwapXY(pMatrix->c > 0, pMatrix->b < 0)); if (!pTransformed) - return FALSE; + return false; return StretchDIBits(pTransformed.get(), color, full_rect.left, full_rect.top, full_rect.Width(), full_rect.Height(), nullptr, 0, blend_type); } -FX_BOOL CGdiPrinterDriver::DrawDeviceText(int nChars, - const FXTEXT_CHARPOS* pCharPos, - CFX_Font* pFont, - const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, - uint32_t color) { +bool CGdiPrinterDriver::DrawDeviceText(int nChars, + const FXTEXT_CHARPOS* pCharPos, + CFX_Font* pFont, + const CFX_Matrix* pObject2Device, + FX_FLOAT font_size, + uint32_t color) { #if defined(PDFIUM_PRINT_TEXT_WITH_GDI) if (!g_pdfium_print_text_with_gdi) - return FALSE; + return false; if (nChars < 1 || !pFont || !pFont->IsEmbedded() || !pFont->IsTTFont()) - return FALSE; + return false; // Scale factor used to minimize the kerning problems caused by rounding // errors below. Value choosen based on the title of https://crbug.com/18383 @@ -236,34 +236,34 @@ FX_BOOL CGdiPrinterDriver::DrawDeviceText(int nChars, HFONT hFont = CreateFontIndirect(&lf); if (!hFont) - return FALSE; + return false; ScopedState state(m_hDC, hFont); size_t nTextMetricSize = GetOutlineTextMetrics(m_hDC, 0, nullptr); if (nTextMetricSize == 0) { // Give up and fail if there is no way to get the font to try again. if (!g_pdfium_typeface_accessible_func) - return FALSE; + return false; // Try to get the font. Any letter will do. g_pdfium_typeface_accessible_func(&lf, L"A", 1); nTextMetricSize = GetOutlineTextMetrics(m_hDC, 0, nullptr); if (nTextMetricSize == 0) - return FALSE; + return false; } std::vector<BYTE> buf(nTextMetricSize); OUTLINETEXTMETRIC* pTextMetric = reinterpret_cast<OUTLINETEXTMETRIC*>(buf.data()); if (GetOutlineTextMetrics(m_hDC, nTextMetricSize, pTextMetric) == 0) - return FALSE; + return false; // If the selected font is not the requested font, then bail out. This can // happen with web fonts, for example. wchar_t* wsSelectedName = reinterpret_cast<wchar_t*>( buf.data() + reinterpret_cast<size_t>(pTextMetric->otmpFaceName)); if (wsName != wsSelectedName) - return FALSE; + return false; // Transforms SetGraphicsMode(m_hDC, GM_ADVANCED); @@ -311,18 +311,18 @@ FX_BOOL CGdiPrinterDriver::DrawDeviceText(int nChars, SetTextAlign(m_hDC, TA_LEFT | TA_BASELINE); if (ExtTextOutW(m_hDC, 0, 0, ETO_GLYPH_INDEX, nullptr, wsText.c_str(), nChars, nChars > 1 ? &spacing[1] : nullptr)) { - return TRUE; + return true; } // Give up and fail if there is no way to get the font to try again. if (!g_pdfium_typeface_accessible_func) - return FALSE; + return false; // Try to get the font and draw again. g_pdfium_typeface_accessible_func(&lf, wsText.c_str(), nChars); return !!ExtTextOutW(m_hDC, 0, 0, ETO_GLYPH_INDEX, nullptr, wsText.c_str(), nChars, nChars > 1 ? &spacing[1] : nullptr); #else - return FALSE; + return false; #endif } diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h index 1f2bc50f42..fa1cc6830e 100644 --- a/core/fxge/win32/win32_int.h +++ b/core/fxge/win32/win32_int.h @@ -27,48 +27,48 @@ class CGdiplusExt { CGdiplusExt(); ~CGdiplusExt(); void Load(); - FX_BOOL IsAvailable() { return !!m_hModule; } - FX_BOOL StretchBitMask(HDC hDC, - BOOL bMonoDevice, - const CFX_DIBitmap* pBitmap, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - uint32_t argb, - const FX_RECT* pClipRect, - int flags); - FX_BOOL StretchDIBits(HDC hDC, - const CFX_DIBitmap* pBitmap, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - int flags); - FX_BOOL DrawPath(HDC hDC, - const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - const CFX_GraphStateData* pGraphState, - uint32_t fill_argb, - uint32_t stroke_argb, - int fill_mode); + bool IsAvailable() { return !!m_hModule; } + bool StretchBitMask(HDC hDC, + BOOL bMonoDevice, + const CFX_DIBitmap* pBitmap, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + uint32_t argb, + const FX_RECT* pClipRect, + int flags); + bool StretchDIBits(HDC hDC, + const CFX_DIBitmap* pBitmap, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + int flags); + bool DrawPath(HDC hDC, + const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + const CFX_GraphStateData* pGraphState, + uint32_t fill_argb, + uint32_t stroke_argb, + int fill_mode); void* LoadMemFont(uint8_t* pData, uint32_t size); void DeleteMemFont(void* pFontCollection); - FX_BOOL GdipCreateFromImage(void* bitmap, void** graphics); + bool GdipCreateFromImage(void* bitmap, void** graphics); void GdipDeleteGraphics(void* graphics); void GdipSetTextRenderingHint(void* graphics, int mode); void GdipSetPageUnit(void* graphics, uint32_t unit); void GdipSetWorldTransform(void* graphics, void* pMatrix); - FX_BOOL GdipDrawDriverString(void* graphics, - unsigned short* text, - int length, - void* font, - void* brush, - void* positions, - int flags, - const void* matrix); + bool GdipDrawDriverString(void* graphics, + unsigned short* text, + int length, + void* font, + void* brush, + void* positions, + int flags, + const void* matrix); void GdipCreateBrush(uint32_t fill_argb, void** pBrush); void GdipDeleteBrush(void* pBrush); void GdipCreateMatrix(FX_FLOAT a, @@ -79,27 +79,27 @@ class CGdiplusExt { FX_FLOAT f, void** matrix); void GdipDeleteMatrix(void* matrix); - FX_BOOL GdipCreateFontFamilyFromName(const FX_WCHAR* name, - void* pFontCollection, - void** pFamily); + bool GdipCreateFontFamilyFromName(const FX_WCHAR* name, + void* pFontCollection, + void** pFamily); void GdipDeleteFontFamily(void* pFamily); - FX_BOOL GdipCreateFontFromFamily(void* pFamily, - FX_FLOAT font_size, - int fontstyle, - int flag, - void** pFont); + bool GdipCreateFontFromFamily(void* pFamily, + FX_FLOAT font_size, + int fontstyle, + int flag, + void** pFont); void* GdipCreateFontFromCollection(void* pFontCollection, FX_FLOAT font_size, int fontstyle); void GdipDeleteFont(void* pFont); - FX_BOOL GdipCreateBitmap(CFX_DIBitmap* pBitmap, void** bitmap); + bool GdipCreateBitmap(CFX_DIBitmap* pBitmap, void** bitmap); void GdipDisposeImage(void* bitmap); void GdipGetFontSize(void* pFont, FX_FLOAT* size); void* GdiAddFontMemResourceEx(void* pFontdata, uint32_t size, void* pdv, uint32_t* num_face); - FX_BOOL GdiRemoveFontMemResourceEx(void* handle); + bool GdiRemoveFontMemResourceEx(void* handle); CFX_DIBitmap* LoadDIBitmap(WINDIB_Open_Args_ args); FARPROC m_Functions[100]; @@ -113,7 +113,7 @@ class CGdiplusExt { class CWin32Platform { public: - FX_BOOL m_bHalfTone; + bool m_bHalfTone; CGdiplusExt m_GdiplusExt; CDWriteExt m_DWriteExt; }; @@ -127,29 +127,29 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver { int GetDeviceCaps(int caps_id) const override; void SaveState() override; void RestoreState(bool bKeepSaved) override; - FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - int fill_mode) override; - FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - const CFX_GraphStateData* pGraphState) override; - FX_BOOL DrawPath(const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - const CFX_GraphStateData* pGraphState, - uint32_t fill_color, - uint32_t stroke_color, - int fill_mode, - int blend_type) override; - FX_BOOL FillRectWithBlend(const FX_RECT* pRect, - uint32_t fill_color, - int blend_type) override; - FX_BOOL DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - uint32_t color, - int blend_type) override; - FX_BOOL GetClipBox(FX_RECT* pRect) override; + bool SetClip_PathFill(const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + int fill_mode) override; + bool SetClip_PathStroke(const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + const CFX_GraphStateData* pGraphState) override; + bool DrawPath(const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + const CFX_GraphStateData* pGraphState, + uint32_t fill_color, + uint32_t stroke_color, + int fill_mode, + int blend_type) override; + bool FillRectWithBlend(const FX_RECT* pRect, + uint32_t fill_color, + int blend_type) override; + bool DrawCosmeticLine(FX_FLOAT x1, + FX_FLOAT y1, + FX_FLOAT x2, + FX_FLOAT y2, + uint32_t color, + int blend_type) override; + bool GetClipBox(FX_RECT* pRect) override; void* GetPlatformSurface() const override; void DrawLine(FX_FLOAT x1, @@ -158,23 +158,23 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver { FX_FLOAT y2, const CFX_Matrix* pMatrix); - FX_BOOL GDI_SetDIBits(CFX_DIBitmap* pBitmap, - const FX_RECT* pSrcRect, - int left, - int top); - FX_BOOL GDI_StretchDIBits(CFX_DIBitmap* pBitmap, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - uint32_t flags); - FX_BOOL GDI_StretchBitMask(CFX_DIBitmap* pBitmap, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - uint32_t bitmap_color, - uint32_t flags); + bool GDI_SetDIBits(CFX_DIBitmap* pBitmap, + const FX_RECT* pSrcRect, + int left, + int top); + bool GDI_StretchDIBits(CFX_DIBitmap* pBitmap, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + uint32_t flags); + bool GDI_StretchBitMask(CFX_DIBitmap* pBitmap, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + uint32_t bitmap_color, + uint32_t flags); HDC m_hDC; int m_Width; @@ -190,37 +190,37 @@ class CGdiDisplayDriver : public CGdiDeviceDriver { ~CGdiDisplayDriver() override; protected: - FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override; - FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - uint32_t color, - const FX_RECT* pSrcRect, - int left, - int top, - int blend_type) override; - FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - uint32_t color, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - uint32_t flags, - int blend_type) override; - FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, - int bitmap_alpha, - uint32_t color, - const CFX_Matrix* pMatrix, - uint32_t render_flags, - void*& handle, - int blend_type) override; - FX_BOOL UseFoxitStretchEngine(const CFX_DIBSource* pSource, - uint32_t color, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - int render_flags); + bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override; + bool SetDIBits(const CFX_DIBSource* pBitmap, + uint32_t color, + const FX_RECT* pSrcRect, + int left, + int top, + int blend_type) override; + bool StretchDIBits(const CFX_DIBSource* pBitmap, + uint32_t color, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + uint32_t flags, + int blend_type) override; + bool StartDIBits(const CFX_DIBSource* pBitmap, + int bitmap_alpha, + uint32_t color, + const CFX_Matrix* pMatrix, + uint32_t render_flags, + void*& handle, + int blend_type) override; + bool UseFoxitStretchEngine(const CFX_DIBSource* pSource, + uint32_t color, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + int render_flags); }; class CGdiPrinterDriver : public CGdiDeviceDriver { @@ -230,34 +230,34 @@ class CGdiPrinterDriver : public CGdiDeviceDriver { protected: int GetDeviceCaps(int caps_id) const override; - FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - uint32_t color, - const FX_RECT* pSrcRect, - int left, - int top, - int blend_type) override; - FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - uint32_t color, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - uint32_t flags, - int blend_type) override; - FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, - int bitmap_alpha, - uint32_t color, - const CFX_Matrix* pMatrix, - uint32_t render_flags, - void*& handle, - int blend_type) override; - FX_BOOL DrawDeviceText(int nChars, - const FXTEXT_CHARPOS* pCharPos, - CFX_Font* pFont, - const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, - uint32_t color) override; + bool SetDIBits(const CFX_DIBSource* pBitmap, + uint32_t color, + const FX_RECT* pSrcRect, + int left, + int top, + int blend_type) override; + bool StretchDIBits(const CFX_DIBSource* pBitmap, + uint32_t color, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + uint32_t flags, + int blend_type) override; + bool StartDIBits(const CFX_DIBSource* pBitmap, + int bitmap_alpha, + uint32_t color, + const CFX_Matrix* pMatrix, + uint32_t render_flags, + void*& handle, + int blend_type) override; + bool DrawDeviceText(int nChars, + const FXTEXT_CHARPOS* pCharPos, + CFX_Font* pFont, + const CFX_Matrix* pObject2Device, + FX_FLOAT font_size, + uint32_t color) override; const int m_HorzSize; const int m_VertSize; |