diff options
Diffstat (limited to 'core/fpdfapi/fpdf_page')
29 files changed, 360 insertions, 110 deletions
diff --git a/core/fpdfapi/fpdf_page/cpdf_allstates.h b/core/fpdfapi/fpdf_page/cpdf_allstates.h index 9af917a113..21fd6c2d9b 100644 --- a/core/fpdfapi/fpdf_page/cpdf_allstates.h +++ b/core/fpdfapi/fpdf_page/cpdf_allstates.h @@ -18,7 +18,7 @@ class CPDF_StreamContentParser; class CPDF_AllStates : public CPDF_GraphicStates { public: CPDF_AllStates(); - ~CPDF_AllStates(); + ~CPDF_AllStates() override; void Copy(const CPDF_AllStates& src); void ProcessExtGS(CPDF_Dictionary* pGS, CPDF_StreamContentParser* pParser); diff --git a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp index 9300f1081b..9d3aeb2adc 100644 --- a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp @@ -436,6 +436,13 @@ FX_BOOL CPDF_ColorSpace::sRGB() const { return pCS->m_pProfile->m_bsRGB; } +FX_BOOL CPDF_ColorSpace::SetRGB(FX_FLOAT* pBuf, + FX_FLOAT R, + FX_FLOAT G, + FX_FLOAT B) const { + return FALSE; +} + FX_BOOL CPDF_ColorSpace::GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, @@ -475,6 +482,19 @@ void CPDF_ColorSpace::GetDefaultColor(FX_FLOAT* buf) const { } } +uint32_t CPDF_ColorSpace::CountComponents() const { + return m_nComponents; +} + +void CPDF_ColorSpace::GetDefaultValue(int iComponent, + FX_FLOAT& value, + FX_FLOAT& min, + FX_FLOAT& max) const { + value = 0; + min = 0; + max = 1.0f; +} + void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf, const uint8_t* src_buf, int pixels, @@ -498,6 +518,10 @@ void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf, } } +CPDF_ColorSpace* CPDF_ColorSpace::GetBaseCS() const { + return nullptr; +} + void CPDF_ColorSpace::EnableStdConversion(FX_BOOL bEnabled) { if (bEnabled) m_dwStdConversion++; @@ -505,6 +529,37 @@ void CPDF_ColorSpace::EnableStdConversion(FX_BOOL bEnabled) { m_dwStdConversion--; } +CPDF_ColorSpace::CPDF_ColorSpace(CPDF_Document* pDoc, + int family, + uint32_t nComponents) + : m_pDocument(pDoc), + m_Family(family), + m_nComponents(nComponents), + m_pArray(nullptr), + m_dwStdConversion(0) {} + +CPDF_ColorSpace::~CPDF_ColorSpace() {} + +FX_BOOL CPDF_ColorSpace::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { + return TRUE; +} + +FX_BOOL CPDF_ColorSpace::v_GetCMYK(FX_FLOAT* pBuf, + FX_FLOAT& c, + FX_FLOAT& m, + FX_FLOAT& y, + FX_FLOAT& k) const { + return FALSE; +} + +FX_BOOL CPDF_ColorSpace::v_SetCMYK(FX_FLOAT* pBuf, + FX_FLOAT c, + FX_FLOAT m, + FX_FLOAT y, + FX_FLOAT k) const { + return FALSE; +} + CPDF_CalGray::CPDF_CalGray(CPDF_Document* pDoc) : CPDF_ColorSpace(pDoc, PDFCS_CALGRAY, 1) {} diff --git a/core/fpdfapi/fpdf_page/cpdf_contentmarkdata.cpp b/core/fpdfapi/fpdf_page/cpdf_contentmarkdata.cpp index 076e8ac521..256e266b04 100644 --- a/core/fpdfapi/fpdf_page/cpdf_contentmarkdata.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_contentmarkdata.cpp @@ -9,13 +9,25 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" #include "third_party/base/stl_util.h" +CPDF_ContentMarkData::CPDF_ContentMarkData() {} + CPDF_ContentMarkData::CPDF_ContentMarkData(const CPDF_ContentMarkData& src) : m_Marks(src.m_Marks) {} +CPDF_ContentMarkData::~CPDF_ContentMarkData() {} + int CPDF_ContentMarkData::CountItems() const { return pdfium::CollectionSize<int>(m_Marks); } +CPDF_ContentMarkItem& CPDF_ContentMarkData::GetItem(int index) { + return m_Marks[index]; +} + +const CPDF_ContentMarkItem& CPDF_ContentMarkData::GetItem(int index) const { + return m_Marks[index]; +} + int CPDF_ContentMarkData::GetMCID() const { for (const auto& mark : m_Marks) { CPDF_ContentMarkItem::ParamType type = mark.GetParamType(); diff --git a/core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h b/core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h index 773fea741b..6f5c1f1fae 100644 --- a/core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h +++ b/core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h @@ -16,14 +16,13 @@ class CPDF_Dictionary; class CPDF_ContentMarkData { public: - CPDF_ContentMarkData() {} + CPDF_ContentMarkData(); CPDF_ContentMarkData(const CPDF_ContentMarkData& src); + ~CPDF_ContentMarkData(); int CountItems() const; - CPDF_ContentMarkItem& GetItem(int index) { return m_Marks[index]; } - const CPDF_ContentMarkItem& GetItem(int index) const { - return m_Marks[index]; - } + CPDF_ContentMarkItem& GetItem(int index); + const CPDF_ContentMarkItem& GetItem(int index) const; int GetMCID() const; void AddMark(const CFX_ByteString& name, diff --git a/core/fpdfapi/fpdf_page/cpdf_formobject.cpp b/core/fpdfapi/fpdf_page/cpdf_formobject.cpp index d85ff7dbb3..567c156af0 100644 --- a/core/fpdfapi/fpdf_page/cpdf_formobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_formobject.cpp @@ -19,6 +19,18 @@ void CPDF_FormObject::Transform(const CFX_Matrix& matrix) { CalcBoundingBox(); } +bool CPDF_FormObject::IsForm() const { + return true; +} + +CPDF_FormObject* CPDF_FormObject::AsForm() { + return this; +} + +const CPDF_FormObject* CPDF_FormObject::AsForm() const { + return this; +} + CPDF_FormObject* CPDF_FormObject::Clone() const { CPDF_FormObject* obj = new CPDF_FormObject; obj->CopyData(this); @@ -28,6 +40,10 @@ CPDF_FormObject* CPDF_FormObject::Clone() const { return obj; } +CPDF_PageObject::Type CPDF_FormObject::GetType() const { + return FORM; +} + void CPDF_FormObject::CalcBoundingBox() { CFX_FloatRect form_rect = m_pForm->CalcBoundingBox(); form_rect.Transform(&m_FormMatrix); diff --git a/core/fpdfapi/fpdf_page/cpdf_graphicstates.cpp b/core/fpdfapi/fpdf_page/cpdf_graphicstates.cpp index 9c540941ce..fc054caf21 100644 --- a/core/fpdfapi/fpdf_page/cpdf_graphicstates.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_graphicstates.cpp @@ -6,6 +6,10 @@ #include "core/fpdfapi/fpdf_page/cpdf_graphicstates.h" +CPDF_GraphicStates::CPDF_GraphicStates() {} + +CPDF_GraphicStates::~CPDF_GraphicStates() {} + void CPDF_GraphicStates::DefaultStates() { m_ColorState.New()->Default(); } diff --git a/core/fpdfapi/fpdf_page/cpdf_graphicstates.h b/core/fpdfapi/fpdf_page/cpdf_graphicstates.h index 0add18c910..a408bc794b 100644 --- a/core/fpdfapi/fpdf_page/cpdf_graphicstates.h +++ b/core/fpdfapi/fpdf_page/cpdf_graphicstates.h @@ -15,6 +15,9 @@ class CPDF_GraphicStates { public: + CPDF_GraphicStates(); + virtual ~CPDF_GraphicStates(); + void CopyStates(const CPDF_GraphicStates& src); void DefaultStates(); diff --git a/core/fpdfapi/fpdf_page/cpdf_imageobject.cpp b/core/fpdfapi/fpdf_page/cpdf_imageobject.cpp index 6203d56273..e2defa8054 100644 --- a/core/fpdfapi/fpdf_page/cpdf_imageobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_imageobject.cpp @@ -33,11 +33,27 @@ CPDF_ImageObject* CPDF_ImageObject::Clone() const { return obj; } +CPDF_PageObject::Type CPDF_ImageObject::GetType() const { + return IMAGE; +} + void CPDF_ImageObject::Transform(const CFX_Matrix& matrix) { m_Matrix.Concat(matrix); CalcBoundingBox(); } +bool CPDF_ImageObject::IsImage() const { + return true; +} + +CPDF_ImageObject* CPDF_ImageObject::AsImage() { + return this; +} + +const CPDF_ImageObject* CPDF_ImageObject::AsImage() const { + return this; +} + void CPDF_ImageObject::CalcBoundingBox() { m_Left = m_Bottom = 0; m_Right = m_Top = 1.0f; diff --git a/core/fpdfapi/fpdf_page/cpdf_pagemodule.cpp b/core/fpdfapi/fpdf_page/cpdf_pagemodule.cpp index 0d2f547835..c22c8fbc46 100644 --- a/core/fpdfapi/fpdf_page/cpdf_pagemodule.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_pagemodule.cpp @@ -6,6 +6,18 @@ #include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h" +CPDF_PageModule::CPDF_PageModule() + : m_StockGrayCS(nullptr, PDFCS_DEVICEGRAY), + m_StockRGBCS(nullptr, PDFCS_DEVICERGB), + m_StockCMYKCS(nullptr, PDFCS_DEVICECMYK), + m_StockPatternCS(nullptr) {} + +CPDF_PageModule::~CPDF_PageModule() {} + +CPDF_FontGlobals* CPDF_PageModule::GetFontGlobals() { + return &m_FontGlobals; +} + CPDF_ColorSpace* CPDF_PageModule::GetStockCS(int family) { if (family == PDFCS_DEVICEGRAY) return &m_StockGrayCS; @@ -17,3 +29,7 @@ CPDF_ColorSpace* CPDF_PageModule::GetStockCS(int family) { return &m_StockPatternCS; return nullptr; } + +void CPDF_PageModule::ClearStockFont(CPDF_Document* pDoc) { + m_FontGlobals.Clear(pDoc); +} diff --git a/core/fpdfapi/fpdf_page/cpdf_pagemodule.h b/core/fpdfapi/fpdf_page/cpdf_pagemodule.h index c609de9c58..2e418f8993 100644 --- a/core/fpdfapi/fpdf_page/cpdf_pagemodule.h +++ b/core/fpdfapi/fpdf_page/cpdf_pagemodule.h @@ -15,16 +15,12 @@ class CPDF_Document; class CPDF_PageModule { public: - CPDF_PageModule() - : m_StockGrayCS(nullptr, PDFCS_DEVICEGRAY), - m_StockRGBCS(nullptr, PDFCS_DEVICERGB), - m_StockCMYKCS(nullptr, PDFCS_DEVICECMYK), - m_StockPatternCS(nullptr) {} - ~CPDF_PageModule() {} - - CPDF_FontGlobals* GetFontGlobals() { return &m_FontGlobals; } + CPDF_PageModule(); + ~CPDF_PageModule(); + + CPDF_FontGlobals* GetFontGlobals(); CPDF_ColorSpace* GetStockCS(int family); - void ClearStockFont(CPDF_Document* pDoc) { m_FontGlobals.Clear(pDoc); } + void ClearStockFont(CPDF_Document* pDoc); private: CPDF_FontGlobals m_FontGlobals; diff --git a/core/fpdfapi/fpdf_page/cpdf_pageobject.cpp b/core/fpdfapi/fpdf_page/cpdf_pageobject.cpp index ee6615e2e7..ebac18a596 100644 --- a/core/fpdfapi/fpdf_page/cpdf_pageobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_pageobject.cpp @@ -10,6 +10,66 @@ CPDF_PageObject::CPDF_PageObject() {} CPDF_PageObject::~CPDF_PageObject() {} +bool CPDF_PageObject::IsText() const { + return false; +} + +bool CPDF_PageObject::IsPath() const { + return false; +} + +bool CPDF_PageObject::IsImage() const { + return false; +} + +bool CPDF_PageObject::IsShading() const { + return false; +} + +bool CPDF_PageObject::IsForm() const { + return false; +} + +CPDF_TextObject* CPDF_PageObject::AsText() { + return nullptr; +} + +const CPDF_TextObject* CPDF_PageObject::AsText() const { + return nullptr; +} + +CPDF_PathObject* CPDF_PageObject::AsPath() { + return nullptr; +} + +const CPDF_PathObject* CPDF_PageObject::AsPath() const { + return nullptr; +} + +CPDF_ImageObject* CPDF_PageObject::AsImage() { + return nullptr; +} + +const CPDF_ImageObject* CPDF_PageObject::AsImage() const { + return nullptr; +} + +CPDF_ShadingObject* CPDF_PageObject::AsShading() { + return nullptr; +} + +const CPDF_ShadingObject* CPDF_PageObject::AsShading() const { + return nullptr; +} + +CPDF_FormObject* CPDF_PageObject::AsForm() { + return nullptr; +} + +const CPDF_FormObject* CPDF_PageObject::AsForm() const { + return nullptr; +} + void CPDF_PageObject::CopyData(const CPDF_PageObject* pSrc) { CopyStates(*pSrc); m_Left = pSrc->m_Left; diff --git a/core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp b/core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp index cd6eca5adc..77ec205518 100644 --- a/core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp @@ -21,6 +21,8 @@ CPDF_PageObjectHolder::CPDF_PageObjectHolder() m_bHasImageMask(FALSE), m_ParseState(CONTENT_NOT_PARSED) {} +CPDF_PageObjectHolder::~CPDF_PageObjectHolder() {} + void CPDF_PageObjectHolder::ContinueParse(IFX_Pause* pPause) { if (!m_pParser) { return; diff --git a/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp b/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp index cfe7b48c8b..b62a5bd25a 100644 --- a/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp @@ -21,11 +21,27 @@ CPDF_PathObject* CPDF_PathObject::Clone() const { return obj; } +CPDF_PageObject::Type CPDF_PathObject::GetType() const { + return PATH; +} + void CPDF_PathObject::Transform(const CFX_Matrix& matrix) { m_Matrix.Concat(matrix); CalcBoundingBox(); } +bool CPDF_PathObject::IsPath() const { + return true; +} + +CPDF_PathObject* CPDF_PathObject::AsPath() { + return this; +} + +const CPDF_PathObject* CPDF_PathObject::AsPath() const { + return this; +} + void CPDF_PathObject::CalcBoundingBox() { if (m_Path.IsNull()) { return; diff --git a/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp b/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp index de84f29865..b2eb5e642c 100644 --- a/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp @@ -30,6 +30,10 @@ CPDF_ShadingObject* CPDF_ShadingObject::Clone() const { return obj; } +CPDF_PageObject::Type CPDF_ShadingObject::GetType() const { + return SHADING; +} + void CPDF_ShadingObject::Transform(const CFX_Matrix& matrix) { if (!m_ClipPath.IsNull()) { m_ClipPath.GetModify(); @@ -43,6 +47,18 @@ void CPDF_ShadingObject::Transform(const CFX_Matrix& matrix) { } } +bool CPDF_ShadingObject::IsShading() const { + return true; +} + +CPDF_ShadingObject* CPDF_ShadingObject::AsShading() { + return this; +} + +const CPDF_ShadingObject* CPDF_ShadingObject::AsShading() const { + return this; +} + void CPDF_ShadingObject::CalcBoundingBox() { if (m_ClipPath.IsNull()) { return; diff --git a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp index 1636e17f4f..e2205f956d 100644 --- a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp @@ -50,6 +50,14 @@ CPDF_ShadingPattern::~CPDF_ShadingPattern() { m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray()); } +CPDF_TilingPattern* CPDF_ShadingPattern::AsTilingPattern() { + return nullptr; +} + +CPDF_ShadingPattern* CPDF_ShadingPattern::AsShadingPattern() { + return this; +} + bool CPDF_ShadingPattern::Load() { if (m_ShadingType != kInvalidShading) return TRUE; diff --git a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.h b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.h index f5cef17fb1..7fe2cc6c79 100644 --- a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.h +++ b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.h @@ -40,8 +40,8 @@ class CPDF_ShadingPattern : public CPDF_Pattern { const CFX_Matrix& parentMatrix); ~CPDF_ShadingPattern() override; - CPDF_TilingPattern* AsTilingPattern() override { return nullptr; } - CPDF_ShadingPattern* AsShadingPattern() override { return this; } + CPDF_TilingPattern* AsTilingPattern() override; + CPDF_ShadingPattern* AsShadingPattern() override; bool IsMeshShading() const { return m_ShadingType == kFreeFormGouraudTriangleMeshShading || diff --git a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp index 72658c67ba..caa7d0df56 100644 --- a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp @@ -23,6 +23,10 @@ CPDF_TextObject::~CPDF_TextObject() { FX_Free(m_pCharPos); } +int CPDF_TextObject::CountItems() const { + return m_nChars; +} + void CPDF_TextObject::GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const { pInfo->m_CharCode = m_nChars == 1 ? (uint32_t)(uintptr_t)m_pCharCodes : m_pCharCodes[index]; @@ -124,6 +128,37 @@ CPDF_TextObject* CPDF_TextObject::Clone() const { return obj; } +CPDF_PageObject::Type CPDF_TextObject::GetType() const { + return TEXT; +} + +void CPDF_TextObject::Transform(const CFX_Matrix& matrix) { + m_TextState.GetModify(); + CFX_Matrix text_matrix; + GetTextMatrix(&text_matrix); + text_matrix.Concat(matrix); + FX_FLOAT* pTextMatrix = m_TextState.GetMatrix(); + pTextMatrix[0] = text_matrix.GetA(); + pTextMatrix[1] = text_matrix.GetC(); + pTextMatrix[2] = text_matrix.GetB(); + pTextMatrix[3] = text_matrix.GetD(); + m_PosX = text_matrix.GetE(); + m_PosY = text_matrix.GetF(); + CalcPositionData(nullptr, nullptr, 0); +} + +bool CPDF_TextObject::IsText() const { + return true; +} + +CPDF_TextObject* CPDF_TextObject::AsText() { + return this; +} + +const CPDF_TextObject* CPDF_TextObject::AsText() const { + return this; +} + void CPDF_TextObject::GetTextMatrix(CFX_Matrix* pMatrix) const { FX_FLOAT* pTextMatrix = m_TextState.GetMatrix(); pMatrix->Set(pTextMatrix[0], pTextMatrix[2], pTextMatrix[1], pTextMatrix[3], @@ -188,6 +223,22 @@ FX_FLOAT CPDF_TextObject::GetCharWidth(uint32_t charcode) const { return pCIDFont->GetVertWidth(CID) * fontsize; } +FX_FLOAT CPDF_TextObject::GetPosX() const { + return m_PosX; +} + +FX_FLOAT CPDF_TextObject::GetPosY() const { + return m_PosY; +} + +CPDF_Font* CPDF_TextObject::GetFont() const { + return m_TextState.GetFont(); +} + +FX_FLOAT CPDF_TextObject::GetFontSize() const { + return m_TextState.GetFontSize(); +} + void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX, FX_FLOAT* pTextAdvanceY, FX_FLOAT horz_scale, @@ -322,21 +373,6 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX, } } -void CPDF_TextObject::Transform(const CFX_Matrix& matrix) { - m_TextState.GetModify(); - CFX_Matrix text_matrix; - GetTextMatrix(&text_matrix); - text_matrix.Concat(matrix); - FX_FLOAT* pTextMatrix = m_TextState.GetMatrix(); - pTextMatrix[0] = text_matrix.GetA(); - pTextMatrix[1] = text_matrix.GetC(); - pTextMatrix[2] = text_matrix.GetB(); - pTextMatrix[3] = text_matrix.GetD(); - m_PosX = text_matrix.GetE(); - m_PosY = text_matrix.GetF(); - CalcPositionData(nullptr, nullptr, 0); -} - void CPDF_TextObject::SetPosition(FX_FLOAT x, FX_FLOAT y) { FX_FLOAT dx = x - m_PosX; FX_FLOAT dy = y - m_PosY; @@ -347,3 +383,7 @@ void CPDF_TextObject::SetPosition(FX_FLOAT x, FX_FLOAT y) { m_Top += dy; m_Bottom += dy; } + +void CPDF_TextObject::RecalcPositionData() { + CalcPositionData(nullptr, nullptr, 1); +} diff --git a/core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp b/core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp index 0b1eeab9f4..f7370de0bc 100644 --- a/core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp @@ -24,6 +24,14 @@ CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc, CPDF_TilingPattern::~CPDF_TilingPattern() { } +CPDF_TilingPattern* CPDF_TilingPattern::AsTilingPattern() { + return this; +} + +CPDF_ShadingPattern* CPDF_TilingPattern::AsShadingPattern() { + return nullptr; +} + FX_BOOL CPDF_TilingPattern::Load() { if (m_pForm) return TRUE; diff --git a/core/fpdfapi/fpdf_page/cpdf_tilingpattern.h b/core/fpdfapi/fpdf_page/cpdf_tilingpattern.h index 3e62810363..abfd434274 100644 --- a/core/fpdfapi/fpdf_page/cpdf_tilingpattern.h +++ b/core/fpdfapi/fpdf_page/cpdf_tilingpattern.h @@ -24,8 +24,8 @@ class CPDF_TilingPattern : public CPDF_Pattern { const CFX_Matrix& parentMatrix); ~CPDF_TilingPattern() override; - CPDF_TilingPattern* AsTilingPattern() override { return this; } - CPDF_ShadingPattern* AsShadingPattern() override { return nullptr; } + CPDF_TilingPattern* AsTilingPattern() override; + CPDF_ShadingPattern* AsShadingPattern() override; FX_BOOL Load(); diff --git a/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h b/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h index 8bb6c57260..fad85a147a 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h @@ -37,16 +37,12 @@ class CPDF_ColorSpace { int GetBufSize() const; FX_FLOAT* CreateBuf(); void GetDefaultColor(FX_FLOAT* buf) const; - uint32_t CountComponents() const { return m_nComponents; } + uint32_t CountComponents() const; int GetFamily() const { return m_Family; } virtual void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, - FX_FLOAT& max) const { - value = 0; - min = 0; - max = 1.0f; - } + FX_FLOAT& max) const; FX_BOOL sRGB() const; virtual FX_BOOL GetRGB(FX_FLOAT* pBuf, @@ -56,9 +52,7 @@ class CPDF_ColorSpace { virtual FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, - FX_FLOAT B) const { - return FALSE; - } + FX_FLOAT B) const; FX_BOOL GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, @@ -79,38 +73,27 @@ class CPDF_ColorSpace { FX_BOOL bTransMask = FALSE) const; CPDF_Array*& GetArray() { return m_pArray; } - virtual CPDF_ColorSpace* GetBaseCS() const { return nullptr; } + virtual CPDF_ColorSpace* GetBaseCS() const; virtual void EnableStdConversion(FX_BOOL bEnabled); CPDF_Document* const m_pDocument; protected: - CPDF_ColorSpace(CPDF_Document* pDoc, int family, uint32_t nComponents) - : m_pDocument(pDoc), - m_Family(family), - m_nComponents(nComponents), - m_pArray(nullptr), - m_dwStdConversion(0) {} - virtual ~CPDF_ColorSpace() {} - - virtual FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { - return TRUE; - } + CPDF_ColorSpace(CPDF_Document* pDoc, int family, uint32_t nComponents); + virtual ~CPDF_ColorSpace(); + + virtual FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray); virtual FX_BOOL v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, - FX_FLOAT& k) const { - return FALSE; - } + FX_FLOAT& k) const; virtual FX_BOOL v_SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, - FX_FLOAT k) const { - return FALSE; - } + FX_FLOAT k) const; int m_Family; uint32_t m_nComponents; diff --git a/core/fpdfapi/fpdf_page/include/cpdf_form.h b/core/fpdfapi/fpdf_page/include/cpdf_form.h index 92acbca25a..c2cba0eb13 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_form.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_form.h @@ -22,8 +22,7 @@ class CPDF_Form : public CPDF_PageObjectHolder { CPDF_Dictionary* pPageResources, CPDF_Stream* pFormStream, CPDF_Dictionary* pParentResources = nullptr); - - ~CPDF_Form(); + ~CPDF_Form() override; void ParseContent(CPDF_AllStates* pGraphicStates, const CFX_Matrix* pParentMatrix, diff --git a/core/fpdfapi/fpdf_page/include/cpdf_formobject.h b/core/fpdfapi/fpdf_page/include/cpdf_formobject.h index b12d68c312..1a8db34e8f 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_formobject.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_formobject.h @@ -19,11 +19,11 @@ class CPDF_FormObject : public CPDF_PageObject { // CPDF_PageObject: CPDF_FormObject* Clone() const override; - Type GetType() const override { return FORM; }; + Type GetType() const override; void Transform(const CFX_Matrix& matrix) override; - bool IsForm() const override { return true; }; - CPDF_FormObject* AsForm() override { return this; }; - const CPDF_FormObject* AsForm() const override { return this; }; + bool IsForm() const override; + CPDF_FormObject* AsForm() override; + const CPDF_FormObject* AsForm() const override; void CalcBoundingBox(); diff --git a/core/fpdfapi/fpdf_page/include/cpdf_imageobject.h b/core/fpdfapi/fpdf_page/include/cpdf_imageobject.h index 9b983cc05c..1128d12f8b 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_imageobject.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_imageobject.h @@ -17,13 +17,13 @@ class CPDF_ImageObject : public CPDF_PageObject { CPDF_ImageObject(); ~CPDF_ImageObject() override; - // CPDF_PageObject: + // CPDF_PageObject CPDF_ImageObject* Clone() const override; - Type GetType() const override { return IMAGE; }; + Type GetType() const override; void Transform(const CFX_Matrix& matrix) override; - bool IsImage() const override { return true; }; - CPDF_ImageObject* AsImage() override { return this; }; - const CPDF_ImageObject* AsImage() const override { return this; }; + bool IsImage() const override; + CPDF_ImageObject* AsImage() override; + const CPDF_ImageObject* AsImage() const override; void CalcBoundingBox(); diff --git a/core/fpdfapi/fpdf_page/include/cpdf_page.h b/core/fpdfapi/fpdf_page/include/cpdf_page.h index 99734889af..e73c41db79 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_page.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_page.h @@ -26,7 +26,7 @@ class CPDF_Page : public CPDF_PageObjectHolder { CPDF_Page(CPDF_Document* pDocument, CPDF_Dictionary* pPageDict, bool bPageCache); - ~CPDF_Page(); + ~CPDF_Page() override; void ParseContent(); diff --git a/core/fpdfapi/fpdf_page/include/cpdf_pageobject.h b/core/fpdfapi/fpdf_page/include/cpdf_pageobject.h index 8e7da81e90..d9d584388e 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_pageobject.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_pageobject.h @@ -29,26 +29,26 @@ class CPDF_PageObject : public CPDF_GraphicStates { }; CPDF_PageObject(); - virtual ~CPDF_PageObject(); + ~CPDF_PageObject() override; virtual CPDF_PageObject* Clone() const = 0; virtual Type GetType() const = 0; virtual void Transform(const CFX_Matrix& matrix) = 0; - virtual bool IsText() const { return false; } - virtual bool IsPath() const { return false; } - virtual bool IsImage() const { return false; } - virtual bool IsShading() const { return false; } - virtual bool IsForm() const { return false; } - virtual CPDF_TextObject* AsText() { return nullptr; } - virtual const CPDF_TextObject* AsText() const { return nullptr; } - virtual CPDF_PathObject* AsPath() { return nullptr; } - virtual const CPDF_PathObject* AsPath() const { return nullptr; } - virtual CPDF_ImageObject* AsImage() { return nullptr; } - virtual const CPDF_ImageObject* AsImage() const { return nullptr; } - virtual CPDF_ShadingObject* AsShading() { return nullptr; } - virtual const CPDF_ShadingObject* AsShading() const { return nullptr; } - virtual CPDF_FormObject* AsForm() { return nullptr; } - virtual const CPDF_FormObject* AsForm() const { return nullptr; } + virtual bool IsText() const; + virtual bool IsPath() const; + virtual bool IsImage() const; + virtual bool IsShading() const; + virtual bool IsForm() const; + virtual CPDF_TextObject* AsText(); + virtual const CPDF_TextObject* AsText() const; + virtual CPDF_PathObject* AsPath(); + virtual const CPDF_PathObject* AsPath() const; + virtual CPDF_ImageObject* AsImage(); + virtual const CPDF_ImageObject* AsImage() const; + virtual CPDF_ShadingObject* AsShading(); + virtual const CPDF_ShadingObject* AsShading() const; + virtual CPDF_FormObject* AsForm(); + virtual const CPDF_FormObject* AsForm() const; void TransformClipPath(CFX_Matrix& matrix); void TransformGeneralState(CFX_Matrix& matrix); diff --git a/core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h b/core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h index 7ac9f2cea0..e75604858a 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h @@ -24,6 +24,7 @@ class CPDF_ContentParser; class CPDF_PageObjectHolder { public: CPDF_PageObjectHolder(); + virtual ~CPDF_PageObjectHolder(); void ContinueParse(IFX_Pause* pPause); bool IsParsed() const { return m_ParseState == CONTENT_PARSED; } diff --git a/core/fpdfapi/fpdf_page/include/cpdf_pathobject.h b/core/fpdfapi/fpdf_page/include/cpdf_pathobject.h index 296cdf8317..10d101222a 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_pathobject.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_pathobject.h @@ -17,13 +17,13 @@ class CPDF_PathObject : public CPDF_PageObject { CPDF_PathObject(); ~CPDF_PathObject() override; - // CPDF_PageObject: + // CPDF_PageObject CPDF_PathObject* Clone() const override; - Type GetType() const override { return PATH; }; + Type GetType() const override; void Transform(const CFX_Matrix& maxtrix) override; - bool IsPath() const override { return true; }; - CPDF_PathObject* AsPath() override { return this; }; - const CPDF_PathObject* AsPath() const override { return this; }; + bool IsPath() const override; + CPDF_PathObject* AsPath() override; + const CPDF_PathObject* AsPath() const override; void CalcBoundingBox(); diff --git a/core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h b/core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h index ae2ee90083..0607bcb42c 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h @@ -17,13 +17,13 @@ class CPDF_ShadingObject : public CPDF_PageObject { CPDF_ShadingObject(); ~CPDF_ShadingObject() override; - // CPDF_PageObject: + // CPDF_PageObject CPDF_ShadingObject* Clone() const override; - Type GetType() const override { return SHADING; }; + Type GetType() const override; void Transform(const CFX_Matrix& matrix) override; - bool IsShading() const override { return true; }; - CPDF_ShadingObject* AsShading() override { return this; }; - const CPDF_ShadingObject* AsShading() const override { return this; }; + bool IsShading() const override; + CPDF_ShadingObject* AsShading() override; + const CPDF_ShadingObject* AsShading() const override; void CalcBoundingBox(); diff --git a/core/fpdfapi/fpdf_page/include/cpdf_textobject.h b/core/fpdfapi/fpdf_page/include/cpdf_textobject.h index c47180ef6b..9438811006 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_textobject.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_textobject.h @@ -22,30 +22,30 @@ class CPDF_TextObject : public CPDF_PageObject { CPDF_TextObject(); ~CPDF_TextObject() override; - // CPDF_PageObject: + // CPDF_PageObject CPDF_TextObject* Clone() const override; - Type GetType() const override { return TEXT; }; + Type GetType() const override; void Transform(const CFX_Matrix& matrix) override; - bool IsText() const override { return true; }; - CPDF_TextObject* AsText() override { return this; }; - const CPDF_TextObject* AsText() const override { return this; }; + bool IsText() const override; + CPDF_TextObject* AsText() override; + const CPDF_TextObject* AsText() const override; - int CountItems() const { return m_nChars; } + int CountItems() const; void GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const; int CountChars() const; void GetCharInfo(int index, uint32_t& charcode, FX_FLOAT& kerning) const; void GetCharInfo(int index, CPDF_TextObjectItem* pInfo) const; FX_FLOAT GetCharWidth(uint32_t charcode) const; - FX_FLOAT GetPosX() const { return m_PosX; } - FX_FLOAT GetPosY() const { return m_PosY; } + FX_FLOAT GetPosX() const; + FX_FLOAT GetPosY() const; void GetTextMatrix(CFX_Matrix* pMatrix) const; - CPDF_Font* GetFont() const { return m_TextState.GetFont(); } - FX_FLOAT GetFontSize() const { return m_TextState.GetFontSize(); } + CPDF_Font* GetFont() const; + FX_FLOAT GetFontSize() const; void SetText(const CFX_ByteString& text); void SetPosition(FX_FLOAT x, FX_FLOAT y); - void RecalcPositionData() { CalcPositionData(nullptr, nullptr, 1); } + void RecalcPositionData(); protected: friend class CPDF_RenderStatus; |