Rename member variables in CPDF_Color to follow Google C++ Style
Bug: 42271580
Change-Id: I300c2df160812333e38cb5ec6c63623df8071a37
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/120493
Reviewed-by: Thomas Sepez <tsepez@google.com>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_color.cpp b/core/fpdfapi/page/cpdf_color.cpp
index 17988cc..e59db9b 100644
--- a/core/fpdfapi/page/cpdf_color.cpp
+++ b/core/fpdfapi/page/cpdf_color.cpp
@@ -22,76 +22,77 @@
CPDF_Color::~CPDF_Color() = default;
bool CPDF_Color::IsPattern() const {
- return m_pCS && IsPatternInternal();
+ return cs_ && IsPatternInternal();
}
bool CPDF_Color::IsPatternInternal() const {
- return m_pCS->GetFamily() == CPDF_ColorSpace::Family::kPattern;
+ return cs_->GetFamily() == CPDF_ColorSpace::Family::kPattern;
}
void CPDF_Color::SetColorSpace(RetainPtr<CPDF_ColorSpace> colorspace) {
- m_pCS = std::move(colorspace);
+ cs_ = std::move(colorspace);
if (IsPatternInternal()) {
- m_Buffer.clear();
- m_pValue = std::make_unique<PatternValue>();
+ buffer_.clear();
+ value_ = std::make_unique<PatternValue>();
} else {
- m_Buffer = m_pCS->CreateBufAndSetDefaultColor();
- m_pValue.reset();
+ buffer_ = cs_->CreateBufAndSetDefaultColor();
+ value_.reset();
}
}
void CPDF_Color::SetValueForNonPattern(std::vector<float> values) {
CHECK(!IsPatternInternal());
- CHECK_LE(m_pCS->ComponentCount(), values.size());
- m_Buffer = std::move(values);
+ CHECK_LE(cs_->ComponentCount(), values.size());
+ buffer_ = std::move(values);
}
void CPDF_Color::SetValueForPattern(RetainPtr<CPDF_Pattern> pattern,
pdfium::span<float> values) {
- if (values.size() > kMaxPatternColorComps)
+ if (values.size() > kMaxPatternColorComps) {
return;
+ }
if (!IsPattern()) {
SetColorSpace(
CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kPattern));
}
- m_pValue->SetPattern(std::move(pattern));
- m_pValue->SetComps(values);
+ value_->SetPattern(std::move(pattern));
+ value_->SetComps(values);
}
CPDF_Color& CPDF_Color::operator=(const CPDF_Color& that) {
- if (this == &that)
+ if (this == &that) {
return *this;
+ }
- m_Buffer = that.m_Buffer;
- m_pValue =
- that.m_pValue ? std::make_unique<PatternValue>(*that.m_pValue) : nullptr;
- m_pCS = that.m_pCS;
+ buffer_ = that.buffer_;
+ value_ = that.value_ ? std::make_unique<PatternValue>(*that.value_) : nullptr;
+ cs_ = that.cs_;
return *this;
}
uint32_t CPDF_Color::ComponentCount() const {
- return m_pCS->ComponentCount();
+ return cs_->ComponentCount();
}
bool CPDF_Color::IsColorSpaceRGB() const {
- return m_pCS ==
+ return cs_ ==
CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kDeviceRGB);
}
bool CPDF_Color::IsColorSpaceGray() const {
- return m_pCS ==
+ return cs_ ==
CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kDeviceGray);
}
std::optional<FX_COLORREF> CPDF_Color::GetColorRef() const {
if (IsPatternInternal()) {
- if (m_pValue) {
- return m_pCS->AsPatternCS()->GetPatternColorRef(*m_pValue);
+ if (value_) {
+ return cs_->AsPatternCS()->GetPatternColorRef(*value_);
}
} else {
- if (!m_Buffer.empty()) {
- return m_pCS->GetColorRef(m_Buffer);
+ if (!buffer_.empty()) {
+ return cs_->GetColorRef(buffer_);
}
}
return std::nullopt;
@@ -99,5 +100,5 @@
RetainPtr<CPDF_Pattern> CPDF_Color::GetPattern() const {
DCHECK(IsPattern());
- return m_pValue ? m_pValue->GetPattern() : nullptr;
+ return value_ ? value_->GetPattern() : nullptr;
}
diff --git a/core/fpdfapi/page/cpdf_color.h b/core/fpdfapi/page/cpdf_color.h
index d4f36f5..c42b1cb 100644
--- a/core/fpdfapi/page/cpdf_color.h
+++ b/core/fpdfapi/page/cpdf_color.h
@@ -30,7 +30,7 @@
CPDF_Color& operator=(const CPDF_Color& that);
- bool IsNull() const { return m_Buffer.empty() && !m_pValue; }
+ bool IsNull() const { return buffer_.empty() && !value_; }
bool IsPattern() const;
void SetColorSpace(RetainPtr<CPDF_ColorSpace> colorspace);
void SetValueForNonPattern(std::vector<float> values);
@@ -48,9 +48,9 @@
protected:
bool IsPatternInternal() const;
- std::vector<float> m_Buffer; // Used for non-pattern colorspaces.
- std::unique_ptr<PatternValue> m_pValue; // Used for pattern colorspaces.
- RetainPtr<CPDF_ColorSpace> m_pCS;
+ std::vector<float> buffer_; // Used for non-pattern colorspaces.
+ std::unique_ptr<PatternValue> value_; // Used for pattern colorspaces.
+ RetainPtr<CPDF_ColorSpace> cs_;
};
#endif // CORE_FPDFAPI_PAGE_CPDF_COLOR_H_