summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-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
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render.cpp22
-rw-r--r--core/fxcrt/include/cfx_count_ref.h4
7 files changed, 24 insertions, 36 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,
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp
index 576be6a8d4..f24a66857d 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -260,7 +260,7 @@ void CPDF_RenderStatus::RenderSingleObject(const CPDF_PageObject* pObj,
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 @@ FX_BOOL CPDF_RenderStatus::ContinueSingleObject(const CPDF_PageObject* pObj,
}
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 @@ FX_ARGB CPDF_RenderStatus::GetStrokeArgb(const CPDF_PageObject* pObj) const {
}
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::ProcessClipPath(CPDF_ClipPath ClipPath,
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 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
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 cc7cf3d9ed..7dbd5dfe26 100644
--- a/core/fxcrt/include/cfx_count_ref.h
+++ b/core/fxcrt/include/cfx_count_ref.h
@@ -30,9 +30,6 @@ class CFX_CountRef {
}
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 @@ class CFX_CountRef {
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 {