From fed6e124109f089a38e24e37b104d983231bee78 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 24 Sep 2018 17:55:00 +0000 Subject: Give CFX_GraphStateData a work-over. Use std::vector for dash array. Use compiler-generated default operations. Squeeze some enums. Fix obvious logic botch in DashChanged(). Change-Id: If1d809cc46a3cf2db98a09a3f5a49d22138c0640 Reviewed-on: https://pdfium-review.googlesource.com/42613 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 3 +-- fpdfsdk/pwl/cpwl_edit.cpp | 10 ++++------ 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index 7feda490ba..d76ce99578 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -86,8 +86,7 @@ void CFFL_InteractiveFormFiller::OnDraw(CPDFSDK_PageView* pPageView, false); CFX_GraphStateData gsd; - gsd.SetDashCount(1); - gsd.m_DashArray[0] = 1.0f; + gsd.m_DashArray = {1.0f}; gsd.m_DashPhase = 0; gsd.m_LineWidth = 1.0f; pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255, 0, 0, 0), diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp index c4ff2f4bd4..4cd238b679 100644 --- a/fpdfsdk/pwl/cpwl_edit.cpp +++ b/fpdfsdk/pwl/cpwl_edit.cpp @@ -201,12 +201,10 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, } case BorderStyle::DASH: { CFX_GraphStateData gsd; - gsd.m_LineWidth = (float)GetBorderWidth(); - - gsd.SetDashCount(2); - gsd.m_DashArray[0] = (float)GetBorderDash().nDash; - gsd.m_DashArray[1] = (float)GetBorderDash().nGap; - gsd.m_DashPhase = (float)GetBorderDash().nPhase; + gsd.m_LineWidth = static_cast(GetBorderWidth()); + gsd.m_DashArray = {static_cast(GetBorderDash().nDash), + static_cast(GetBorderDash().nGap)}; + gsd.m_DashPhase = static_cast(GetBorderDash().nPhase); CFX_PathData path; for (int32_t i = 0; i < nCharArray - 1; i++) { -- cgit v1.2.3