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_device.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'core/fxge/win32/fx_win32_device.cpp') diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index c8f049704f..526eea58f3 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -103,7 +103,7 @@ HPEN CreateExtPen(const CFX_GraphStateData* pGraphState, float width = std::max(scale * pGraphState->m_LineWidth, 1.0f); uint32_t PenStyle = PS_GEOMETRIC; - if (pGraphState->m_DashCount) + if (!pGraphState->m_DashArray.empty()) PenStyle |= PS_USERSTYLE; else PenStyle |= PS_SOLID; @@ -137,9 +137,9 @@ HPEN CreateExtPen(const CFX_GraphStateData* pGraphState, lb.lbStyle = BS_SOLID; lb.lbHatch = 0; std::vector dashes; - if (pGraphState->m_DashCount) { - dashes.resize(pGraphState->m_DashCount); - for (int i = 0; i < pGraphState->m_DashCount; i++) { + if (!pGraphState->m_DashArray.empty()) { + dashes.resize(pGraphState->m_DashArray.size()); + for (size_t i = 0; i < pGraphState->m_DashArray.size(); i++) { dashes[i] = FXSYS_round( pMatrix ? pMatrix->TransformDistance(pGraphState->m_DashArray[i]) : pGraphState->m_DashArray[i]); @@ -147,7 +147,7 @@ HPEN CreateExtPen(const CFX_GraphStateData* pGraphState, } } return ExtCreatePen(PenStyle, (DWORD)ceil(width), &lb, - pGraphState->m_DashCount, + pGraphState->m_DashArray.size(), reinterpret_cast(dashes.data())); } @@ -994,7 +994,7 @@ bool CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, if (pPlatform->m_GdiplusExt.IsAvailable()) { if (bDrawAlpha || ((m_DeviceClass != FXDC_PRINTER && !(fill_mode & FXFILL_FULLCOVER)) || - (pGraphState && pGraphState->m_DashCount))) { + (pGraphState && !pGraphState->m_DashArray.empty()))) { if (!((!pMatrix || !pMatrix->WillScale()) && pGraphState && pGraphState->m_LineWidth == 1.0f && (pPathData->GetPoints().size() == 5 || @@ -1023,7 +1023,7 @@ bool CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, hBrush = (HBRUSH)SelectObject(m_hDC, hBrush); } if (pPathData->GetPoints().size() == 2 && pGraphState && - pGraphState->m_DashCount) { + !pGraphState->m_DashArray.empty()) { CFX_PointF pos1 = pPathData->GetPoint(0); CFX_PointF pos2 = pPathData->GetPoint(1); if (pMatrix) { -- cgit v1.2.3