summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_page
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-08-26 14:56:39 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-26 14:56:39 -0700
commit83d2351fd64128156c9abfb70266133d58a5e525 (patch)
treeb975e59ff6a31fbe86b289294fe65f9150e18fb6 /core/fpdfapi/fpdf_page
parent0ee35908e906922a423fb18d7085ef80d0d8d8c8 (diff)
downloadpdfium-83d2351fd64128156c9abfb70266133d58a5e525.tar.xz
Remove CFX_CountRef::IsNull in favor of operator bool
Review-Url: https://codereview.chromium.org/2285513002
Diffstat (limited to 'core/fpdfapi/fpdf_page')
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_pageobject.cpp6
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_pathobject.cpp3
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp7
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser.cpp4
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp14
5 files changed, 13 insertions, 21 deletions
diff --git a/core/fpdfapi/fpdf_page/cpdf_pageobject.cpp b/core/fpdfapi/fpdf_page/cpdf_pageobject.cpp
index 31d3823891..238675cb1c 100644
--- a/core/fpdfapi/fpdf_page/cpdf_pageobject.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_pageobject.cpp
@@ -79,17 +79,15 @@ void CPDF_PageObject::CopyData(const CPDF_PageObject* pSrc) {
}
void CPDF_PageObject::TransformClipPath(CFX_Matrix& matrix) {
- if (m_ClipPath.IsNull()) {
+ if (!m_ClipPath)
return;
- }
m_ClipPath.GetModify();
m_ClipPath.Transform(matrix);
}
void CPDF_PageObject::TransformGeneralState(CFX_Matrix& matrix) {
- if (m_GeneralState.IsNull()) {
+ if (!m_GeneralState)
return;
- }
CPDF_GeneralStateData* pGS = m_GeneralState.GetModify();
pGS->m_Matrix.Concat(matrix);
}
diff --git a/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp b/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp
index b62a5bd25a..0055d6a133 100644
--- a/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp
@@ -43,9 +43,8 @@ const CPDF_PathObject* CPDF_PathObject::AsPath() const {
}
void CPDF_PathObject::CalcBoundingBox() {
- if (m_Path.IsNull()) {
+ if (!m_Path)
return;
- }
CFX_FloatRect rect;
FX_FLOAT width = m_GraphState.GetObject()->m_LineWidth;
if (m_bStroke && width != 0) {
diff --git a/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp b/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp
index b2eb5e642c..968c53bc07 100644
--- a/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp
@@ -35,12 +35,12 @@ CPDF_PageObject::Type CPDF_ShadingObject::GetType() const {
}
void CPDF_ShadingObject::Transform(const CFX_Matrix& matrix) {
- if (!m_ClipPath.IsNull()) {
+ if (m_ClipPath) {
m_ClipPath.GetModify();
m_ClipPath.Transform(matrix);
}
m_Matrix.Concat(matrix);
- if (!m_ClipPath.IsNull()) {
+ if (m_ClipPath) {
CalcBoundingBox();
} else {
matrix.TransformRect(m_Left, m_Right, m_Top, m_Bottom);
@@ -60,9 +60,8 @@ const CPDF_ShadingObject* CPDF_ShadingObject::AsShading() const {
}
void CPDF_ShadingObject::CalcBoundingBox() {
- if (m_ClipPath.IsNull()) {
+ if (!m_ClipPath)
return;
- }
CFX_FloatRect rect = m_ClipPath.GetClipBox();
m_Left = rect.left;
m_Bottom = rect.bottom;
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 805d648a24..8d3f5b8859 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -808,7 +808,7 @@ void CPDF_StreamContentParser::Handle_MarkPlace_Dictionary() {}
void CPDF_StreamContentParser::Handle_EndImage() {}
void CPDF_StreamContentParser::Handle_EndMarkedContent() {
- if (m_CurContentMark.IsNull())
+ if (!m_CurContentMark)
return;
int count = m_CurContentMark.GetObject()->CountItems();
@@ -1103,7 +1103,7 @@ void CPDF_StreamContentParser::Handle_ShadeFill() {
pObj->m_Matrix = m_pCurStates->m_CTM;
pObj->m_Matrix.Concat(m_mtContentToUser);
CFX_FloatRect bbox =
- pObj->m_ClipPath.IsNull() ? m_BBox : pObj->m_ClipPath.GetClipBox();
+ pObj->m_ClipPath ? pObj->m_ClipPath.GetClipBox() : m_BBox;
if (pShading->IsMeshShading())
bbox.Intersect(GetShadingBBox(pShading, pObj->m_Matrix));
pObj->m_Left = bbox.left;
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index 2b7ac6fc2a..dbfd741887 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -706,7 +706,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm,
pParentMatrix, pForm, pResources, &form_bbox, pGraphicStates, level));
m_pParser->GetCurStates()->m_CTM = form_matrix;
m_pParser->GetCurStates()->m_ParentMatrix = form_matrix;
- if (ClipPath.NotNull()) {
+ if (ClipPath) {
m_pParser->GetCurStates()->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING,
TRUE);
}
@@ -799,19 +799,15 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) {
FXSYS_round(m_pParser->GetType3Data()[5] * 1000);
}
for (auto& pObj : *m_pObjectHolder->GetPageObjectList()) {
- if (pObj->m_ClipPath.IsNull()) {
+ if (!pObj->m_ClipPath)
continue;
- }
- if (pObj->m_ClipPath.GetPathCount() != 1) {
+ if (pObj->m_ClipPath.GetPathCount() != 1)
continue;
- }
- if (pObj->m_ClipPath.GetTextCount()) {
+ if (pObj->m_ClipPath.GetTextCount())
continue;
- }
CPDF_Path ClipPath = pObj->m_ClipPath.GetPath(0);
- if (!ClipPath.IsRect() || pObj->IsShading()) {
+ if (!ClipPath.IsRect() || pObj->IsShading())
continue;
- }
CFX_FloatRect old_rect(ClipPath.GetPointX(0), ClipPath.GetPointY(0),
ClipPath.GetPointX(2), ClipPath.GetPointY(2));
CFX_FloatRect obj_rect(pObj->m_Left, pObj->m_Bottom, pObj->m_Right,