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

Unified Diff: core/src/fpdfapi/fpdf_page/fpdf_page_pattern.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/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp ('k') | core/src/fpdfapi/fpdf_page/pageint.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
index 48b3a40495d3331054483c497ad18409765e2ff3..8292d2d90eed403707f494492fd9ae16c716fcf3 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
@@ -8,7 +8,7 @@
#include "pageint.h"
CPDF_Pattern::CPDF_Pattern(const CFX_AffineMatrix* pParentMatrix) :
- m_pPatternObj(NULL), m_PatternType(PATTERN_TILING), m_pDocument(NULL), m_bForceClear(FALSE)
+ m_pPatternObj(NULL), m_PatternType(PATTERN_TILING), m_pDocument(NULL), m_bForceClear(false)
{
if (pParentMatrix) {
m_ParentMatrix = *pParentMatrix;
@@ -37,28 +37,28 @@ CPDF_TilingPattern::~CPDF_TilingPattern()
delete m_pForm;
m_pForm = NULL;
}
-FX_BOOL CPDF_TilingPattern::Load()
+bool CPDF_TilingPattern::Load()
{
if (m_pForm != NULL) {
- return TRUE;
+ return true;
}
CPDF_Dictionary* pDict = m_pPatternObj->GetDict();
if (pDict == NULL) {
- return FALSE;
+ return false;
}
m_bColored = pDict->GetInteger(FX_BSTRC("PaintType")) == 1;
m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumber(FX_BSTRC("XStep")));
m_YStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumber(FX_BSTRC("YStep")));
if (m_pPatternObj->GetType() != PDFOBJ_STREAM) {
- return FALSE;
+ return false;
}
CPDF_Stream* pStream = (CPDF_Stream*)m_pPatternObj;
m_pForm = new CPDF_Form(m_pDocument, NULL, pStream);
m_pForm->ParseContent(NULL, &m_ParentMatrix, NULL, NULL);
m_BBox = pDict->GetRect(FX_BSTRC("BBox"));
- return TRUE;
+ return true;
}
-CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc, CPDF_Object* pPatternObj, FX_BOOL bShading, const CFX_AffineMatrix* parentMatrix) : CPDF_Pattern(parentMatrix)
+CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc, CPDF_Object* pPatternObj, bool bShading, const CFX_AffineMatrix* parentMatrix) : CPDF_Pattern(parentMatrix)
{
m_PatternType = PATTERN_SHADING;
m_pPatternObj = bShading ? NULL : pPatternObj;
@@ -102,14 +102,14 @@ void CPDF_ShadingPattern::Clear()
m_pCountedCS = NULL;
m_nFuncs = 0;
}
-FX_BOOL CPDF_ShadingPattern::Load()
+bool CPDF_ShadingPattern::Load()
{
if (m_ShadingType != 0) {
- return TRUE;
+ return true;
}
CPDF_Dictionary* pShadingDict = m_pShadingObj ? m_pShadingObj->GetDict() : NULL;
if (pShadingDict == NULL) {
- return FALSE;
+ return false;
}
if (m_nFuncs) {
for (int i = 0; i < m_nFuncs; i ++)
@@ -133,7 +133,7 @@ FX_BOOL CPDF_ShadingPattern::Load()
}
CPDF_Object* pCSObj = pShadingDict->GetElementValue(FX_BSTRC("ColorSpace"));
if (pCSObj == NULL) {
- return FALSE;
+ return false;
}
CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData();
m_pCS = pDocPageData->GetColorSpace(pCSObj, NULL);
@@ -141,14 +141,14 @@ FX_BOOL CPDF_ShadingPattern::Load()
m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray());
}
m_ShadingType = pShadingDict->GetInteger(FX_BSTRC("ShadingType"));
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_ShadingPattern::Reload()
+bool CPDF_ShadingPattern::Reload()
{
Clear();
return Load();
}
-FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, CPDF_Function** pFuncs, int nFuncs, CPDF_ColorSpace* pCS)
+bool CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, CPDF_Function** pFuncs, int nFuncs, CPDF_ColorSpace* pCS)
{
m_Stream.LoadAllData(pShadingStream);
m_BitStream.Init(m_Stream.GetData(), m_Stream.GetSize());
@@ -160,21 +160,21 @@ FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, CPDF_Function** pFunc
m_nCompBits = pDict->GetInteger(FX_BSTRC("BitsPerComponent"));
m_nFlagBits = pDict->GetInteger(FX_BSTRC("BitsPerFlag"));
if (!m_nCoordBits || !m_nCompBits) {
- return FALSE;
+ return false;
}
int nComps = pCS->CountComponents();
if (nComps > 8) {
- return FALSE;
+ return false;
}
m_nComps = nFuncs ? 1 : nComps;
if (((int)m_nComps < 0) || m_nComps > 8) {
- return FALSE;
+ return false;
}
m_CoordMax = m_nCoordBits == 32 ? -1 : (1 << m_nCoordBits) - 1;
m_CompMax = (1 << m_nCompBits) - 1;
CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode"));
if (pDecode == NULL || pDecode->GetCount() != 4 + m_nComps * 2) {
- return FALSE;
+ return false;
}
m_xmin = pDecode->GetNumber(0);
m_xmax = pDecode->GetNumber(1);
@@ -184,7 +184,7 @@ FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, CPDF_Function** pFunc
m_ColorMin[i] = pDecode->GetNumber(i * 2 + 4);
m_ColorMax[i] = pDecode->GetNumber(i * 2 + 5);
}
- return TRUE;
+ return true;
}
FX_DWORD CPDF_MeshStream::GetFlag()
{
@@ -231,18 +231,18 @@ FX_DWORD CPDF_MeshStream::GetVertex(CPDF_MeshVertex& vertex, CFX_AffineMatrix* p
m_BitStream.ByteAlign();
return flag;
}
-FX_BOOL CPDF_MeshStream::GetVertexRow(CPDF_MeshVertex* vertex, int count, CFX_AffineMatrix* pObject2Bitmap)
+bool CPDF_MeshStream::GetVertexRow(CPDF_MeshVertex* vertex, int count, CFX_AffineMatrix* pObject2Bitmap)
{
for (int i = 0; i < count; i ++) {
if (m_BitStream.IsEOF()) {
- return FALSE;
+ return false;
}
GetCoords(vertex[i].x, vertex[i].y);
pObject2Bitmap->Transform(vertex[i].x, vertex[i].y);
GetColor(vertex[i].r, vertex[i].g, vertex[i].b);
m_BitStream.ByteAlign();
}
- return TRUE;
+ return true;
}
CFX_FloatRect _GetShadingBBox(CPDF_Stream* pStream, int type, const CFX_AffineMatrix* pMatrix,
CPDF_Function** pFuncs, int nFuncs, CPDF_ColorSpace* pCS)
@@ -255,8 +255,8 @@ CFX_FloatRect _GetShadingBBox(CPDF_Stream* pStream, int type, const CFX_AffineMa
return CFX_FloatRect(0, 0, 0, 0);
}
CFX_FloatRect rect;
- FX_BOOL bStarted = FALSE;
- FX_BOOL bGouraud = type == 4 || type == 5;
+ bool bStarted = false;
+ bool bGouraud = type == 4 || type == 5;
int full_point_count = type == 7 ? 16 : (type == 6 ? 12 : 1);
int full_color_count = (type == 6 || type == 7) ? 4 : 1;
while (!stream.m_BitStream.IsEOF()) {
@@ -276,7 +276,7 @@ CFX_FloatRect _GetShadingBBox(CPDF_Stream* pStream, int type, const CFX_AffineMa
rect.UpdateRect(x, y);
} else {
rect.InitRect(x, y);
- bStarted = TRUE;
+ bStarted = true;
}
}
stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits * color_count);
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp ('k') | core/src/fpdfapi/fpdf_page/pageint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698