summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r--core/fpdfapi/page/cpdf_clippath.cpp20
-rw-r--r--core/fpdfapi/page/cpdf_pageobject.cpp10
-rw-r--r--core/fpdfapi/page/cpdf_pageobject.h3
3 files changed, 17 insertions, 16 deletions
diff --git a/core/fpdfapi/page/cpdf_clippath.cpp b/core/fpdfapi/page/cpdf_clippath.cpp
index 465a2d3549..9782469786 100644
--- a/core/fpdfapi/page/cpdf_clippath.cpp
+++ b/core/fpdfapi/page/cpdf_clippath.cpp
@@ -55,21 +55,21 @@ CFX_FloatRect CPDF_ClipPath::GetClipBox() const {
bool bLayerStarted = false;
for (size_t i = 0; i < GetTextCount(); ++i) {
CPDF_TextObject* pTextObj = GetText(i);
- if (!pTextObj) {
- if (!bStarted) {
- rect = layer_rect;
- bStarted = true;
+ if (pTextObj) {
+ if (bLayerStarted) {
+ layer_rect.Union(CFX_FloatRect(pTextObj->GetBBox()));
} else {
- rect.Intersect(layer_rect);
+ layer_rect = CFX_FloatRect(pTextObj->GetBBox());
+ bLayerStarted = true;
}
- bLayerStarted = false;
} else {
- if (!bLayerStarted) {
- layer_rect = CFX_FloatRect(pTextObj->GetBBox(nullptr));
- bLayerStarted = true;
+ if (bStarted) {
+ rect.Intersect(layer_rect);
} else {
- layer_rect.Union(CFX_FloatRect(pTextObj->GetBBox(nullptr)));
+ rect = layer_rect;
+ bStarted = true;
}
+ bLayerStarted = false;
}
}
return rect;
diff --git a/core/fpdfapi/page/cpdf_pageobject.cpp b/core/fpdfapi/page/cpdf_pageobject.cpp
index 604309f6e6..0c3a850936 100644
--- a/core/fpdfapi/page/cpdf_pageobject.cpp
+++ b/core/fpdfapi/page/cpdf_pageobject.cpp
@@ -98,10 +98,10 @@ void CPDF_PageObject::TransformGeneralState(CFX_Matrix& matrix) {
SetDirty(true);
}
-FX_RECT CPDF_PageObject::GetBBox(const CFX_Matrix* pMatrix) const {
- CFX_FloatRect rect(m_Left, m_Bottom, m_Right, m_Top);
- if (pMatrix)
- rect = pMatrix->TransformRect(rect);
+FX_RECT CPDF_PageObject::GetBBox() const {
+ return GetRect().GetOuterRect();
+}
- return rect.GetOuterRect();
+FX_RECT CPDF_PageObject::GetTransformedBBox(const CFX_Matrix& matrix) const {
+ return matrix.TransformRect(GetRect()).GetOuterRect();
}
diff --git a/core/fpdfapi/page/cpdf_pageobject.h b/core/fpdfapi/page/cpdf_pageobject.h
index 3fc35aa063..1dfe20b6f9 100644
--- a/core/fpdfapi/page/cpdf_pageobject.h
+++ b/core/fpdfapi/page/cpdf_pageobject.h
@@ -60,7 +60,8 @@ class CPDF_PageObject : public CPDF_GraphicStates {
CFX_FloatRect GetRect() const {
return CFX_FloatRect(m_Left, m_Bottom, m_Right, m_Top);
}
- FX_RECT GetBBox(const CFX_Matrix* pMatrix) const;
+ FX_RECT GetBBox() const;
+ FX_RECT GetTransformedBBox(const CFX_Matrix& matrix) const;
// Get what content stream the object was parsed from in its page. This number
// is the index of the content stream in the "Contents" array, or 0 if there