Use std::vector in CFX_SkiaDeviceDriver::PaintStroke().
No need to manually allocate memory.
Change-Id: I80f6c3c036c5623dfb5a28b1d582a0c417e8ce7e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/70738
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 6f9f471..e177645 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -1582,8 +1582,7 @@
std::min(deviceUnits[0].length(), deviceUnits[1].length()));
if (!pGraphState->m_DashArray.empty()) {
size_t count = (pGraphState->m_DashArray.size() + 1) / 2;
- std::unique_ptr<SkScalar, FxFreeDeleter> intervals(
- FX_Alloc2D(SkScalar, count, sizeof(SkScalar)));
+ std::vector<SkScalar> intervals(count);
// Set dash pattern
for (size_t i = 0; i < count; i++) {
float on = pGraphState->m_DashArray[i * 2];
@@ -1593,10 +1592,10 @@
? on
: pGraphState->m_DashArray[i * 2 + 1];
off = std::max(off, 0.0f);
- intervals.get()[i * 2] = on;
- intervals.get()[i * 2 + 1] = off;
+ intervals[i * 2] = on;
+ intervals[i * 2 + 1] = off;
}
- spaint->setPathEffect(SkDashPathEffect::Make(intervals.get(), count * 2,
+ spaint->setPathEffect(SkDashPathEffect::Make(intervals.data(), count * 2,
pGraphState->m_DashPhase));
}
spaint->setStyle(SkPaint::kStroke_Style);