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 --- core/fxge/win32/fx_win32_gdipext.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'core/fxge/win32/fx_win32_gdipext.cpp') diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp index eee6b8798a..8d361e7c5e 100644 --- a/core/fxge/win32/fx_win32_gdipext.cpp +++ b/core/fxge/win32/fx_win32_gdipext.cpp @@ -770,15 +770,15 @@ GpPen* GdipCreatePenImpl(const CFX_GraphStateData* pGraphState, break; } CallFunc(GdipSetPenLineJoin)(pPen, lineJoin); - if (pGraphState->m_DashCount) { - float* pDashArray = FX_Alloc( - float, pGraphState->m_DashCount + pGraphState->m_DashCount % 2); + if (!pGraphState->m_DashArray.empty()) { + float* pDashArray = + FX_Alloc(float, (pGraphState->m_DashArray.size() + 1) & ~1); int nCount = 0; float on_leftover = 0, off_leftover = 0; - for (int i = 0; i < pGraphState->m_DashCount; i += 2) { + for (size_t i = 0; i < pGraphState->m_DashArray.size(); i += 2) { float on_phase = pGraphState->m_DashArray[i]; float off_phase; - if (i == pGraphState->m_DashCount - 1) + if (i == pGraphState->m_DashArray.size() - 1) off_phase = on_phase; else off_phase = pGraphState->m_DashArray[i + 1]; -- cgit v1.2.3