Remove CFX_CountRef::IsNull in favor of operator bool

Review-Url: https://codereview.chromium.org/2285513002
diff --git a/core/fpdfapi/fpdf_page/cpdf_pageobject.cpp b/core/fpdfapi/fpdf_page/cpdf_pageobject.cpp
index 31d3823..238675c 100644
--- a/core/fpdfapi/fpdf_page/cpdf_pageobject.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_pageobject.cpp
@@ -79,17 +79,15 @@
 }
 
 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 b62a5bd..0055d6a 100644
--- a/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp
@@ -43,9 +43,8 @@
 }
 
 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 b2eb5e6..968c53b 100644
--- a/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp
@@ -35,12 +35,12 @@
 }
 
 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 @@
 }
 
 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 805d648..8d3f5b8 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_EndImage() {}
 
 void CPDF_StreamContentParser::Handle_EndMarkedContent() {
-  if (m_CurContentMark.IsNull())
+  if (!m_CurContentMark)
     return;
 
   int count = m_CurContentMark.GetObject()->CountItems();
@@ -1103,7 +1103,7 @@
   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 2b7ac6f..dbfd741 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 @@
       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 @@
             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,
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp
index 576be6a..f24a668 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -260,7 +260,7 @@
     return;
   }
   m_pCurObj = pObj;
-  if (m_Options.m_pOCContext && pObj->m_ContentMark.NotNull()) {
+  if (m_Options.m_pOCContext && pObj->m_ContentMark) {
     if (!m_Options.m_pOCContext->CheckObjectVisible(pObj)) {
       return;
     }
@@ -289,7 +289,7 @@
   }
 
   m_pCurObj = pObj;
-  if (m_Options.m_pOCContext && pObj->m_ContentMark.NotNull() &&
+  if (m_Options.m_pOCContext && pObj->m_ContentMark &&
       !m_Options.m_pOCContext->CheckObjectVisible(pObj)) {
     return FALSE;
   }
@@ -574,8 +574,8 @@
 }
 void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath,
                                         const CFX_Matrix* pObj2Device) {
-  if (ClipPath.IsNull()) {
-    if (!m_LastClipPath.IsNull()) {
+  if (!ClipPath) {
+    if (m_LastClipPath) {
       m_pDevice->RestoreState(true);
       m_LastClipPath.SetNull();
     }
@@ -634,9 +634,9 @@
 
 void CPDF_RenderStatus::DrawClipPath(CPDF_ClipPath ClipPath,
                                      const CFX_Matrix* pObj2Device) {
-  if (ClipPath.IsNull()) {
+  if (!ClipPath)
     return;
-  }
+
   int fill_mode = 0;
   if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) {
     fill_mode |= FXFILL_NOPATHSMOOTH;
@@ -713,12 +713,10 @@
       pFormResource = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources");
     }
   }
-  FX_BOOL bTextClip = FALSE;
-  if (pPageObj->m_ClipPath.NotNull() && pPageObj->m_ClipPath.GetTextCount() &&
-      m_pDevice->GetDeviceClass() == FXDC_DISPLAY &&
-      !(m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_SOFT_CLIP)) {
-    bTextClip = TRUE;
-  }
+  bool bTextClip =
+      (pPageObj->m_ClipPath && pPageObj->m_ClipPath.GetTextCount() &&
+       m_pDevice->GetDeviceClass() == FXDC_DISPLAY &&
+       !(m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_SOFT_CLIP));
   if ((m_Options.m_Flags & RENDER_OVERPRINT) && pPageObj->IsImage() &&
       pGeneralState && pGeneralState->m_FillOP && pGeneralState->m_StrokeOP) {
     CPDF_Document* pDocument = nullptr;
diff --git a/core/fxcrt/include/cfx_count_ref.h b/core/fxcrt/include/cfx_count_ref.h
index cc7cf3d..7dbd5df 100644
--- a/core/fxcrt/include/cfx_count_ref.h
+++ b/core/fxcrt/include/cfx_count_ref.h
@@ -30,9 +30,6 @@
   }
 
   void SetNull() { m_pObject.Reset(); }
-  bool IsNull() const { return !m_pObject; }
-  bool NotNull() const { return !IsNull(); }
-
   const ObjClass* GetObject() const { return m_pObject.Get(); }
 
   template <typename... Args>
@@ -48,6 +45,7 @@
     return m_pObject == that.m_pObject;
   }
   bool operator!=(const CFX_CountRef& that) const { return !(*this == that); }
+  operator bool() const { return m_pObject; }
 
  protected:
   class CountedObj : public ObjClass {