From b093c688eca06d43385cdc3aff2d0ba7395dbcc9 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 24 Oct 2018 23:51:37 +0000 Subject: Initialize CPDF_GeneralState::StateData in the header. Change-Id: I7049073c09ac87ef8041bfa51740c653a67b4bd3 Reviewed-on: https://pdfium-review.googlesource.com/c/44543 Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- core/fpdfapi/page/cpdf_generalstate.cpp | 24 +----------------------- core/fpdfapi/page/cpdf_generalstate.h | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 36 deletions(-) (limited to 'core') diff --git a/core/fpdfapi/page/cpdf_generalstate.cpp b/core/fpdfapi/page/cpdf_generalstate.cpp index ea912736fe..7687626e54 100644 --- a/core/fpdfapi/page/cpdf_generalstate.cpp +++ b/core/fpdfapi/page/cpdf_generalstate.cpp @@ -6,7 +6,6 @@ #include "core/fpdfapi/page/cpdf_generalstate.h" -#include "constants/transparency.h" #include "core/fpdfapi/parser/cpdf_document.h" #include "core/fpdfapi/render/cpdf_dibbase.h" #include "core/fpdfapi/render/cpdf_docrenderdata.h" @@ -259,28 +258,7 @@ CFX_Matrix* CPDF_GeneralState::GetMutableMatrix() { return &m_Ref.GetPrivateCopy()->m_Matrix; } -CPDF_GeneralState::StateData::StateData() - : m_BlendMode(pdfium::transparency::kNormal), - m_BlendType(0), - m_StrokeAlpha(1.0), - m_FillAlpha(1.0f), - m_pTR(nullptr), - m_pTransferFunc(nullptr), - m_RenderIntent(0), - m_StrokeAdjust(false), - m_AlphaSource(false), - m_TextKnockout(false), - m_StrokeOP(false), - m_FillOP(false), - m_OPMode(0), - m_pBG(nullptr), - m_pUCR(nullptr), - m_pHT(nullptr), - m_Flatness(1.0f), - m_Smoothness(0.0f) { - m_SMaskMatrix.SetIdentity(); - m_Matrix.SetIdentity(); -} +CPDF_GeneralState::StateData::StateData() = default; CPDF_GeneralState::StateData::StateData(const StateData& that) : m_BlendMode(that.m_BlendMode), diff --git a/core/fpdfapi/page/cpdf_generalstate.h b/core/fpdfapi/page/cpdf_generalstate.h index 9ee20db8a5..096271fd8b 100644 --- a/core/fpdfapi/page/cpdf_generalstate.h +++ b/core/fpdfapi/page/cpdf_generalstate.h @@ -7,6 +7,7 @@ #ifndef CORE_FPDFAPI_PAGE_CPDF_GENERALSTATE_H_ #define CORE_FPDFAPI_PAGE_CPDF_GENERALSTATE_H_ +#include "constants/transparency.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/shared_copy_on_write.h" @@ -83,27 +84,27 @@ class CPDF_GeneralState { StateData(const StateData& that); ~StateData() override; - ByteString m_BlendMode; - int m_BlendType; + ByteString m_BlendMode = pdfium::transparency::kNormal; + int m_BlendType = FXDIB_BLEND_NORMAL; UnownedPtr m_pSoftMask; CFX_Matrix m_SMaskMatrix; - float m_StrokeAlpha; - float m_FillAlpha; + float m_StrokeAlpha = 1.0f; + float m_FillAlpha = 1.0f; UnownedPtr m_pTR; RetainPtr 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; + int m_RenderIntent = 0; + bool m_StrokeAdjust = false; + bool m_AlphaSource = false; + bool m_TextKnockout = false; + bool m_StrokeOP = false; + bool m_FillOP = false; + int m_OPMode = 0; UnownedPtr m_pBG; UnownedPtr m_pUCR; UnownedPtr m_pHT; - float m_Flatness; - float m_Smoothness; + float m_Flatness = 1.0f; + float m_Smoothness = 0.0f; }; SharedCopyOnWrite m_Ref; -- cgit v1.2.3