void CanvasRenderingContext2DState::updateLineDash() const { if (!m_lineDashDirty) return; if (!hasANonZeroElement(m_lineDash)) { m_strokePaint.setPathEffect(0); } else { RefPtr<SkPathEffect> dashPathEffect = adoptRef(SkDashPathEffect::Create(m_lineDash.data(), m_lineDash.size(), m_lineDashOffset)); m_strokePaint.setPathEffect(dashPathEffect.get()); } m_lineDashDirty = false; }
void CanvasRenderingContext2DState::updateLineDash() const { if (!m_lineDashDirty) return; if (!hasANonZeroElement(m_lineDash)) { m_strokePaint.setPathEffect(0); } else { Vector<float> lineDash(m_lineDash.size()); std::copy(m_lineDash.begin(), m_lineDash.end(), lineDash.begin()); m_strokePaint.setPathEffect(SkDashPathEffect::Make(lineDash.data(), lineDash.size(), m_lineDashOffset)); } m_lineDashDirty = false; }