mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
gl/wg_engine: fix differences in dashing among engines
The differences resulted from discrepancies between the engines in applying equality or inequality signs and in using different precision levels when determining the dash remainder when transitioning to a new path command. @Issue: https://github.com/thorvg/thorvg/issues/3265
This commit is contained in:
parent
64ed756c2c
commit
7275b77c22
2 changed files with 3 additions and 3 deletions
|
@ -2056,7 +2056,7 @@ void DashStroke::dashLineTo(const Point& to)
|
||||||
this->lineTo(curr.pt2);
|
this->lineTo(curr.pt2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCurrLen < 1) {
|
if (mCurrLen < 0.1f) {
|
||||||
mCurrIdx = (mCurrIdx + 1) % mDashCount;
|
mCurrIdx = (mCurrIdx + 1) % mDashCount;
|
||||||
mCurrLen = mDashPattern[mCurrIdx];
|
mCurrLen = mDashPattern[mCurrIdx];
|
||||||
mCurOpGap = !mCurOpGap;
|
mCurOpGap = !mCurOpGap;
|
||||||
|
@ -2108,7 +2108,7 @@ void DashStroke::dashCubicTo(const Point& cnt1, const Point& cnt2, const Point&
|
||||||
this->cubicTo(cur.ctrl1, cur.ctrl2, cur.end);
|
this->cubicTo(cur.ctrl1, cur.ctrl2, cur.end);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCurrLen < 1) {
|
if (mCurrLen < 0.1f) {
|
||||||
mCurrIdx = (mCurrIdx + 1) % mDashCount;
|
mCurrIdx = (mCurrIdx + 1) % mDashCount;
|
||||||
mCurrLen = mDashPattern[mCurrIdx];
|
mCurrLen = mDashPattern[mCurrIdx];
|
||||||
mCurOpGap = !mCurOpGap;
|
mCurOpGap = !mCurOpGap;
|
||||||
|
|
|
@ -377,7 +377,7 @@ struct WgIndexedVertexBuffer
|
||||||
while(dashOffset > dashes_lenth) dashOffset -= dashes_lenth;
|
while(dashOffset > dashes_lenth) dashOffset -= dashes_lenth;
|
||||||
auto gap = false;
|
auto gap = false;
|
||||||
// scip dashes by offset
|
// scip dashes by offset
|
||||||
while(len_total < dashOffset) {
|
while(len_total <= dashOffset) {
|
||||||
index_dash = (index_dash + 1) % dashCnt;
|
index_dash = (index_dash + 1) % dashCnt;
|
||||||
len_total += dashPattern[index_dash];
|
len_total += dashPattern[index_dash];
|
||||||
gap = !gap;
|
gap = !gap;
|
||||||
|
|
Loading…
Add table
Reference in a new issue