Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(748)

Unified Diff: core/src/fxge/win32/fx_win32_gdipext.cpp

Issue 1252613002: FX_BOOL considered harmful. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual edits. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fxge/win32/fx_win32_dwrite.cpp ('k') | core/src/fxge/win32/fx_win32_print.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxge/win32/fx_win32_gdipext.cpp
diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp
index 8fef914cd8aa374045fdc144c452443f4e391b51..5d1922ab6c01921e4894b41e75ff4d28fddd1b6c 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);
« no previous file with comments | « core/src/fxge/win32/fx_win32_dwrite.cpp ('k') | core/src/fxge/win32/fx_win32_print.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698