Fix some nits in dash drawing code. Just write "0.1f" instead of "1.0f / 10". Also fix various nits in surrounding code. Change-Id: Ie51ee8527fd2484c0097a80e6c727864f16e45c4 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/70736 Reviewed-by: Daniel Hosseinian <dhoss@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index c92c6be..09474b4 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -292,7 +292,7 @@ for (size_t i = 0; i < (pGraphState->m_DashArray.size() + 1) / 2; i++) { float on = pGraphState->m_DashArray[i * 2]; if (on <= 0.000001f) - on = 1.0f / 10; + on = 0.1f; float off = i * 2 + 1 == pGraphState->m_DashArray.size() ? on : pGraphState->m_DashArray[i * 2 + 1];
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index 9187f53..6f9f471 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp
@@ -1588,12 +1588,11 @@ for (size_t i = 0; i < count; i++) { float on = pGraphState->m_DashArray[i * 2]; if (on <= 0.000001f) - on = 1.f / 10; + on = 0.1f; float off = i * 2 + 1 == pGraphState->m_DashArray.size() ? on : pGraphState->m_DashArray[i * 2 + 1]; - if (off < 0) - off = 0; + off = std::max(off, 0.0f); intervals.get()[i * 2] = on; intervals.get()[i * 2 + 1] = off; }
diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp index 20cf77f..958c64c 100644 --- a/core/fxge/win32/fx_win32_gdipext.cpp +++ b/core/fxge/win32/fx_win32_gdipext.cpp
@@ -446,15 +446,15 @@ on_phase /= width; off_phase /= width; if (on_phase + off_phase <= 0.00002f) { - on_phase = 1.0f / 10; - off_phase = 1.0f / 10; + on_phase = 0.1f; + off_phase = 0.1f; } if (bDashExtend) { if (off_phase < 1) off_phase = 0; else - off_phase -= 1; - on_phase += 1; + --off_phase; + ++on_phase; } if (on_phase == 0 || off_phase == 0) { if (nCount == 0) {