diff options
author | weili <weili@chromium.org> | 2016-06-13 14:57:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-13 14:57:29 -0700 |
commit | 868150bd69f0f1f9472affc20deea0a9341bf22b (patch) | |
tree | 07ebd9327583ecc20ebb43b800c2f36501a80068 /core/fpdfapi/fpdf_page/include | |
parent | 82e24b1c5047076b982c073671315071760b9880 (diff) | |
download | pdfium-868150bd69f0f1f9472affc20deea0a9341bf22b.tar.xz |
Make code compile with clang_use_chrome_plugin (part I)
This change contains files in core/fpdfapi directory. This is part
of the efforts to make PDFium code compilable by Clang chromium
style plugins.
The changes are mainly the following:
-- move inline constructor/destructor of complex class/struct out-of-line;
-- add constructor/destructor of complex class/struct if not
explicitly defined;
-- add explicit out-of-line copy constructor when needed;
-- move inline virtual functions out-of-line;
-- Properly mark virtual functions with 'override';
-- some minor cleanups;
BUG=pdfium:469
Review-Url: https://codereview.chromium.org/2060973002
Diffstat (limited to 'core/fpdfapi/fpdf_page/include')
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_colorspace.h | 37 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_form.h | 3 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_formobject.h | 8 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_imageobject.h | 10 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_page.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_pageobject.h | 32 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h | 1 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_pathobject.h | 10 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h | 10 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_textobject.h | 22 |
10 files changed, 59 insertions, 76 deletions
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; |