diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp | 12 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_contentparser.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_formobject.cpp | 7 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_formobject.h | 4 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_imageobject.cpp | 3 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_imageobject.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_pageobject.cpp | 3 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_pageobject.h | 4 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_pathobject.cpp | 3 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_pathobject.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_shadingobject.cpp | 5 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_shadingobject.h | 4 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_streamcontentparser.cpp | 21 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_streamcontentparser.h | 6 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_textobject.cpp | 5 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_textobject.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_renderstatus.cpp | 4 |
17 files changed, 33 insertions, 56 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp index f1dbffeccf..1244b12331 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp @@ -49,7 +49,7 @@ class CPDF_PageContentGeneratorTest : public testing::Test { }; TEST_F(CPDF_PageContentGeneratorTest, ProcessRect) { - auto pPathObj = pdfium::MakeUnique<CPDF_PathObject>(-1); + auto pPathObj = pdfium::MakeUnique<CPDF_PathObject>(); pPathObj->m_Path.AppendRect(10, 5, 13, 30); pPathObj->m_FillType = FXFILL_ALTERNATE; pPathObj->m_bStroke = true; @@ -60,7 +60,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessRect) { TestProcessPath(&generator, &buf, pPathObj.get()); EXPECT_EQ("q 1 0 0 1 0 0 cm 10 5 3 25 re B* Q\n", ByteString(buf)); - pPathObj = pdfium::MakeUnique<CPDF_PathObject>(-1); + pPathObj = pdfium::MakeUnique<CPDF_PathObject>(); pPathObj->m_Path.AppendPoint(CFX_PointF(0, 0), FXPT_TYPE::MoveTo, false); pPathObj->m_Path.AppendPoint(CFX_PointF(5.2f, 0), FXPT_TYPE::LineTo, false); pPathObj->m_Path.AppendPoint(CFX_PointF(5.2f, 3.78f), FXPT_TYPE::LineTo, @@ -75,7 +75,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessRect) { } TEST_F(CPDF_PageContentGeneratorTest, ProcessPath) { - auto pPathObj = pdfium::MakeUnique<CPDF_PathObject>(-1); + auto pPathObj = pdfium::MakeUnique<CPDF_PathObject>(); pPathObj->m_Path.AppendPoint(CFX_PointF(3.102f, 4.67f), FXPT_TYPE::MoveTo, false); pPathObj->m_Path.AppendPoint(CFX_PointF(5.45f, 0.29f), FXPT_TYPE::LineTo, @@ -110,7 +110,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessPath) { } TEST_F(CPDF_PageContentGeneratorTest, ProcessGraphics) { - auto pPathObj = pdfium::MakeUnique<CPDF_PathObject>(-1); + auto pPathObj = pdfium::MakeUnique<CPDF_PathObject>(); pPathObj->m_Path.AppendPoint(CFX_PointF(1, 2), FXPT_TYPE::MoveTo, false); pPathObj->m_Path.AppendPoint(CFX_PointF(3, 4), FXPT_TYPE::LineTo, false); pPathObj->m_Path.AppendPoint(CFX_PointF(5, 6), FXPT_TYPE::LineTo, true); @@ -170,7 +170,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessStandardText) { CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(0); auto pTestPage = pdfium::MakeRetain<CPDF_Page>(pDoc.get(), pPageDict, false); CPDF_PageContentGenerator generator(pTestPage.Get()); - auto pTextObj = pdfium::MakeUnique<CPDF_TextObject>(-1); + auto pTextObj = pdfium::MakeUnique<CPDF_TextObject>(); CPDF_Font* pFont = CPDF_Font::GetStockFont(pDoc.get(), "Times-Roman"); pTextObj->m_TextState.SetFont(pFont); pTextObj->m_TextState.SetFontSize(10.0f); @@ -237,7 +237,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessText) { std::ostringstream buf; { // Set the text object font and text - auto pTextObj = pdfium::MakeUnique<CPDF_TextObject>(-1); + auto pTextObj = pdfium::MakeUnique<CPDF_TextObject>(); CPDF_Dictionary* pDict = pDoc->NewIndirect<CPDF_Dictionary>(); pDict->SetNewFor<CPDF_Name>("Type", "Font"); pDict->SetNewFor<CPDF_Name>("Subtype", "TrueType"); diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp index c079f99cbf..471e707322 100644 --- a/core/fpdfapi/page/cpdf_contentparser.cpp +++ b/core/fpdfapi/page/cpdf_contentparser.cpp @@ -170,7 +170,7 @@ CPDF_ContentParser::Stage CPDF_ContentParser::Parse() { m_CurrentOffset += m_pParser->Parse( m_StreamArray[m_CurrentStream]->GetData() + m_CurrentOffset, m_StreamArray[m_CurrentStream]->GetSize() - m_CurrentOffset, - PARSE_STEP_LIMIT, m_CurrentStream); + PARSE_STEP_LIMIT); if (m_CurrentOffset >= m_StreamArray[m_CurrentStream]->GetSize()) { m_CurrentOffset = 0; diff --git a/core/fpdfapi/page/cpdf_formobject.cpp b/core/fpdfapi/page/cpdf_formobject.cpp index 22ac0d3823..eca92ca0ff 100644 --- a/core/fpdfapi/page/cpdf_formobject.cpp +++ b/core/fpdfapi/page/cpdf_formobject.cpp @@ -10,12 +10,9 @@ #include "core/fpdfapi/page/cpdf_form.h" -CPDF_FormObject::CPDF_FormObject(int32_t content_stream, - std::unique_ptr<CPDF_Form> pForm, +CPDF_FormObject::CPDF_FormObject(std::unique_ptr<CPDF_Form> pForm, const CFX_Matrix& matrix) - : CPDF_PageObject(content_stream), - m_pForm(std::move(pForm)), - m_FormMatrix(matrix) {} + : m_pForm(std::move(pForm)), m_FormMatrix(matrix) {} CPDF_FormObject::~CPDF_FormObject() {} diff --git a/core/fpdfapi/page/cpdf_formobject.h b/core/fpdfapi/page/cpdf_formobject.h index b229dce444..c723cc0eaf 100644 --- a/core/fpdfapi/page/cpdf_formobject.h +++ b/core/fpdfapi/page/cpdf_formobject.h @@ -16,9 +16,7 @@ class CPDF_Form; class CPDF_FormObject : public CPDF_PageObject { public: - CPDF_FormObject(int32_t content_stream, - std::unique_ptr<CPDF_Form> pForm, - const CFX_Matrix& matrix); + CPDF_FormObject(std::unique_ptr<CPDF_Form> pForm, const CFX_Matrix& matrix); ~CPDF_FormObject() override; // CPDF_PageObject: diff --git a/core/fpdfapi/page/cpdf_imageobject.cpp b/core/fpdfapi/page/cpdf_imageobject.cpp index 7826742276..3b5a740155 100644 --- a/core/fpdfapi/page/cpdf_imageobject.cpp +++ b/core/fpdfapi/page/cpdf_imageobject.cpp @@ -12,8 +12,7 @@ #include "core/fpdfapi/page/cpdf_image.h" #include "core/fpdfapi/parser/cpdf_document.h" -CPDF_ImageObject::CPDF_ImageObject(int32_t content_stream) - : CPDF_PageObject(content_stream) {} +CPDF_ImageObject::CPDF_ImageObject() {} CPDF_ImageObject::~CPDF_ImageObject() { MaybePurgeCache(); diff --git a/core/fpdfapi/page/cpdf_imageobject.h b/core/fpdfapi/page/cpdf_imageobject.h index 465b1628ed..16a506e537 100644 --- a/core/fpdfapi/page/cpdf_imageobject.h +++ b/core/fpdfapi/page/cpdf_imageobject.h @@ -16,7 +16,7 @@ class CPDF_Image; class CPDF_ImageObject : public CPDF_PageObject { public: - explicit CPDF_ImageObject(int32_t content_stream); + CPDF_ImageObject(); ~CPDF_ImageObject() override; // CPDF_PageObject diff --git a/core/fpdfapi/page/cpdf_pageobject.cpp b/core/fpdfapi/page/cpdf_pageobject.cpp index 582b9fff57..8bb5bf5978 100644 --- a/core/fpdfapi/page/cpdf_pageobject.cpp +++ b/core/fpdfapi/page/cpdf_pageobject.cpp @@ -6,8 +6,7 @@ #include "core/fpdfapi/page/cpdf_pageobject.h" -CPDF_PageObject::CPDF_PageObject(int32_t content_stream) - : m_bDirty(false), m_ContentStream(content_stream) {} +CPDF_PageObject::CPDF_PageObject() : m_bDirty(false) {} CPDF_PageObject::~CPDF_PageObject() {} diff --git a/core/fpdfapi/page/cpdf_pageobject.h b/core/fpdfapi/page/cpdf_pageobject.h index b7cc5996c9..d23cd971f8 100644 --- a/core/fpdfapi/page/cpdf_pageobject.h +++ b/core/fpdfapi/page/cpdf_pageobject.h @@ -28,7 +28,7 @@ class CPDF_PageObject : public CPDF_GraphicStates { FORM, }; - explicit CPDF_PageObject(int32_t content_stream); + CPDF_PageObject(); ~CPDF_PageObject() override; virtual Type GetType() const = 0; @@ -58,7 +58,6 @@ class CPDF_PageObject : public CPDF_GraphicStates { return CFX_FloatRect(m_Left, m_Bottom, m_Right, m_Top); } FX_RECT GetBBox(const CFX_Matrix* pMatrix) const; - int32_t GetContentStream() const { return m_ContentStream; } float m_Left; float m_Right; @@ -74,7 +73,6 @@ class CPDF_PageObject : public CPDF_GraphicStates { void operator=(const CPDF_PageObject& src) = delete; bool m_bDirty; - int32_t m_ContentStream; }; #endif // CORE_FPDFAPI_PAGE_CPDF_PAGEOBJECT_H_ diff --git a/core/fpdfapi/page/cpdf_pathobject.cpp b/core/fpdfapi/page/cpdf_pathobject.cpp index 39ab134c92..d8c2cb8741 100644 --- a/core/fpdfapi/page/cpdf_pathobject.cpp +++ b/core/fpdfapi/page/cpdf_pathobject.cpp @@ -6,8 +6,7 @@ #include "core/fpdfapi/page/cpdf_pathobject.h" -CPDF_PathObject::CPDF_PathObject(int32_t content_stream) - : CPDF_PageObject(content_stream), m_FillType(0), m_bStroke(false) {} +CPDF_PathObject::CPDF_PathObject() : m_FillType(0), m_bStroke(false) {} CPDF_PathObject::~CPDF_PathObject() {} diff --git a/core/fpdfapi/page/cpdf_pathobject.h b/core/fpdfapi/page/cpdf_pathobject.h index d4843d2fb6..58499b5a53 100644 --- a/core/fpdfapi/page/cpdf_pathobject.h +++ b/core/fpdfapi/page/cpdf_pathobject.h @@ -14,7 +14,7 @@ class CPDF_PathObject : public CPDF_PageObject { public: - explicit CPDF_PathObject(int32_t content_stream); + CPDF_PathObject(); ~CPDF_PathObject() override; // CPDF_PageObject diff --git a/core/fpdfapi/page/cpdf_shadingobject.cpp b/core/fpdfapi/page/cpdf_shadingobject.cpp index 725e2e4591..1b16ac4862 100644 --- a/core/fpdfapi/page/cpdf_shadingobject.cpp +++ b/core/fpdfapi/page/cpdf_shadingobject.cpp @@ -9,10 +9,9 @@ #include "core/fpdfapi/page/cpdf_shadingpattern.h" #include "core/fpdfapi/parser/cpdf_document.h" -CPDF_ShadingObject::CPDF_ShadingObject(int32_t content_stream, - CPDF_ShadingPattern* pattern, +CPDF_ShadingObject::CPDF_ShadingObject(CPDF_ShadingPattern* pattern, const CFX_Matrix& matrix) - : CPDF_PageObject(content_stream), m_pShading(pattern), m_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 69b606749d..80e062c729 100644 --- a/core/fpdfapi/page/cpdf_shadingobject.h +++ b/core/fpdfapi/page/cpdf_shadingobject.h @@ -15,9 +15,7 @@ class CPDF_ShadingPattern; class CPDF_ShadingObject : public CPDF_PageObject { public: - CPDF_ShadingObject(int32_t content_stream, - CPDF_ShadingPattern* pattern, - const CFX_Matrix& matrix); + CPDF_ShadingObject(CPDF_ShadingPattern* pattern, const CFX_Matrix& matrix); ~CPDF_ShadingObject() override; // CPDF_PageObject: diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp index 051d79ad1d..7e7c337d96 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp @@ -786,8 +786,7 @@ void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) { CFX_Matrix matrix = m_pCurStates->m_CTM; matrix.Concat(m_mtContentToUser); - auto pFormObj = pdfium::MakeUnique<CPDF_FormObject>(m_CurrentContentStream, - std::move(form), matrix); + auto pFormObj = pdfium::MakeUnique<CPDF_FormObject>(std::move(form), matrix); if (!m_pObjectHolder->BackgroundAlphaNeeded() && pFormObj->form()->BackgroundAlphaNeeded()) { m_pObjectHolder->SetBackgroundAlphaNeeded(true); @@ -802,14 +801,14 @@ CPDF_ImageObject* CPDF_StreamContentParser::AddImage( if (!pStream) return nullptr; - auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>(m_CurrentContentStream); + auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>(); pImageObj->SetImage( pdfium::MakeRetain<CPDF_Image>(m_pDocument.Get(), std::move(pStream))); return AddImageObject(std::move(pImageObj)); } CPDF_ImageObject* CPDF_StreamContentParser::AddImage(uint32_t streamObjNum) { - auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>(m_CurrentContentStream); + auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>(); pImageObj->SetImage(m_pDocument->LoadImageFromPageData(streamObjNum)); return AddImageObject(std::move(pImageObj)); } @@ -819,7 +818,7 @@ CPDF_ImageObject* CPDF_StreamContentParser::AddImage( if (!pImage) return nullptr; - auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>(m_CurrentContentStream); + auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>(); pImageObj->SetImage( m_pDocument->GetPageData()->GetImage(pImage->GetStream()->GetObjNum())); @@ -1086,8 +1085,7 @@ void CPDF_StreamContentParser::Handle_ShadeFill() { CFX_Matrix matrix = m_pCurStates->m_CTM; matrix.Concat(m_mtContentToUser); - auto pObj = pdfium::MakeUnique<CPDF_ShadingObject>(m_CurrentContentStream, - pShading, matrix); + auto pObj = pdfium::MakeUnique<CPDF_ShadingObject>(pShading, matrix); SetGraphicStates(pObj.get(), false, false, false); CFX_FloatRect bbox = pObj->m_ClipPath.HasRef() ? pObj->m_ClipPath.GetClipBox() : m_BBox; @@ -1222,7 +1220,7 @@ void CPDF_StreamContentParser::AddTextObject(ByteString* pStrs, pFont->IsType3Font() ? TextRenderingMode::MODE_FILL : m_pCurStates->m_TextState.GetTextMode(); { - auto pText = pdfium::MakeUnique<CPDF_TextObject>(m_CurrentContentStream); + auto pText = pdfium::MakeUnique<CPDF_TextObject>(); m_pLastTextObject = pText.get(); SetGraphicStates(m_pLastTextObject.Get(), true, true, true); if (TextRenderingModeIsStrokeMode(text_mode)) { @@ -1459,7 +1457,7 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, bool bStroke) { CFX_Matrix matrix = m_pCurStates->m_CTM; matrix.Concat(m_mtContentToUser); if (bStroke || FillType) { - auto pPathObj = pdfium::MakeUnique<CPDF_PathObject>(m_CurrentContentStream); + auto pPathObj = pdfium::MakeUnique<CPDF_PathObject>(); pPathObj->m_bStroke = bStroke; pPathObj->m_FillType = FillType; pPathObj->m_Path = Path; @@ -1479,10 +1477,7 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, bool bStroke) { uint32_t CPDF_StreamContentParser::Parse(const uint8_t* pData, uint32_t dwSize, - uint32_t max_cost, - uint32_t content_stream) { - m_CurrentContentStream = content_stream; - + uint32_t max_cost) { if (m_ParsedSet->size() > kMaxFormLevel || pdfium::ContainsKey(*m_ParsedSet, pData)) return dwSize; diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.h b/core/fpdfapi/page/cpdf_streamcontentparser.h index 4c593998fd..438be024cc 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.h +++ b/core/fpdfapi/page/cpdf_streamcontentparser.h @@ -43,10 +43,7 @@ class CPDF_StreamContentParser { std::set<const uint8_t*>* parsedSet); ~CPDF_StreamContentParser(); - uint32_t Parse(const uint8_t* pData, - uint32_t dwSize, - uint32_t max_cost, - uint32_t content_stream); + uint32_t Parse(const uint8_t* pData, uint32_t dwSize, uint32_t max_cost); CPDF_PageObjectHolder* GetPageObjectHolder() const { return m_pObjectHolder.Get(); } @@ -233,7 +230,6 @@ class CPDF_StreamContentParser { std::vector<std::unique_ptr<CPDF_AllStates>> m_StateStack; float m_Type3Data[6]; ContentParam m_ParamBuf[kParamBufSize]; - uint32_t m_CurrentContentStream; }; #endif // CORE_FPDFAPI_PAGE_CPDF_STREAMCONTENTPARSER_H_ diff --git a/core/fpdfapi/page/cpdf_textobject.cpp b/core/fpdfapi/page/cpdf_textobject.cpp index 68d20b6598..36a4722773 100644 --- a/core/fpdfapi/page/cpdf_textobject.cpp +++ b/core/fpdfapi/page/cpdf_textobject.cpp @@ -18,8 +18,7 @@ CPDF_TextObjectItem::CPDF_TextObjectItem() : m_CharCode(0) {} CPDF_TextObjectItem::~CPDF_TextObjectItem() = default; -CPDF_TextObject::CPDF_TextObject(int32_t content_stream) - : CPDF_PageObject(content_stream) {} +CPDF_TextObject::CPDF_TextObject() {} CPDF_TextObject::~CPDF_TextObject() { // Move m_CharCodes to a local variable so it will be captured in crash dumps, @@ -101,7 +100,7 @@ void CPDF_TextObject::GetCharInfo(size_t index, } std::unique_ptr<CPDF_TextObject> CPDF_TextObject::Clone() const { - auto obj = pdfium::MakeUnique<CPDF_TextObject>(-1); + auto obj = pdfium::MakeUnique<CPDF_TextObject>(); obj->CopyData(this); obj->m_CharCodes = m_CharCodes; obj->m_CharPos = m_CharPos; diff --git a/core/fpdfapi/page/cpdf_textobject.h b/core/fpdfapi/page/cpdf_textobject.h index 3faccfdfe7..a6fc62369c 100644 --- a/core/fpdfapi/page/cpdf_textobject.h +++ b/core/fpdfapi/page/cpdf_textobject.h @@ -25,7 +25,7 @@ class CPDF_TextObjectItem { class CPDF_TextObject : public CPDF_PageObject { public: - explicit CPDF_TextObject(int32_t content_stream); + CPDF_TextObject(); ~CPDF_TextObject() override; // CPDF_PageObject diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 9295b0e77f..af976903be 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -1990,7 +1990,7 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj, bool bFill, bool bStroke) { if (!bStroke) { - CPDF_PathObject path(-1); + CPDF_PathObject path; std::vector<std::unique_ptr<CPDF_TextObject>> pCopy; pCopy.push_back(std::unique_ptr<CPDF_TextObject>(textobj->Clone())); path.m_bStroke = false; @@ -2019,7 +2019,7 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj, if (!pPath) continue; - CPDF_PathObject path(-1); + CPDF_PathObject path; path.m_GraphState = textobj->m_GraphState; path.m_ColorState = textobj->m_ColorState; |