summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-23 13:36:00 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-23 13:36:00 -0700
commitf1e7c461dfabbff6b65a072f24f6711b34159361 (patch)
tree3b0bb772a59669f06b86824a444fd06642592d4b /fpdfsdk/src/pdfwindow/PWL_Utils.cpp
parent320b2313d19869333ed453af546e61a9fc2b81c9 (diff)
downloadpdfium-f1e7c461dfabbff6b65a072f24f6711b34159361.tar.xz
Revert "FX_BOOL considered harmful, part 2."
This reverts commit 320b2313d19869333ed453af546e61a9fc2b81c9. Reason for revert: build failure. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1255693002 .
Diffstat (limited to 'fpdfsdk/src/pdfwindow/PWL_Utils.cpp')
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Utils.cpp104
1 files changed, 52 insertions, 52 deletions
diff --git a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
index 4e4ac94238..b9ba7661af 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
@@ -87,13 +87,13 @@ CPDF_Rect CPWL_Utils::OffsetRect(const CPDF_Rect & rect,FX_FLOAT x,FX_FLOAT y)
rect.right + x,rect.top + y);
}
-bool CPWL_Utils::ContainsRect(const CPDF_Rect& rcParent, const CPDF_Rect& rcChild)
+FX_BOOL CPWL_Utils::ContainsRect(const CPDF_Rect& rcParent, const CPDF_Rect& rcChild)
{
return rcChild.left >= rcParent.left && rcChild.bottom >= rcParent.bottom &&
rcChild.right <= rcParent.right && rcChild.top <= rcParent.top;
}
-bool CPWL_Utils::IntersectRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2)
+FX_BOOL CPWL_Utils::IntersectRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2)
{
FX_FLOAT left = rect1.left > rect2.left ? rect1.left : rect2.left;
FX_FLOAT right = rect1.right < rect2.right ? rect1.right : rect2.right;
@@ -420,7 +420,7 @@ CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CPDF_Rect & rect,const CPW
{
CFX_ByteTextBuf sAppStream;
- CFX_ByteString sColor = GetColorAppStream(color,true);
+ CFX_ByteString sColor = GetColorAppStream(color,TRUE);
if (sColor.GetLength() > 0)
{
sAppStream << "q\n" << sColor;
@@ -435,7 +435,7 @@ CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CPDF_Rect & rect,const C
{
CFX_ByteTextBuf sAppStream;
- CFX_ByteString sColor = GetColorAppStream(color,true);
+ CFX_ByteString sColor = GetColorAppStream(color,TRUE);
if (sColor.GetLength() > 0)
{
sAppStream << "q\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << "f\nQ\n";
@@ -458,7 +458,7 @@ CPDF_Rect CPWL_Utils::GetCenterSquare(const CPDF_Rect & rect)
}
CFX_ByteString CPWL_Utils::GetEditAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange * pRange,
- bool bContinuous, FX_WORD SubWord)
+ FX_BOOL bContinuous, FX_WORD SubWord)
{
return IFX_Edit::GetEditAppearanceStream(pEdit,ptOffset,pRange,bContinuous,SubWord);
}
@@ -498,7 +498,7 @@ static CFX_ByteString GetWordSpellCheckAppearanceStream(IFX_Edit_Iterator* pIter
FX_FLOAT fY = 0.0f;
FX_FLOAT fStep = 0.0f;
- bool bBreak = false;
+ FX_BOOL bBreak = FALSE;
if (pIterator)
{
@@ -538,7 +538,7 @@ static CFX_ByteString GetWordSpellCheckAppearanceStream(IFX_Edit_Iterator* pIter
fEndX = word.ptWord.x + word.fWidth;
}
- bBreak = true;
+ bBreak = TRUE;
}
else
{
@@ -569,7 +569,7 @@ CFX_ByteString CPWL_Utils::GetSpellCheckAppStream(IFX_Edit* pEdit, IPWL_SpellChe
{
pIterator->SetAt(pRange->BeginPos);
- bool bLatinWord = false;
+ FX_BOOL bLatinWord = FALSE;
CPVT_WordPlace wpWordStart;
CFX_ByteString sWord;
@@ -587,7 +587,7 @@ CFX_ByteString CPWL_Utils::GetSpellCheckAppStream(IFX_Edit* pEdit, IPWL_SpellChe
if (!bLatinWord)
{
wpWordStart = place;
- bLatinWord = true;
+ bLatinWord = TRUE;
}
sWord += (char)word.Word;
@@ -602,7 +602,7 @@ CFX_ByteString CPWL_Utils::GetSpellCheckAppStream(IFX_Edit* pEdit, IPWL_SpellChe
sRet << GetWordSpellCheckAppearanceStream(pIterator,ptOffset,CPVT_WordRange(wpWordStart,oldplace));
pIterator->SetAt(place);
}
- bLatinWord = false;
+ bLatinWord = FALSE;
}
sWord.Empty();
@@ -614,7 +614,7 @@ CFX_ByteString CPWL_Utils::GetSpellCheckAppStream(IFX_Edit* pEdit, IPWL_SpellChe
{
if (!pSpellCheck->CheckWord(sWord))
sRet << GetWordSpellCheckAppearanceStream(pIterator,ptOffset,CPVT_WordRange(wpWordStart,oldplace));
- bLatinWord = false;
+ bLatinWord = FALSE;
sWord.Empty();
}
}
@@ -625,7 +625,7 @@ CFX_ByteString CPWL_Utils::GetSpellCheckAppStream(IFX_Edit* pEdit, IPWL_SpellChe
if (!pSpellCheck->CheckWord(sWord))
sRet << GetWordSpellCheckAppearanceStream(pIterator,ptOffset,CPVT_WordRange(wpWordStart,oldplace));
- bLatinWord = false;
+ bLatinWord = FALSE;
sWord.Empty();
}
}
@@ -636,7 +636,7 @@ CFX_ByteString CPWL_Utils::GetSpellCheckAppStream(IFX_Edit* pEdit, IPWL_SpellChe
CFX_ByteString CPWL_Utils::GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_FontMap * pFontMap,
const CFX_WideString & sText, int32_t nAlignmentH, int32_t nAlignmentV,
- FX_FLOAT fFontSize, bool bMultiLine, bool bAutoReturn, const CPWL_Color & crText)
+ FX_FLOAT fFontSize, FX_BOOL bMultiLine, FX_BOOL bAutoReturn, const CPWL_Color & crText)
{
CFX_ByteTextBuf sRet;
@@ -649,7 +649,7 @@ CFX_ByteString CPWL_Utils::GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_Fo
pEdit->SetMultiLine(bMultiLine);
pEdit->SetAutoReturn(bAutoReturn);
if (IsFloatZero(fFontSize))
- pEdit->SetAutoFontSize(true);
+ pEdit->SetAutoFontSize(TRUE);
else
pEdit->SetFontSize(fFontSize);
@@ -683,10 +683,10 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox,
pEdit->SetFontMap(pFontMap);
pEdit->SetAlignmentH(1);
pEdit->SetAlignmentV(1);
- pEdit->SetMultiLine(false);
- pEdit->SetAutoReturn(false);
+ pEdit->SetMultiLine(FALSE);
+ pEdit->SetAutoReturn(FALSE);
if (IsFloatZero(fFontSize))
- pEdit->SetAutoFontSize(true);
+ pEdit->SetAutoFontSize(TRUE);
else
pEdit->SetFontSize(fFontSize);
@@ -892,7 +892,7 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox,
if (!rcIcon.IsEmpty())
{
- Icon.Move(rcIcon, false, false);
+ Icon.Move(rcIcon, FALSE, FALSE);
sTemp << Icon.GetImageAppStream();
}
@@ -923,7 +923,7 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox,
return "";
}
-CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color & color,const bool & bFillOrStroke)
+CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color & color,const FX_BOOL & bFillOrStroke)
{
CFX_ByteTextBuf sColorStream;
@@ -967,7 +967,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT f
{
default:
case PBS_SOLID:
- sColor = CPWL_Utils::GetColorAppStream(color,true);
+ sColor = CPWL_Utils::GetColorAppStream(color,TRUE);
if (sColor.GetLength() > 0)
{
sAppStream << sColor;
@@ -978,7 +978,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT f
}
break;
case PBS_DASH:
- sColor = CPWL_Utils::GetColorAppStream(color,false);
+ sColor = CPWL_Utils::GetColorAppStream(color,FALSE);
if (sColor.GetLength() > 0)
{
sAppStream << sColor;
@@ -992,7 +992,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT f
break;
case PBS_BEVELED:
case PBS_INSET:
- sColor = CPWL_Utils::GetColorAppStream(crLeftTop,true);
+ sColor = CPWL_Utils::GetColorAppStream(crLeftTop,TRUE);
if (sColor.GetLength() > 0)
{
sAppStream << sColor;
@@ -1004,7 +1004,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT f
sAppStream << fLeft + fHalfWidth * 2 << " " << fBottom + fHalfWidth * 2 << " l f\n";
}
- sColor = CPWL_Utils::GetColorAppStream(crRightBottom,true);
+ sColor = CPWL_Utils::GetColorAppStream(crRightBottom,TRUE);
if (sColor.GetLength() > 0)
{
sAppStream << sColor;
@@ -1016,7 +1016,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT f
sAppStream << fRight - fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 << " l f\n";
}
- sColor = CPWL_Utils::GetColorAppStream(color,true);
+ sColor = CPWL_Utils::GetColorAppStream(color,TRUE);
if (sColor.GetLength() > 0)
{
sAppStream << sColor;
@@ -1026,7 +1026,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT f
}
break;
case PBS_UNDERLINED:
- sColor = CPWL_Utils::GetColorAppStream(color,false);
+ sColor = CPWL_Utils::GetColorAppStream(color,FALSE);
if (sColor.GetLength() > 0)
{
sAppStream << sColor;
@@ -1065,7 +1065,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F
case PBS_SOLID:
case PBS_UNDERLINED:
{
- sColor = CPWL_Utils::GetColorAppStream(color,false);
+ sColor = CPWL_Utils::GetColorAppStream(color,FALSE);
if (sColor.GetLength() > 0)
{
sAppStream << "q\n" << fWidth << " w\n" << sColor
@@ -1076,7 +1076,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F
break;
case PBS_DASH:
{
- sColor = CPWL_Utils::GetColorAppStream(color,false);
+ sColor = CPWL_Utils::GetColorAppStream(color,FALSE);
if (sColor.GetLength() > 0)
{
sAppStream << "q\n" << fWidth << " w\n"
@@ -1090,7 +1090,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F
{
FX_FLOAT fHalfWidth = fWidth / 2.0f;
- sColor = CPWL_Utils::GetColorAppStream(color,false);
+ sColor = CPWL_Utils::GetColorAppStream(color,FALSE);
if (sColor.GetLength() > 0)
{
sAppStream << "q\n" << fHalfWidth << " w\n"
@@ -1098,7 +1098,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F
<< " S\nQ\n";
}
- sColor = CPWL_Utils::GetColorAppStream(crLeftTop,false);
+ sColor = CPWL_Utils::GetColorAppStream(crLeftTop,FALSE);
if (sColor.GetLength() > 0)
{
sAppStream << "q\n" << fHalfWidth << " w\n"
@@ -1106,7 +1106,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F
<< " S\nQ\n";
}
- sColor = CPWL_Utils::GetColorAppStream(crRightBottom,false);
+ sColor = CPWL_Utils::GetColorAppStream(crRightBottom,FALSE);
if (sColor.GetLength() > 0)
{
sAppStream << "q\n" << fHalfWidth << " w\n"
@@ -1119,7 +1119,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F
{
FX_FLOAT fHalfWidth = fWidth / 2.0f;
- sColor = CPWL_Utils::GetColorAppStream(color,false);
+ sColor = CPWL_Utils::GetColorAppStream(color,FALSE);
if (sColor.GetLength() > 0)
{
sAppStream << "q\n" << fHalfWidth << " w\n"
@@ -1127,7 +1127,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F
<< " S\nQ\n";
}
- sColor = CPWL_Utils::GetColorAppStream(crLeftTop,false);
+ sColor = CPWL_Utils::GetColorAppStream(crLeftTop,FALSE);
if (sColor.GetLength() > 0)
{
sAppStream << "q\n" << fHalfWidth << " w\n"
@@ -1135,7 +1135,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F
<< " S\nQ\n";
}
- sColor = CPWL_Utils::GetColorAppStream(crRightBottom,false);
+ sColor = CPWL_Utils::GetColorAppStream(crRightBottom,FALSE);
if (sColor.GetLength() > 0)
{
sAppStream << "q\n" << fHalfWidth << " w\n"
@@ -1208,42 +1208,42 @@ CPWL_Color CPWL_Utils::DevideColor(const CPWL_Color & sColor,FX_FLOAT fColorDevi
CFX_ByteString CPWL_Utils::GetAppStream_Check(const CPDF_Rect & rcBBox, const CPWL_Color & crText)
{
CFX_ByteTextBuf sAP;
- sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,true) << CPWL_Utils::GetAP_Check(rcBBox) << "f\nQ\n";
+ sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils::GetAP_Check(rcBBox) << "f\nQ\n";
return sAP.GetByteString();
}
CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CPDF_Rect & rcBBox, const CPWL_Color & crText)
{
CFX_ByteTextBuf sAP;
- sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,true) << CPWL_Utils::GetAP_Circle(rcBBox) << "f\nQ\n";
+ sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils::GetAP_Circle(rcBBox) << "f\nQ\n";
return sAP.GetByteString();
}
CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CPDF_Rect & rcBBox, const CPWL_Color & crText)
{
CFX_ByteTextBuf sAP;
- sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,false) << CPWL_Utils::GetAP_Cross(rcBBox) << "S\nQ\n";
+ sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,FALSE) << CPWL_Utils::GetAP_Cross(rcBBox) << "S\nQ\n";
return sAP.GetByteString();
}
CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CPDF_Rect & rcBBox, const CPWL_Color & crText)
{
CFX_ByteTextBuf sAP;
- sAP << "q\n1 w\n" << CPWL_Utils::GetColorAppStream(crText,true) << CPWL_Utils::GetAP_Diamond(rcBBox) << "f\nQ\n";
+ sAP << "q\n1 w\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils::GetAP_Diamond(rcBBox) << "f\nQ\n";
return sAP.GetByteString();
}
CFX_ByteString CPWL_Utils::GetAppStream_Square(const CPDF_Rect & rcBBox, const CPWL_Color & crText)
{
CFX_ByteTextBuf sAP;
- sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,true) << CPWL_Utils::GetAP_Square(rcBBox) << "f\nQ\n";
+ sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils::GetAP_Square(rcBBox) << "f\nQ\n";
return sAP.GetByteString();
}
CFX_ByteString CPWL_Utils::GetAppStream_Star(const CPDF_Rect & rcBBox, const CPWL_Color & crText)
{
CFX_ByteTextBuf sAP;
- sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,true) << CPWL_Utils::GetAP_Star(rcBBox) << "f\nQ\n";
+ sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils::GetAP_Star(rcBBox) << "f\nQ\n";
return sAP.GetByteString();
}
@@ -1299,7 +1299,7 @@ CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CPDF_Rect & rcBBox)
if (!rcBBox.IsEmpty())
{
- sAppStream << "q\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_RGB,220.0f/255.0f,220.0f/255.0f,220.0f/255.0f),true);
+ sAppStream << "q\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_RGB,220.0f/255.0f,220.0f/255.0f,220.0f/255.0f),TRUE);
sAppStream << rcBBox.left << " " << rcBBox.bottom << " "
<< rcBBox.right - rcBBox.left << " " << rcBBox.top - rcBBox.bottom << " re f\n";
sAppStream << "Q\n";
@@ -1474,7 +1474,7 @@ void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devi
}
void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- bool bVertical, bool bHorizontal, CPDF_Rect rect,
+ FX_BOOL bVertical, FX_BOOL bHorizontal, CPDF_Rect rect,
int32_t nTransparancy, int32_t nStartGray, int32_t nEndGray)
{
FX_FLOAT fStepGray = 1.0f;
@@ -1638,7 +1638,7 @@ static void AddSpellCheckObj(CFX_PathData & PathData, IFX_Edit* pEdit, const CPV
FX_FLOAT fY = 0.0f;
FX_FLOAT fStep = 0.0f;
- bool bBreak = false;
+ FX_BOOL bBreak = FALSE;
if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator())
{
@@ -1678,7 +1678,7 @@ static void AddSpellCheckObj(CFX_PathData & PathData, IFX_Edit* pEdit, const CPV
fEndX = word.ptWord.x + word.fWidth;
}
- bBreak = true;
+ bBreak = TRUE;
}
else
{
@@ -1700,7 +1700,7 @@ void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse
const FX_COLORREF crSpell = ArgbEncode(255,255,0,0);
//for spellcheck
- bool bLatinWord = false;
+ FX_BOOL bLatinWord = FALSE;
CPVT_WordPlace wpWordStart;
CFX_ByteString sLatinWord;
@@ -1744,7 +1744,7 @@ void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse
if (!bLatinWord)
{
wpWordStart = place;
- bLatinWord = true;
+ bLatinWord = TRUE;
}
sLatinWord += (char)word.Word;
@@ -1761,7 +1761,7 @@ void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse
pIterator->SetAt(place);
}
}
- bLatinWord = false;
+ bLatinWord = FALSE;
}
sLatinWord.Empty();
@@ -1781,7 +1781,7 @@ void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse
pIterator->SetAt(place);
}
}
- bLatinWord = false;
+ bLatinWord = FALSE;
}
sLatinWord.Empty();
@@ -1806,12 +1806,12 @@ void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse
pDevice->RestoreState();
}
-bool CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color)
+FX_BOOL CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color)
{
switch (color.nColorType)
{
case COLORTYPE_TRANSPARENT:
- return false;
+ return FALSE;
case COLORTYPE_GRAY:
return color.fColor1 < 0.5f;
case COLORTYPE_RGB:
@@ -1820,7 +1820,7 @@ bool CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color)
return color.fColor1 + color.fColor2 + color.fColor3 + color.fColor4 > 2.0f;
}
- return true;
+ return TRUE;
}
CPWL_Color CPWL_Utils::GetReverseColor(const CPWL_Color& color)
@@ -1851,8 +1851,8 @@ CPWL_Color CPWL_Utils::GetReverseColor(const CPWL_Color& color)
CFX_ByteString CPWL_Utils::GetIconAppStream(int32_t nType, const CPDF_Rect& rect, const CPWL_Color& crFill,
const CPWL_Color& crStroke)
{
- CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, false);
- sAppStream += CPWL_Utils::GetColorAppStream(crFill, true);
+ CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, FALSE);
+ sAppStream += CPWL_Utils::GetColorAppStream(crFill, TRUE);
CFX_ByteString sPath;
CFX_PathData path;