From 7037a6980b28ecd2dc491ff2d7c5a151eaea2c4d Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 1 Dec 2015 21:45:55 +0100 Subject: [PATCH] [DEV] transfert Cross product to etk lib and add missing miterlimit in style --- esvg/Base.cpp | 3 +++ esvg/render/SegmentList.cpp | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/esvg/Base.cpp b/esvg/Base.cpp index d17bbc3..ca89c36 100644 --- a/esvg/Base.cpp +++ b/esvg/Base.cpp @@ -383,6 +383,9 @@ void esvg::Base::parsePaintAttr(const std::shared_ptr& _ele m_paint.lineJoin = esvg::join_miter; SVG_ERROR("not know " << outputType << " value : \"" << outputValue << "\", not in [miter,round,bevel]"); } + } else if (outputType == "stroke-miterlimit") { + float tmp = parseLength(outputValue); + m_paint.miterLimit = std::max(0.0f, tmp); } else if (outputType == "marker-start") { // TODO : ... } else { diff --git a/esvg/render/SegmentList.cpp b/esvg/render/SegmentList.cpp index 5cedc04..357d5e5 100644 --- a/esvg/render/SegmentList.cpp +++ b/esvg/render/SegmentList.cpp @@ -275,8 +275,7 @@ void esvg::render::SegmentList::createSegmentListStroke(esvg::render::PointList& { vec2 axePrevious = (it.m_pos-it.m_posPrevious).safeNormalize(); vec2 axeNext = (it.m_posNext - it.m_pos).safeNormalize(); - // TODO : Add cross at the vector2 ... - float cross = axePrevious.x() * axeNext.y() - axeNext.x() * axePrevious.y(); + float cross = axePrevious.cross(axeNext); if (cross > 0.0f) { vec2 right = getIntersect(rightPoint, it.m_pos-it.m_posPrevious, it.m_pos, it.m_miterAxe); vec2 left1 = it.m_pos