summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-05-10 14:00:53 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-10 21:08:04 +0000
commit0a0892626d24ce82e7026c32c71b1de036d4bbe1 (patch)
tree470bca7e1c5b27c967d246706d21018fd4d2d1f2 /core/fpdfapi/page
parent6f62ccd50ff85ba6a60ddf47993745739854cd8f (diff)
downloadpdfium-0a0892626d24ce82e7026c32c71b1de036d4bbe1.tar.xz
Replace operator bool with HasRef() in classes with a CFX_SharedCopyOnWrite member.
Change-Id: I51e30d298e87b9ae0d5aca83b2f1d6787efce70a Reviewed-on: https://pdfium-review.googlesource.com/5290 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r--core/fpdfapi/page/cpdf_clippath.h2
-rw-r--r--core/fpdfapi/page/cpdf_colorstate.h2
-rw-r--r--core/fpdfapi/page/cpdf_contentmark.h2
-rw-r--r--core/fpdfapi/page/cpdf_contentparser.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_generalstate.h2
-rw-r--r--core/fpdfapi/page/cpdf_pageobject.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_path.h2
-rw-r--r--core/fpdfapi/page/cpdf_pathobject.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_shadingobject.cpp6
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp4
10 files changed, 15 insertions, 15 deletions
diff --git a/core/fpdfapi/page/cpdf_clippath.h b/core/fpdfapi/page/cpdf_clippath.h
index dd44cb250e..8493a9ccd9 100644
--- a/core/fpdfapi/page/cpdf_clippath.h
+++ b/core/fpdfapi/page/cpdf_clippath.h
@@ -28,7 +28,7 @@ class CPDF_ClipPath {
void Emplace() { m_Ref.Emplace(); }
void SetNull() { m_Ref.SetNull(); }
- explicit operator bool() const { return !!m_Ref; }
+ bool HasRef() const { return !!m_Ref; }
bool operator==(const CPDF_ClipPath& that) const {
return m_Ref == that.m_Ref;
}
diff --git a/core/fpdfapi/page/cpdf_colorstate.h b/core/fpdfapi/page/cpdf_colorstate.h
index f66eac3d81..0862f489bd 100644
--- a/core/fpdfapi/page/cpdf_colorstate.h
+++ b/core/fpdfapi/page/cpdf_colorstate.h
@@ -44,7 +44,7 @@ class CPDF_ColorState {
void SetFillPattern(CPDF_Pattern* pattern, float* pValue, uint32_t nValues);
void SetStrokePattern(CPDF_Pattern* pattern, float* pValue, uint32_t nValues);
- explicit operator bool() const { return !!m_Ref; }
+ bool HasRef() const { return !!m_Ref; }
private:
class ColorData {
diff --git a/core/fpdfapi/page/cpdf_contentmark.h b/core/fpdfapi/page/cpdf_contentmark.h
index 154f19d529..5782addc93 100644
--- a/core/fpdfapi/page/cpdf_contentmark.h
+++ b/core/fpdfapi/page/cpdf_contentmark.h
@@ -35,7 +35,7 @@ class CPDF_ContentMark {
bool bDirect);
void DeleteLastMark();
- explicit operator bool() const { return !!m_Ref; }
+ bool HasRef() const { return !!m_Ref; }
private:
class MarkData {
diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp
index 96bc7a2221..eeac3c17b1 100644
--- a/core/fpdfapi/page/cpdf_contentparser.cpp
+++ b/core/fpdfapi/page/cpdf_contentparser.cpp
@@ -102,7 +102,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) {
+ if (ClipPath.HasRef()) {
m_pParser->GetCurStates()->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING,
true);
}
@@ -195,7 +195,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) {
FXSYS_round(m_pParser->GetType3Data()[5] * 1000);
}
for (auto& pObj : *m_pObjectHolder->GetPageObjectList()) {
- if (!pObj->m_ClipPath)
+ if (!pObj->m_ClipPath.HasRef())
continue;
if (pObj->m_ClipPath.GetPathCount() != 1)
continue;
diff --git a/core/fpdfapi/page/cpdf_generalstate.h b/core/fpdfapi/page/cpdf_generalstate.h
index 8de5a36ca6..9305785256 100644
--- a/core/fpdfapi/page/cpdf_generalstate.h
+++ b/core/fpdfapi/page/cpdf_generalstate.h
@@ -22,7 +22,7 @@ class CPDF_GeneralState {
~CPDF_GeneralState();
void Emplace() { m_Ref.Emplace(); }
- explicit operator bool() const { return !!m_Ref; }
+ bool HasRef() const { return !!m_Ref; }
void SetRenderIntent(const CFX_ByteString& ri);
diff --git a/core/fpdfapi/page/cpdf_pageobject.cpp b/core/fpdfapi/page/cpdf_pageobject.cpp
index c0e031e7ed..09a98eee7d 100644
--- a/core/fpdfapi/page/cpdf_pageobject.cpp
+++ b/core/fpdfapi/page/cpdf_pageobject.cpp
@@ -79,13 +79,13 @@ void CPDF_PageObject::CopyData(const CPDF_PageObject* pSrc) {
}
void CPDF_PageObject::TransformClipPath(CFX_Matrix& matrix) {
- if (!m_ClipPath)
+ if (!m_ClipPath.HasRef())
return;
m_ClipPath.Transform(matrix);
}
void CPDF_PageObject::TransformGeneralState(CFX_Matrix& matrix) {
- if (!m_GeneralState)
+ if (!m_GeneralState.HasRef())
return;
m_GeneralState.GetMutableMatrix()->Concat(matrix);
}
diff --git a/core/fpdfapi/page/cpdf_path.h b/core/fpdfapi/page/cpdf_path.h
index 84b844e798..4bbb4b870e 100644
--- a/core/fpdfapi/page/cpdf_path.h
+++ b/core/fpdfapi/page/cpdf_path.h
@@ -22,7 +22,7 @@ class CPDF_Path {
~CPDF_Path();
void Emplace() { m_Ref.Emplace(); }
- explicit operator bool() const { return !!m_Ref; }
+ bool HasRef() const { return !!m_Ref; }
const std::vector<FX_PATHPOINT>& GetPoints() const;
void ClosePath();
diff --git a/core/fpdfapi/page/cpdf_pathobject.cpp b/core/fpdfapi/page/cpdf_pathobject.cpp
index 1dd0a88f78..c4d55bc20f 100644
--- a/core/fpdfapi/page/cpdf_pathobject.cpp
+++ b/core/fpdfapi/page/cpdf_pathobject.cpp
@@ -32,7 +32,7 @@ const CPDF_PathObject* CPDF_PathObject::AsPath() const {
}
void CPDF_PathObject::CalcBoundingBox() {
- if (!m_Path)
+ if (!m_Path.HasRef())
return;
CFX_FloatRect rect;
float width = m_GraphState.GetLineWidth();
diff --git a/core/fpdfapi/page/cpdf_shadingobject.cpp b/core/fpdfapi/page/cpdf_shadingobject.cpp
index 928b0af47e..5454380cae 100644
--- a/core/fpdfapi/page/cpdf_shadingobject.cpp
+++ b/core/fpdfapi/page/cpdf_shadingobject.cpp
@@ -19,11 +19,11 @@ CPDF_PageObject::Type CPDF_ShadingObject::GetType() const {
}
void CPDF_ShadingObject::Transform(const CFX_Matrix& matrix) {
- if (m_ClipPath)
+ if (m_ClipPath.HasRef())
m_ClipPath.Transform(matrix);
m_Matrix.Concat(matrix);
- if (m_ClipPath) {
+ if (m_ClipPath.HasRef()) {
CalcBoundingBox();
} else {
matrix.TransformRect(m_Left, m_Right, m_Top, m_Bottom);
@@ -43,7 +43,7 @@ const CPDF_ShadingObject* CPDF_ShadingObject::AsShading() const {
}
void CPDF_ShadingObject::CalcBoundingBox() {
- if (!m_ClipPath)
+ if (!m_ClipPath.HasRef())
return;
CFX_FloatRect rect = m_ClipPath.GetClipBox();
m_Left = rect.left;
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 3e6e75a53e..099ddf6b05 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -838,7 +838,7 @@ void CPDF_StreamContentParser::Handle_MarkPlace_Dictionary() {}
void CPDF_StreamContentParser::Handle_EndImage() {}
void CPDF_StreamContentParser::Handle_EndMarkedContent() {
- if (m_CurContentMark)
+ if (m_CurContentMark.HasRef())
m_CurContentMark.DeleteLastMark();
}
@@ -1121,7 +1121,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 ? pObj->m_ClipPath.GetClipBox() : m_BBox;
+ pObj->m_ClipPath.HasRef() ? pObj->m_ClipPath.GetClipBox() : m_BBox;
if (pShading->IsMeshShading())
bbox.Intersect(GetShadingBBox(pShading, pObj->m_Matrix));
pObj->m_Left = bbox.left;