Index: core/fpdfapi/fpdf_page/cpdf_generalstate.cpp |
diff --git a/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp b/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp |
index 0f6cce6e29846b44045613f4f19c10a0cae2e06b..e34801f534b721f2edcd16e149a80c1296d7fc5d 100644 |
--- a/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp |
+++ b/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp |
@@ -24,6 +24,151 @@ int RI_StringToId(const CFX_ByteString& ri) { |
} // namespace |
+CPDF_GeneralState::CPDF_GeneralState() {} |
+ |
+CPDF_GeneralState::CPDF_GeneralState(const CPDF_GeneralState& that) |
+ : m_Ref(that.m_Ref) {} |
+ |
+CPDF_GeneralState::~CPDF_GeneralState() {} |
+ |
void CPDF_GeneralState::SetRenderIntent(const CFX_ByteString& ri) { |
- GetPrivateCopy()->m_RenderIntent = RI_StringToId(ri); |
+ m_Ref.GetPrivateCopy()->m_RenderIntent = RI_StringToId(ri); |
+} |
+ |
+int CPDF_GeneralState::GetBlendType() const { |
+ const CPDF_GeneralStateData* pData = m_Ref.GetObject(); |
+ return pData ? pData->m_BlendType : FXDIB_BLEND_NORMAL; |
+} |
+ |
+void CPDF_GeneralState::SetBlendType(int type) { |
+ m_Ref.GetPrivateCopy()->m_BlendType = type; |
+} |
+ |
+FX_FLOAT CPDF_GeneralState::GetFillAlpha() const { |
+ const CPDF_GeneralStateData* pData = m_Ref.GetObject(); |
+ return pData ? pData->m_FillAlpha : 1.0f; |
+} |
+ |
+void CPDF_GeneralState::SetFillAlpha(FX_FLOAT alpha) { |
+ m_Ref.GetPrivateCopy()->m_FillAlpha = alpha; |
+} |
+ |
+FX_FLOAT CPDF_GeneralState::GetStrokeAlpha() const { |
+ const CPDF_GeneralStateData* pData = m_Ref.GetObject(); |
+ return pData ? pData->m_StrokeAlpha : 1.0f; |
+} |
+ |
+void CPDF_GeneralState::SetStrokeAlpha(FX_FLOAT alpha) { |
+ m_Ref.GetPrivateCopy()->m_StrokeAlpha = alpha; |
+} |
+ |
+CPDF_Object* CPDF_GeneralState::GetSoftMask() const { |
+ const CPDF_GeneralStateData* pData = m_Ref.GetObject(); |
+ return pData ? pData->m_pSoftMask : nullptr; |
+} |
+ |
+void CPDF_GeneralState::SetSoftMask(CPDF_Object* pObject) { |
+ m_Ref.GetPrivateCopy()->m_pSoftMask = pObject; |
+} |
+ |
+CPDF_Object* CPDF_GeneralState::GetTR() const { |
+ const CPDF_GeneralStateData* pData = m_Ref.GetObject(); |
+ return pData ? pData->m_pTR : nullptr; |
+} |
+ |
+void CPDF_GeneralState::SetTR(CPDF_Object* pObject) { |
+ m_Ref.GetPrivateCopy()->m_pTR = pObject; |
+} |
+ |
+CPDF_TransferFunc* CPDF_GeneralState::GetTransferFunc() const { |
+ const CPDF_GeneralStateData* pData = m_Ref.GetObject(); |
+ return pData ? pData->m_pTransferFunc : nullptr; |
+} |
+ |
+void CPDF_GeneralState::SetTransferFunc(CPDF_TransferFunc* pFunc) { |
+ m_Ref.GetPrivateCopy()->m_pTransferFunc = pFunc; |
+} |
+ |
+void CPDF_GeneralState::SetBlendMode(const CFX_ByteStringC& mode) { |
+ m_Ref.GetPrivateCopy()->SetBlendMode(mode); |
+} |
+ |
+const FX_FLOAT* CPDF_GeneralState::GetSMaskMatrix() const { |
+ const CPDF_GeneralStateData* pData = m_Ref.GetObject(); |
+ return pData ? pData->m_SMaskMatrix : nullptr; |
+} |
+ |
+FX_FLOAT* CPDF_GeneralState::GetMutableSMaskMatrix() { |
+ return m_Ref.GetPrivateCopy()->m_SMaskMatrix; |
+} |
+ |
+bool CPDF_GeneralState::GetFillOP() const { |
+ const CPDF_GeneralStateData* pData = m_Ref.GetObject(); |
+ return pData && pData->m_FillOP; |
+} |
+ |
+void CPDF_GeneralState::SetFillOP(bool op) { |
+ m_Ref.GetPrivateCopy()->m_FillOP = op; |
+} |
+ |
+void CPDF_GeneralState::SetStrokeOP(bool op) { |
+ m_Ref.GetPrivateCopy()->m_StrokeOP = op; |
+} |
+ |
+bool CPDF_GeneralState::GetStrokeOP() const { |
+ const CPDF_GeneralStateData* pData = m_Ref.GetObject(); |
+ return pData && pData->m_StrokeOP; |
+} |
+ |
+int CPDF_GeneralState::GetOPMode() const { |
+ return m_Ref.GetObject()->m_OPMode; |
+} |
+ |
+void CPDF_GeneralState::SetOPMode(int mode) { |
+ m_Ref.GetPrivateCopy()->m_OPMode = mode; |
+} |
+ |
+void CPDF_GeneralState::SetBG(CPDF_Object* pObject) { |
+ m_Ref.GetPrivateCopy()->m_pBG = pObject; |
+} |
+ |
+void CPDF_GeneralState::SetUCR(CPDF_Object* pObject) { |
+ m_Ref.GetPrivateCopy()->m_pUCR = pObject; |
+} |
+ |
+void CPDF_GeneralState::SetHT(CPDF_Object* pObject) { |
+ m_Ref.GetPrivateCopy()->m_pHT = pObject; |
+} |
+ |
+void CPDF_GeneralState::SetFlatness(FX_FLOAT flatness) { |
+ m_Ref.GetPrivateCopy()->m_Flatness = flatness; |
+} |
+ |
+void CPDF_GeneralState::SetSmoothness(FX_FLOAT smoothness) { |
+ m_Ref.GetPrivateCopy()->m_Smoothness = smoothness; |
+} |
+ |
+bool CPDF_GeneralState::GetStrokeAdjust() const { |
+ const CPDF_GeneralStateData* pData = m_Ref.GetObject(); |
+ return pData && pData->m_StrokeAdjust; |
+} |
+ |
+void CPDF_GeneralState::SetStrokeAdjust(bool adjust) { |
+ m_Ref.GetPrivateCopy()->m_StrokeAdjust = adjust; |
+} |
+ |
+void CPDF_GeneralState::SetAlphaSource(bool source) { |
+ m_Ref.GetPrivateCopy()->m_AlphaSource = source; |
+} |
+ |
+void CPDF_GeneralState::SetTextKnockout(bool knockout) { |
+ m_Ref.GetPrivateCopy()->m_TextKnockout = knockout; |
+} |
+ |
+void CPDF_GeneralState::SetMatrix(const CFX_Matrix& matrix) { |
+ m_Ref.GetPrivateCopy()->m_Matrix = matrix; |
+} |
+ |
+CFX_Matrix* CPDF_GeneralState::GetMutableMatrix() { |
+ return &m_Ref.GetPrivateCopy()->m_Matrix; |
} |