diff options
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r-- | core/fpdfapi/page/cpdf_shadingobject.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_shadingobject.h | 8 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_streamcontentparser.cpp | 9 |
3 files changed, 13 insertions, 8 deletions
diff --git a/core/fpdfapi/page/cpdf_shadingobject.cpp b/core/fpdfapi/page/cpdf_shadingobject.cpp index df3fbd17cd..1b16ac4862 100644 --- a/core/fpdfapi/page/cpdf_shadingobject.cpp +++ b/core/fpdfapi/page/cpdf_shadingobject.cpp @@ -9,7 +9,9 @@ #include "core/fpdfapi/page/cpdf_shadingpattern.h" #include "core/fpdfapi/parser/cpdf_document.h" -CPDF_ShadingObject::CPDF_ShadingObject() : m_pShading(nullptr) {} +CPDF_ShadingObject::CPDF_ShadingObject(CPDF_ShadingPattern* pattern, + const CFX_Matrix& matrix) + : m_pShading(pattern), m_Matrix(matrix) {} CPDF_ShadingObject::~CPDF_ShadingObject() {} diff --git a/core/fpdfapi/page/cpdf_shadingobject.h b/core/fpdfapi/page/cpdf_shadingobject.h index a5405cb090..80e062c729 100644 --- a/core/fpdfapi/page/cpdf_shadingobject.h +++ b/core/fpdfapi/page/cpdf_shadingobject.h @@ -15,10 +15,10 @@ class CPDF_ShadingPattern; class CPDF_ShadingObject : public CPDF_PageObject { public: - CPDF_ShadingObject(); + CPDF_ShadingObject(CPDF_ShadingPattern* pattern, const CFX_Matrix& matrix); ~CPDF_ShadingObject() override; - // CPDF_PageObject + // CPDF_PageObject: Type GetType() const override; void Transform(const CFX_Matrix& matrix) override; bool IsShading() const override; @@ -27,6 +27,10 @@ class CPDF_ShadingObject : public CPDF_PageObject { void CalcBoundingBox(); + const CPDF_ShadingPattern* pattern() const { return m_pShading.Get(); } + const CFX_Matrix& matrix() const { return m_Matrix; } + + private: UnownedPtr<CPDF_ShadingPattern> m_pShading; CFX_Matrix m_Matrix; }; diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp index 3bd40d5b7c..4e3857bf85 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp @@ -1113,15 +1113,14 @@ void CPDF_StreamContentParser::Handle_ShadeFill() { if (!pShading->IsShadingObject() || !pShading->Load()) return; - auto pObj = pdfium::MakeUnique<CPDF_ShadingObject>(); - pObj->m_pShading = pShading; + CFX_Matrix matrix = m_pCurStates->m_CTM; + matrix.Concat(m_mtContentToUser); + auto pObj = pdfium::MakeUnique<CPDF_ShadingObject>(pShading, matrix); SetGraphicStates(pObj.get(), false, false, false); - pObj->m_Matrix = m_pCurStates->m_CTM; - pObj->m_Matrix.Concat(m_mtContentToUser); CFX_FloatRect bbox = pObj->m_ClipPath.HasRef() ? pObj->m_ClipPath.GetClipBox() : m_BBox; if (pShading->IsMeshShading()) - bbox.Intersect(GetShadingBBox(pShading, pObj->m_Matrix)); + bbox.Intersect(GetShadingBBox(pShading, pObj->matrix())); pObj->m_Left = bbox.left; pObj->m_Right = bbox.right; pObj->m_Top = bbox.top; |