Initialize CPDF_GeneralState::StateData in the header.
Change-Id: I7049073c09ac87ef8041bfa51740c653a67b4bd3
Reviewed-on: https://pdfium-review.googlesource.com/c/44543
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_generalstate.cpp b/core/fpdfapi/page/cpdf_generalstate.cpp
index ea91273..7687626 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 @@
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 9ee20db..096271f 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 @@
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<CPDF_Object> m_pSoftMask;
CFX_Matrix m_SMaskMatrix;
- float m_StrokeAlpha;
- float m_FillAlpha;
+ float m_StrokeAlpha = 1.0f;
+ float m_FillAlpha = 1.0f;
UnownedPtr<const CPDF_Object> m_pTR;
RetainPtr<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;
+ 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<const CPDF_Object> m_pBG;
UnownedPtr<const CPDF_Object> m_pUCR;
UnownedPtr<const CPDF_Object> m_pHT;
- float m_Flatness;
- float m_Smoothness;
+ float m_Flatness = 1.0f;
+ float m_Smoothness = 0.0f;
};
SharedCopyOnWrite<StateData> m_Ref;