From 83d2351fd64128156c9abfb70266133d58a5e525 Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 26 Aug 2016 14:56:39 -0700 Subject: Remove CFX_CountRef::IsNull in favor of operator bool Review-Url: https://codereview.chromium.org/2285513002 --- core/fpdfapi/fpdf_page/cpdf_pageobject.cpp | 6 ++---- core/fpdfapi/fpdf_page/cpdf_pathobject.cpp | 3 +-- core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp | 7 +++---- core/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 4 ++-- core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 14 +++++--------- 5 files changed, 13 insertions(+), 21 deletions(-) (limited to 'core/fpdfapi/fpdf_page') 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, -- cgit v1.2.3