Remove scale parameter from CFX_GraphState::SetLineDash()
The value used for this parameter is always 1. The iteratively remove
the scale parameter from CPDF_AllStates::SetLineDash() as well.
Change-Id: I5fcb16b80b594beeb4d463034e5df0cba10f7f7b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/124890
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Tom Sepez <tsepez@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_allstates.cpp b/core/fpdfapi/page/cpdf_allstates.cpp
index f46127c..253ebb2 100644
--- a/core/fpdfapi/page/cpdf_allstates.cpp
+++ b/core/fpdfapi/page/cpdf_allstates.cpp
@@ -31,11 +31,9 @@
m_GraphicStates.SetDefaultStates();
}
-void CPDF_AllStates::SetLineDash(const CPDF_Array* pArray,
- float phase,
- float scale) {
+void CPDF_AllStates::SetLineDash(const CPDF_Array* pArray, float phase) {
std::vector<float> dashes = ReadArrayElementsToVector(pArray, pArray->size());
- mutable_graph_state().SetLineDash(std::move(dashes), phase, scale);
+ mutable_graph_state().SetLineDash(std::move(dashes), phase);
}
void CPDF_AllStates::ProcessExtGS(const CPDF_Dictionary* pGS,
@@ -71,7 +69,7 @@
if (!pArray)
break;
- SetLineDash(pArray.Get(), pDash->GetFloatAt(1), 1.0f);
+ SetLineDash(pArray.Get(), pDash->GetFloatAt(1));
break;
}
case FXBSTR_ID('R', 'I', 0, 0):
diff --git a/core/fpdfapi/page/cpdf_allstates.h b/core/fpdfapi/page/cpdf_allstates.h
index 3feb845..a83c2b4 100644
--- a/core/fpdfapi/page/cpdf_allstates.h
+++ b/core/fpdfapi/page/cpdf_allstates.h
@@ -25,7 +25,7 @@
void ProcessExtGS(const CPDF_Dictionary* pGS,
CPDF_StreamContentParser* pParser);
- void SetLineDash(const CPDF_Array* pArray, float phase, float scale);
+ void SetLineDash(const CPDF_Array* pArray, float phase);
CFX_PointF GetTransformedTextPosition() const;
void ResetTextPosition();
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index b4c5f3a..d95562f 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -719,7 +719,7 @@
if (!pArray)
return;
- m_pCurStates->SetLineDash(pArray.Get(), GetNumber(0), 1.0f);
+ m_pCurStates->SetLineDash(pArray.Get(), GetNumber(0));
}
void CPDF_StreamContentParser::Handle_SetCharWidth() {
diff --git a/core/fxge/cfx_graphstate.cpp b/core/fxge/cfx_graphstate.cpp
index d974f46..54df2a9 100644
--- a/core/fxge/cfx_graphstate.cpp
+++ b/core/fxge/cfx_graphstate.cpp
@@ -18,14 +18,9 @@
m_Ref.Emplace();
}
-void CFX_GraphState::SetLineDash(std::vector<float> dashes,
- float phase,
- float scale) {
+void CFX_GraphState::SetLineDash(std::vector<float> dashes, float phase) {
CFX_GraphStateData* pData = m_Ref.GetPrivateCopy();
- pData->set_dash_phase(phase * scale);
- for (float& val : dashes) {
- val *= scale;
- }
+ pData->set_dash_phase(phase);
pData->set_dash_array(std::move(dashes));
}
diff --git a/core/fxge/cfx_graphstate.h b/core/fxge/cfx_graphstate.h
index ed53479..401913c 100644
--- a/core/fxge/cfx_graphstate.h
+++ b/core/fxge/cfx_graphstate.h
@@ -22,7 +22,7 @@
void Emplace();
- void SetLineDash(std::vector<float> dashes, float phase, float scale);
+ void SetLineDash(std::vector<float> dashes, float phase);
void SetLineDashPhase(float phase);
std::vector<float> GetLineDashArray() const;
size_t GetLineDashSize() const;
diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp
index d79c578..0309278 100644
--- a/fpdfsdk/fpdf_editpage.cpp
+++ b/fpdfsdk/fpdf_editpage.cpp
@@ -1045,7 +1045,7 @@
dashes.reserve(dash_count);
dashes.assign(dash_array, UNSAFE_TODO(dash_array + dash_count));
}
- pPageObj->mutable_graph_state().SetLineDash(dashes, phase, 1.0f);
+ pPageObj->mutable_graph_state().SetLineDash(dashes, phase);
pPageObj->SetDirty(true);
return true;
}