diff options
author | tsepez <tsepez@chromium.org> | 2016-09-02 15:22:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-02 15:22:00 -0700 |
commit | bbee445c5a77dfbaea9041308f001c756e49c5fd (patch) | |
tree | 65fe8d3808891c81c791e8592ba3aba8d9e2d81c /core/fpdfapi/fpdf_page/include | |
parent | d54c9d8df1511f6abac291ec2ec660cef372d9d3 (diff) | |
download | pdfium-bbee445c5a77dfbaea9041308f001c756e49c5fd.tar.xz |
Make CPDF_GeneralState have a CPDF_GeneralStateDatachromium/2848
Remove a const cast along the way and propagate to callers.
Review-Url: https://codereview.chromium.org/2303553002
Diffstat (limited to 'core/fpdfapi/fpdf_page/include')
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_generalstate.h | 71 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h | 10 |
2 files changed, 63 insertions, 18 deletions
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_generalstate.h b/core/fpdfapi/fpdf_page/include/cpdf_generalstate.h index dff8371119..b653d640d7 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_generalstate.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_generalstate.h @@ -10,22 +10,67 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h" #include "core/fxcrt/include/fx_basic.h" -class CPDF_GeneralState : public CFX_CountRef<CPDF_GeneralStateData> { +class CPDF_GeneralState { public: + CPDF_GeneralState(); + CPDF_GeneralState(const CPDF_GeneralState& that); + ~CPDF_GeneralState(); + + void Emplace() { m_Ref.Emplace(); } + operator bool() const { return !!m_Ref; } + void SetRenderIntent(const CFX_ByteString& ri); - int GetBlendType() const { - const CPDF_GeneralStateData* pData = GetObject(); - return pData ? pData->m_BlendType : FXDIB_BLEND_NORMAL; - } - - int GetAlpha(FX_BOOL bStroke) const { - const CPDF_GeneralStateData* pData = GetObject(); - if (!pData) - return 255; - return FXSYS_round((bStroke ? pData->m_StrokeAlpha : pData->m_FillAlpha) * - 255); - } + 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_ByteStringC& mode); + + const FX_FLOAT* GetSMaskMatrix() const; + FX_FLOAT* GetMutableSMaskMatrix(); + + 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: + CFX_CountRef<CPDF_GeneralStateData> m_Ref; }; #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATE_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h b/core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h index a4577a6cb0..e19bcc76ac 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h @@ -33,11 +33,11 @@ class CPDF_GeneralStateData { CPDF_TransferFunc* m_pTransferFunc; CFX_Matrix m_Matrix; int m_RenderIntent; - FX_BOOL m_StrokeAdjust; - FX_BOOL m_AlphaSource; - FX_BOOL m_TextKnockout; - FX_BOOL m_StrokeOP; - FX_BOOL m_FillOP; + 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; |