diff options
author | dsinclair <dsinclair@chromium.org> | 2016-09-29 11:59:54 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-29 11:59:54 -0700 |
commit | 8a752ab21daa2dcd0314ab5e3908f8d6e7bba2b7 (patch) | |
tree | 32e57975bb7200fd406e655e96d07d103021d67f /core/fpdfapi/fpdf_page/include | |
parent | 166bc16e15a5be72fe19da97504b4837967333ff (diff) | |
download | pdfium-8a752ab21daa2dcd0314ab5e3908f8d6e7bba2b7.tar.xz |
Move core/fpdfapi/fpdf_page/include to core/fpdfapi/fpdf_page
BUG=pdfium:611
Review-Url: https://codereview.chromium.org/2379033002
Diffstat (limited to 'core/fpdfapi/fpdf_page/include')
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_clippath.h | 63 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_color.h | 41 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_colorspace.h | 121 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_form.h | 41 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_formobject.h | 37 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_generalstate.h | 109 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_image.h | 90 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_imageobject.h | 44 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_page.h | 69 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_pageobject.h | 71 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h | 68 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_path.h | 50 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_pathobject.h | 36 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h | 34 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_textobject.h | 69 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_textstate.h | 91 |
16 files changed, 0 insertions, 1034 deletions
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_clippath.h b/core/fpdfapi/fpdf_page/include/cpdf_clippath.h deleted file mode 100644 index 6b3cca0d41..0000000000 --- a/core/fpdfapi/fpdf_page/include/cpdf_clippath.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_CLIPPATH_H_ -#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_CLIPPATH_H_ - -#include <memory> -#include <utility> -#include <vector> - -#include "core/fpdfapi/fpdf_page/include/cpdf_path.h" -#include "core/fxcrt/include/cfx_count_ref.h" -#include "core/fxcrt/include/fx_basic.h" -#include "core/fxcrt/include/fx_coordinates.h" - -class CPDF_Path; -class CPDF_TextObject; - -class CPDF_ClipPath { - public: - CPDF_ClipPath(); - CPDF_ClipPath(const CPDF_ClipPath& that); - ~CPDF_ClipPath(); - - void Emplace() { m_Ref.Emplace(); } - void SetNull() { m_Ref.SetNull(); } - - explicit operator bool() const { return !!m_Ref; } - bool operator==(const CPDF_ClipPath& that) const { - return m_Ref == that.m_Ref; - } - bool operator!=(const CPDF_ClipPath& that) const { return !(*this == that); } - - uint32_t GetPathCount() const; - CPDF_Path GetPath(size_t i) const; - uint8_t GetClipType(size_t i) const; - uint32_t GetTextCount() const; - CPDF_TextObject* GetText(size_t i) const; - CFX_FloatRect GetClipBox() const; - void AppendPath(CPDF_Path path, uint8_t type, bool bAutoMerge); - void AppendTexts(std::vector<std::unique_ptr<CPDF_TextObject>>* pTexts); - void Transform(const CFX_Matrix& matrix); - - private: - class PathData { - public: - using PathAndTypeData = std::pair<CPDF_Path, uint8_t>; - - PathData(); - PathData(const PathData& that); - ~PathData(); - - std::vector<PathAndTypeData> m_PathAndTypeList; - std::vector<std::unique_ptr<CPDF_TextObject>> m_TextList; - }; - - CFX_CountRef<PathData> m_Ref; -}; - -#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_CLIPPATH_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_color.h b/core/fpdfapi/fpdf_page/include/cpdf_color.h deleted file mode 100644 index 89c0eac730..0000000000 --- a/core/fpdfapi/fpdf_page/include/cpdf_color.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_COLOR_H_ -#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_COLOR_H_ - -#include "core/fpdfapi/fpdf_page/include/cpdf_colorspace.h" -#include "core/fxcrt/include/fx_system.h" - -class CPDF_Pattern; - -class CPDF_Color { - public: - CPDF_Color(); - ~CPDF_Color(); - - bool IsNull() const { return !m_pBuffer; } - bool IsPattern() const; - - void Copy(const CPDF_Color* pSrc); - - void SetColorSpace(CPDF_ColorSpace* pCS); - void SetValue(FX_FLOAT* comp); - void SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comp, int ncomps); - - FX_BOOL GetRGB(int& R, int& G, int& B) const; - CPDF_Pattern* GetPattern() const; - const CPDF_ColorSpace* GetColorSpace() const { return m_pCS; } - - protected: - void ReleaseBuffer(); - void ReleaseColorSpace(); - - CPDF_ColorSpace* m_pCS; - FX_FLOAT* m_pBuffer; -}; - -#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_COLOR_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h b/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h deleted file mode 100644 index 19aadbf704..0000000000 --- a/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_COLORSPACE_H_ -#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_COLORSPACE_H_ - -#include <memory> - -#include "core/fxcrt/include/fx_string.h" -#include "core/fxcrt/include/fx_system.h" - -#define PDFCS_DEVICEGRAY 1 -#define PDFCS_DEVICERGB 2 -#define PDFCS_DEVICECMYK 3 -#define PDFCS_CALGRAY 4 -#define PDFCS_CALRGB 5 -#define PDFCS_LAB 6 -#define PDFCS_ICCBASED 7 -#define PDFCS_SEPARATION 8 -#define PDFCS_DEVICEN 9 -#define PDFCS_INDEXED 10 -#define PDFCS_PATTERN 11 - -class CPDF_Array; -class CPDF_Document; -class CPDF_Object; - -class CPDF_ColorSpace { - public: - static CPDF_ColorSpace* GetStockCS(int Family); - static CPDF_ColorSpace* ColorspaceFromName(const CFX_ByteString& name); - static std::unique_ptr<CPDF_ColorSpace> Load(CPDF_Document* pDoc, - CPDF_Object* pCSObj); - - void Release(); - - int GetBufSize() const; - FX_FLOAT* CreateBuf(); - void GetDefaultColor(FX_FLOAT* buf) const; - 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; - - FX_BOOL sRGB() const; - virtual FX_BOOL GetRGB(FX_FLOAT* pBuf, - FX_FLOAT& R, - FX_FLOAT& G, - FX_FLOAT& B) const = 0; - virtual FX_BOOL SetRGB(FX_FLOAT* pBuf, - FX_FLOAT R, - FX_FLOAT G, - FX_FLOAT B) const; - - FX_BOOL GetCMYK(FX_FLOAT* pBuf, - FX_FLOAT& c, - FX_FLOAT& m, - FX_FLOAT& y, - FX_FLOAT& k) const; - FX_BOOL SetCMYK(FX_FLOAT* pBuf, - FX_FLOAT c, - FX_FLOAT m, - FX_FLOAT y, - FX_FLOAT k) const; - - virtual void TranslateImageLine(uint8_t* dest_buf, - const uint8_t* src_buf, - int pixels, - int image_width, - int image_height, - FX_BOOL bTransMask = FALSE) const; - - CPDF_Array*& GetArray() { return m_pArray; } - 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); - 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; - virtual FX_BOOL v_SetCMYK(FX_FLOAT* pBuf, - FX_FLOAT c, - FX_FLOAT m, - FX_FLOAT y, - FX_FLOAT k) const; - - int m_Family; - uint32_t m_nComponents; - CPDF_Array* m_pArray; - uint32_t m_dwStdConversion; -}; - -namespace std { - -// Make std::unique_ptr<CPDF_ColorSpace> call Release() rather than -// simply deleting the object. -template <> -struct default_delete<CPDF_ColorSpace> { - void operator()(CPDF_ColorSpace* pColorSpace) const { - if (pColorSpace) - pColorSpace->Release(); - } -}; - -} // namespace std - -#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_COLORSPACE_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_form.h b/core/fpdfapi/fpdf_page/include/cpdf_form.h deleted file mode 100644 index c2cba0eb13..0000000000 --- a/core/fpdfapi/fpdf_page/include/cpdf_form.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_FORM_H_ -#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_FORM_H_ - -#include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" - -class CPDF_Document; -class CPDF_Dictionary; -class CPDF_Stream; -class CPDF_AllStates; -class CFX_Matrix; -class CPDF_Type3Char; - -class CPDF_Form : public CPDF_PageObjectHolder { - public: - CPDF_Form(CPDF_Document* pDocument, - CPDF_Dictionary* pPageResources, - CPDF_Stream* pFormStream, - CPDF_Dictionary* pParentResources = nullptr); - ~CPDF_Form() override; - - void ParseContent(CPDF_AllStates* pGraphicStates, - const CFX_Matrix* pParentMatrix, - CPDF_Type3Char* pType3Char, - int level = 0); - - CPDF_Form* Clone() const; - - private: - void StartParse(CPDF_AllStates* pGraphicStates, - const CFX_Matrix* pParentMatrix, - CPDF_Type3Char* pType3Char, - int level = 0); -}; - -#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_FORM_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_formobject.h b/core/fpdfapi/fpdf_page/include/cpdf_formobject.h deleted file mode 100644 index 5b146b268d..0000000000 --- a/core/fpdfapi/fpdf_page/include/cpdf_formobject.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_FORMOBJECT_H_ -#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_FORMOBJECT_H_ - -#include <memory> - -#include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" -#include "core/fxcrt/include/fx_coordinates.h" - -class CPDF_Form; - -class CPDF_FormObject : public CPDF_PageObject { - public: - CPDF_FormObject(); - ~CPDF_FormObject() override; - - // CPDF_PageObject: - CPDF_FormObject* Clone() const override; - Type GetType() const override; - void Transform(const CFX_Matrix& matrix) override; - bool IsForm() const override; - CPDF_FormObject* AsForm() override; - const CPDF_FormObject* AsForm() const override; - - void CalcBoundingBox(); - const CPDF_Form* form() const { return m_pForm.get(); } - - std::unique_ptr<CPDF_Form> m_pForm; - CFX_Matrix m_FormMatrix; -}; - -#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_FORMOBJECT_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_generalstate.h b/core/fpdfapi/fpdf_page/include/cpdf_generalstate.h deleted file mode 100644 index 1cd2d815c8..0000000000 --- a/core/fpdfapi/fpdf_page/include/cpdf_generalstate.h +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATE_H_ -#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATE_H_ - -#include "core/fxcrt/include/fx_basic.h" -#include "core/fxcrt/include/fx_coordinates.h" -#include "core/fxge/include/fx_dib.h" - -class CPDF_Object; -class CPDF_TransferFunc; - -class CPDF_GeneralState { - public: - CPDF_GeneralState(); - CPDF_GeneralState(const CPDF_GeneralState& that); - ~CPDF_GeneralState(); - - void Emplace() { m_Ref.Emplace(); } - explicit operator bool() const { return !!m_Ref; } - - void SetRenderIntent(const CFX_ByteString& ri); - - int GetBlendType() const; - void SetBlendType(int type); - - FX_FLOAT GetFillAlpha() const; - void SetFillAlpha(FX_FLOAT alpha); - - FX_FLOAT GetStrokeAlpha() const; - void SetStrokeAlpha(FX_FLOAT alpha); - - CPDF_Object* GetSoftMask() const; - void SetSoftMask(CPDF_Object* pObject); - - CPDF_Object* GetTR() const; - void SetTR(CPDF_Object* pObject); - - CPDF_TransferFunc* GetTransferFunc() const; - void SetTransferFunc(CPDF_TransferFunc* pFunc); - - void SetBlendMode(const CFX_ByteString& mode); - - const CFX_Matrix* GetSMaskMatrix() const; - void SetSMaskMatrix(const CFX_Matrix& matrix); - - bool GetFillOP() const; - void SetFillOP(bool op); - - bool GetStrokeOP() const; - void SetStrokeOP(bool op); - - int GetOPMode() const; - void SetOPMode(int mode); - - void SetBG(CPDF_Object* pObject); - void SetUCR(CPDF_Object* pObject); - void SetHT(CPDF_Object* pObject); - - void SetFlatness(FX_FLOAT flatness); - void SetSmoothness(FX_FLOAT smoothness); - - bool GetStrokeAdjust() const; - void SetStrokeAdjust(bool adjust); - - void SetAlphaSource(bool source); - void SetTextKnockout(bool knockout); - - void SetMatrix(const CFX_Matrix& matrix); - CFX_Matrix* GetMutableMatrix(); - - private: - class StateData { - public: - StateData(); - StateData(const StateData& that); - ~StateData(); - - CFX_ByteString m_BlendMode; - int m_BlendType; - CPDF_Object* m_pSoftMask; - CFX_Matrix m_SMaskMatrix; - FX_FLOAT m_StrokeAlpha; - FX_FLOAT m_FillAlpha; - CPDF_Object* m_pTR; - CPDF_TransferFunc* m_pTransferFunc; - CFX_Matrix m_Matrix; - int m_RenderIntent; - bool m_StrokeAdjust; - bool m_AlphaSource; - bool m_TextKnockout; - bool m_StrokeOP; - bool m_FillOP; - int m_OPMode; - CPDF_Object* m_pBG; - CPDF_Object* m_pUCR; - CPDF_Object* m_pHT; - FX_FLOAT m_Flatness; - FX_FLOAT m_Smoothness; - }; - - CFX_CountRef<StateData> m_Ref; -}; - -#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATE_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_image.h b/core/fpdfapi/fpdf_page/include/cpdf_image.h deleted file mode 100644 index ef48a04f95..0000000000 --- a/core/fpdfapi/fpdf_page/include/cpdf_image.h +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_ -#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_ - -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fxcrt/include/fx_system.h" - -#define PDF_IMAGE_NO_COMPRESS 0x0000 -#define PDF_IMAGE_LOSSY_COMPRESS 0x0001 -#define PDF_IMAGE_LOSSLESS_COMPRESS 0x0002 -#define PDF_IMAGE_MASK_LOSSY_COMPRESS 0x0004 -#define PDF_IMAGE_MASK_LOSSLESS_COMPRESS 0x0008 - -class CFX_DIBitmap; -class CFX_DIBSource; -class CPDF_Dictionay; -class CPDF_Document; -class CPDF_Page; -class IFX_FileRead; -class IFX_FileWrite; -class IFX_Pause; - -class CPDF_Image { - public: - explicit CPDF_Image(CPDF_Document* pDoc); - CPDF_Image(CPDF_Document* pDoc, CPDF_Stream* pStream, bool bInline); - ~CPDF_Image(); - - CPDF_Image* Clone(); - - CPDF_Dictionary* GetInlineDict() const { return m_pInlineDict; } - CPDF_Stream* GetStream() const { return m_pStream; } - CPDF_Dictionary* GetDict() const { - return m_pStream ? m_pStream->GetDict() : nullptr; - } - CPDF_Dictionary* GetOC() const { return m_pOC; } - CPDF_Document* GetDocument() const { return m_pDocument; } - - int32_t GetPixelHeight() const { return m_Height; } - int32_t GetPixelWidth() const { return m_Width; } - - bool IsInline() const { return m_bInline; } - bool IsMask() const { return m_bIsMask; } - bool IsInterpol() const { return m_bInterpolate; } - - CFX_DIBSource* LoadDIBSource(CFX_DIBSource** ppMask = nullptr, - uint32_t* pMatteColor = nullptr, - FX_BOOL bStdCS = FALSE, - uint32_t GroupFamily = 0, - FX_BOOL bLoadMask = FALSE) const; - - void SetInlineDict(CPDF_Dictionary* pDict) { m_pInlineDict = pDict; } - void SetImage(const CFX_DIBitmap* pDIBitmap, int32_t iCompress); - void SetJpegImage(IFX_FileRead* pFile); - - void ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pDIBitmap); - - FX_BOOL StartLoadDIBSource(CPDF_Dictionary* pFormResource, - CPDF_Dictionary* pPageResource, - FX_BOOL bStdCS = FALSE, - uint32_t GroupFamily = 0, - FX_BOOL bLoadMask = FALSE); - FX_BOOL Continue(IFX_Pause* pPause); - CFX_DIBSource* DetachBitmap(); - CFX_DIBSource* DetachMask(); - - CFX_DIBSource* m_pDIBSource; - CFX_DIBSource* m_pMask; - uint32_t m_MatteColor; - - private: - CPDF_Dictionary* InitJPEG(uint8_t* pData, uint32_t size); - - CPDF_Stream* m_pStream; - const bool m_bInline; - CPDF_Dictionary* m_pInlineDict; - int32_t m_Height; - int32_t m_Width; - bool m_bIsMask; - bool m_bInterpolate; - CPDF_Document* const m_pDocument; - CPDF_Dictionary* m_pOC; -}; - -#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_imageobject.h b/core/fpdfapi/fpdf_page/include/cpdf_imageobject.h deleted file mode 100644 index fdbd43c4a9..0000000000 --- a/core/fpdfapi/fpdf_page/include/cpdf_imageobject.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGEOBJECT_H_ -#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGEOBJECT_H_ - -#include <memory> - -#include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" -#include "core/fxcrt/include/fx_coordinates.h" - -class CPDF_Image; - -class CPDF_ImageObject : public CPDF_PageObject { - public: - CPDF_ImageObject(); - ~CPDF_ImageObject() override; - - // CPDF_PageObject - CPDF_ImageObject* Clone() const override; - Type GetType() const override; - void Transform(const CFX_Matrix& matrix) override; - bool IsImage() const override; - CPDF_ImageObject* AsImage() override; - const CPDF_ImageObject* AsImage() const override; - - void CalcBoundingBox(); - CPDF_Image* GetImage() const { return m_pImage; } - void SetOwnedImage(std::unique_ptr<CPDF_Image> pImage); - void SetUnownedImage(CPDF_Image* pImage); - - CFX_Matrix m_Matrix; - - private: - void Release(); - - CPDF_Image* m_pImage; - bool m_pImageOwned; -}; - -#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGEOBJECT_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_page.h b/core/fpdfapi/fpdf_page/include/cpdf_page.h deleted file mode 100644 index 5be82d5451..0000000000 --- a/core/fpdfapi/fpdf_page/include/cpdf_page.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGE_H_ -#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGE_H_ - -#include <memory> - -#include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" -#include "core/fxcrt/include/fx_basic.h" -#include "core/fxcrt/include/fx_coordinates.h" -#include "core/fxcrt/include/fx_system.h" - -class CPDF_Dictionary; -class CPDF_Document; -class CPDF_Object; -class CPDF_PageRenderCache; -class CPDF_PageRenderContext; - -class CPDF_Page : public CPDF_PageObjectHolder { - public: - class View {}; // Caller implements as desired, empty here due to layering. - - CPDF_Page(CPDF_Document* pDocument, - CPDF_Dictionary* pPageDict, - bool bPageCache); - ~CPDF_Page() override; - - void ParseContent(); - - void GetDisplayMatrix(CFX_Matrix& matrix, - int xPos, - int yPos, - int xSize, - int ySize, - int iRotate) const; - - FX_FLOAT GetPageWidth() const { return m_PageWidth; } - FX_FLOAT GetPageHeight() const { return m_PageHeight; } - CFX_FloatRect GetPageBBox() const { return m_BBox; } - const CFX_Matrix& GetPageMatrix() const { return m_PageMatrix; } - CPDF_Object* GetPageAttr(const CFX_ByteString& name) const; - CPDF_PageRenderCache* GetRenderCache() const { return m_pPageRender.get(); } - - CPDF_PageRenderContext* GetRenderContext() const { - return m_pRenderContext.get(); - } - void SetRenderContext(std::unique_ptr<CPDF_PageRenderContext> pContext); - - View* GetView() const { return m_pView; } - void SetView(View* pView) { m_pView = pView; } - - protected: - friend class CPDF_ContentParser; - - void StartParse(); - - FX_FLOAT m_PageWidth; - FX_FLOAT m_PageHeight; - CFX_Matrix m_PageMatrix; - View* m_pView; - std::unique_ptr<CPDF_PageRenderCache> m_pPageRender; - std::unique_ptr<CPDF_PageRenderContext> m_pRenderContext; -}; - -#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGE_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_pageobject.h b/core/fpdfapi/fpdf_page/include/cpdf_pageobject.h deleted file mode 100644 index d9d584388e..0000000000 --- a/core/fpdfapi/fpdf_page/include/cpdf_pageobject.h +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGEOBJECT_H_ -#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGEOBJECT_H_ - -#include "core/fpdfapi/fpdf_page/cpdf_contentmark.h" -#include "core/fpdfapi/fpdf_page/cpdf_graphicstates.h" -#include "core/fxcrt/include/fx_coordinates.h" -#include "core/fxcrt/include/fx_system.h" - -class CPDF_TextObject; -class CPDF_PathObject; -class CPDF_ImageObject; -class CPDF_ShadingObject; -class CPDF_FormObject; - -class CPDF_PageObject : public CPDF_GraphicStates { - public: - enum Type { - TEXT = 1, - PATH, - IMAGE, - SHADING, - FORM, - }; - - 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; - 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); - FX_RECT GetBBox(const CFX_Matrix* pMatrix) const; - - FX_FLOAT m_Left; - FX_FLOAT m_Right; - FX_FLOAT m_Top; - FX_FLOAT m_Bottom; - CPDF_ContentMark m_ContentMark; - - protected: - void CopyData(const CPDF_PageObject* pSrcObject); - - private: - CPDF_PageObject(const CPDF_PageObject& src) = delete; - void operator=(const CPDF_PageObject& src) = delete; -}; - -#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGEOBJECT_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h b/core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h deleted file mode 100644 index e75604858a..0000000000 --- a/core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGEOBJECTHOLDER_H_ -#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGEOBJECTHOLDER_H_ - -#include "core/fpdfapi/fpdf_page/cpdf_pageobjectlist.h" -#include "core/fxcrt/include/fx_coordinates.h" -#include "core/fxcrt/include/fx_system.h" - -class IFX_Pause; -class CPDF_Dictionary; -class CPDF_Stream; -class CPDF_Document; -class CPDF_ContentParser; - -#define PDFTRANS_GROUP 0x0100 -#define PDFTRANS_ISOLATED 0x0200 -#define PDFTRANS_KNOCKOUT 0x0400 - -class CPDF_PageObjectHolder { - public: - CPDF_PageObjectHolder(); - virtual ~CPDF_PageObjectHolder(); - - void ContinueParse(IFX_Pause* pPause); - bool IsParsed() const { return m_ParseState == CONTENT_PARSED; } - - CPDF_PageObjectList* GetPageObjectList() { return &m_PageObjectList; } - const CPDF_PageObjectList* GetPageObjectList() const { - return &m_PageObjectList; - } - - FX_BOOL BackgroundAlphaNeeded() const { return m_bBackgroundAlphaNeeded; } - void SetBackgroundAlphaNeeded(FX_BOOL needed) { - m_bBackgroundAlphaNeeded = needed; - } - - FX_BOOL HasImageMask() const { return m_bHasImageMask; } - void SetHasImageMask(FX_BOOL value) { m_bHasImageMask = value; } - - void Transform(const CFX_Matrix& matrix); - CFX_FloatRect CalcBoundingBox() const; - - CPDF_Dictionary* m_pFormDict; - CPDF_Stream* m_pFormStream; - CPDF_Document* m_pDocument; - CPDF_Dictionary* m_pPageResources; - CPDF_Dictionary* m_pResources; - CFX_FloatRect m_BBox; - int m_Transparency; - - protected: - enum ParseState { CONTENT_NOT_PARSED, CONTENT_PARSING, CONTENT_PARSED }; - - void LoadTransInfo(); - - FX_BOOL m_bBackgroundAlphaNeeded; - FX_BOOL m_bHasImageMask; - ParseState m_ParseState; - std::unique_ptr<CPDF_ContentParser> m_pParser; - CPDF_PageObjectList m_PageObjectList; -}; - -#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGEOBJECTHOLDER_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_path.h b/core/fpdfapi/fpdf_page/include/cpdf_path.h deleted file mode 100644 index ae98531214..0000000000 --- a/core/fpdfapi/fpdf_page/include/cpdf_path.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATH_H_ -#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATH_H_ - -#include "core/fxcrt/include/cfx_count_ref.h" -#include "core/fxcrt/include/fx_system.h" -#include "core/fxge/include/cfx_fxgedevice.h" -#include "core/fxge/include/cfx_pathdata.h" -#include "core/fxge/include/cfx_renderdevice.h" - -class CPDF_Path { - public: - CPDF_Path(); - CPDF_Path(const CPDF_Path& that); - ~CPDF_Path(); - - void Emplace() { m_Ref.Emplace(); } - explicit operator bool() const { return !!m_Ref; } - - int GetPointCount() const; - void SetPointCount(int count); - const FX_PATHPOINT* GetPoints() const; - FX_PATHPOINT* GetMutablePoints(); - - int GetFlag(int index) const; - FX_FLOAT GetPointX(int index) const; - FX_FLOAT GetPointY(int index) const; - CFX_FloatRect GetBoundingBox() const; - CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const; - - FX_BOOL IsRect() const; - void Transform(const CFX_Matrix* pMatrix); - - void Append(const CPDF_Path& other, const CFX_Matrix* pMatrix); - void Append(const CFX_PathData* pData, const CFX_Matrix* pMatrix); - void AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top); - - // TODO(tsepez): Remove when all access thru this class. - const CFX_PathData* GetObject() const { return m_Ref.GetObject(); } - - private: - CFX_CountRef<CFX_PathData> m_Ref; -}; - -#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATH_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_pathobject.h b/core/fpdfapi/fpdf_page/include/cpdf_pathobject.h deleted file mode 100644 index 10d101222a..0000000000 --- a/core/fpdfapi/fpdf_page/include/cpdf_pathobject.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATHOBJECT_H_ -#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATHOBJECT_H_ - -#include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" -#include "core/fpdfapi/fpdf_page/include/cpdf_path.h" -#include "core/fxcrt/include/fx_coordinates.h" -#include "core/fxcrt/include/fx_system.h" - -class CPDF_PathObject : public CPDF_PageObject { - public: - CPDF_PathObject(); - ~CPDF_PathObject() override; - - // CPDF_PageObject - CPDF_PathObject* Clone() const override; - Type GetType() const override; - void Transform(const CFX_Matrix& maxtrix) override; - bool IsPath() const override; - CPDF_PathObject* AsPath() override; - const CPDF_PathObject* AsPath() const override; - - void CalcBoundingBox(); - - CPDF_Path m_Path; - int m_FillType; - FX_BOOL m_bStroke; - CFX_Matrix m_Matrix; -}; - -#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATHOBJECT_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h b/core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h deleted file mode 100644 index 0607bcb42c..0000000000 --- a/core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_SHADINGOBJECT_H_ -#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_SHADINGOBJECT_H_ - -#include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" -#include "core/fxcrt/include/fx_coordinates.h" - -class CPDF_ShadingPattern; - -class CPDF_ShadingObject : public CPDF_PageObject { - public: - CPDF_ShadingObject(); - ~CPDF_ShadingObject() override; - - // CPDF_PageObject - CPDF_ShadingObject* Clone() const override; - Type GetType() const override; - void Transform(const CFX_Matrix& matrix) override; - bool IsShading() const override; - CPDF_ShadingObject* AsShading() override; - const CPDF_ShadingObject* AsShading() const override; - - void CalcBoundingBox(); - - CPDF_ShadingPattern* m_pShading; - CFX_Matrix m_Matrix; -}; - -#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_SHADINGOBJECT_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_textobject.h b/core/fpdfapi/fpdf_page/include/cpdf_textobject.h deleted file mode 100644 index 9438811006..0000000000 --- a/core/fpdfapi/fpdf_page/include/cpdf_textobject.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_TEXTOBJECT_H_ -#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_TEXTOBJECT_H_ - -#include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" -#include "core/fxcrt/include/fx_string.h" -#include "core/fxcrt/include/fx_system.h" - -struct CPDF_TextObjectItem { - uint32_t m_CharCode; - FX_FLOAT m_OriginX; - FX_FLOAT m_OriginY; -}; - -class CPDF_TextObject : public CPDF_PageObject { - public: - CPDF_TextObject(); - ~CPDF_TextObject() override; - - // CPDF_PageObject - CPDF_TextObject* Clone() const override; - Type GetType() const override; - void Transform(const CFX_Matrix& matrix) override; - bool IsText() const override; - CPDF_TextObject* AsText() override; - const CPDF_TextObject* AsText() const override; - - 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; - FX_FLOAT GetPosY() const; - void GetTextMatrix(CFX_Matrix* pMatrix) const; - CPDF_Font* GetFont() const; - FX_FLOAT GetFontSize() const; - - void SetText(const CFX_ByteString& text); - void SetPosition(FX_FLOAT x, FX_FLOAT y); - - void RecalcPositionData(); - - protected: - friend class CPDF_RenderStatus; - friend class CPDF_StreamContentParser; - friend class CPDF_TextRenderer; - - void SetSegments(const CFX_ByteString* pStrs, FX_FLOAT* pKerning, int nSegs); - - void CalcPositionData(FX_FLOAT* pTextAdvanceX, - FX_FLOAT* pTextAdvanceY, - FX_FLOAT horz_scale, - int level = 0); - - FX_FLOAT m_PosX; - FX_FLOAT m_PosY; - int m_nChars; - uint32_t* m_pCharCodes; - FX_FLOAT* m_pCharPos; -}; - -#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_TEXTOBJECT_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_textstate.h b/core/fpdfapi/fpdf_page/include/cpdf_textstate.h deleted file mode 100644 index b457026bc8..0000000000 --- a/core/fpdfapi/fpdf_page/include/cpdf_textstate.h +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_TEXTSTATE_H_ -#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_TEXTSTATE_H_ - -#include "core/fxcrt/include/cfx_count_ref.h" -#include "core/fxcrt/include/fx_basic.h" - -class CPDF_Document; -class CPDF_Font; - -// See PDF Reference 1.7, page 402, table 5.3. -enum class TextRenderingMode { - MODE_FILL = 0, - MODE_STROKE = 1, - MODE_FILL_STROKE = 2, - MODE_INVISIBLE = 3, - MODE_FILL_CLIP = 4, - MODE_STROKE_CLIP = 5, - MODE_FILL_STROKE_CLIP = 6, - MODE_CLIP = 7, -}; - -class CPDF_TextState { - public: - CPDF_TextState(); - ~CPDF_TextState(); - - void Emplace(); - - CPDF_Font* GetFont() const; - void SetFont(CPDF_Font* pFont); - - FX_FLOAT GetFontSize() const; - void SetFontSize(FX_FLOAT size); - - const FX_FLOAT* GetMatrix() const; - FX_FLOAT* GetMutableMatrix(); - - FX_FLOAT GetCharSpace() const; - void SetCharSpace(FX_FLOAT sp); - - FX_FLOAT GetWordSpace() const; - void SetWordSpace(FX_FLOAT sp); - - FX_FLOAT GetFontSizeV() const; - FX_FLOAT GetFontSizeH() const; - FX_FLOAT GetBaselineAngle() const; - FX_FLOAT GetShearAngle() const; - - TextRenderingMode GetTextMode() const; - void SetTextMode(TextRenderingMode mode); - - const FX_FLOAT* GetCTM() const; - FX_FLOAT* GetMutableCTM(); - - private: - class TextData { - public: - TextData(); - TextData(const TextData& src); - ~TextData(); - - void SetFont(CPDF_Font* pFont); - FX_FLOAT GetFontSizeV() const; - FX_FLOAT GetFontSizeH() const; - FX_FLOAT GetBaselineAngle() const; - FX_FLOAT GetShearAngle() const; - - CPDF_Font* m_pFont; - CPDF_Document* m_pDocument; - FX_FLOAT m_FontSize; - FX_FLOAT m_CharSpace; - FX_FLOAT m_WordSpace; - TextRenderingMode m_TextMode; - FX_FLOAT m_Matrix[4]; - FX_FLOAT m_CTM[4]; - }; - - CFX_CountRef<TextData> m_Ref; -}; - -bool SetTextRenderingModeFromInt(int iMode, TextRenderingMode* mode); -bool TextRenderingModeIsClipMode(const TextRenderingMode& mode); -bool TextRenderingModeIsStrokeMode(const TextRenderingMode& mode); - -#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_TEXTSTATE_H_ |