summaryrefslogtreecommitdiff
path: root/core/fxge/win32/fx_win32_gdipext.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-09-24 17:55:00 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-24 17:55:00 +0000
commitfed6e124109f089a38e24e37b104d983231bee78 (patch)
tree6c1aa45a97eb27c67611dbe7480bdbcd26710d14 /core/fxge/win32/fx_win32_gdipext.cpp
parent97f4483de007c2ff248696f24d34634e0adbf894 (diff)
downloadpdfium-fed6e124109f089a38e24e37b104d983231bee78.tar.xz
Give CFX_GraphStateData a work-over.chromium/3561
Use std::vector<float> 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 <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxge/win32/fx_win32_gdipext.cpp')
-rw-r--r--core/fxge/win32/fx_win32_gdipext.cpp10
1 files changed, 5 insertions, 5 deletions
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];