From 750ad90bf01175a6390c0e065827ffa0c22df8f2 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Thu, 24 Jun 2021 20:41:02 +0900 Subject: [PATCH] sw_engine stroke: set stroke invalid if points are zero. This valid tag is used for further progress. we don't need it actually since we can count by points number. --- src/lib/sw_engine/tvgSwCommon.h | 1 - src/lib/sw_engine/tvgSwStroke.cpp | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/lib/sw_engine/tvgSwCommon.h b/src/lib/sw_engine/tvgSwCommon.h index be91cfab..b2975429 100644 --- a/src/lib/sw_engine/tvgSwCommon.h +++ b/src/lib/sw_engine/tvgSwCommon.h @@ -171,7 +171,6 @@ struct SwStrokeBorder uint8_t* tags; int32_t start; //index of current sub-path start point bool movable; //true: for ends of lineto borders - bool valid; }; struct SwStroke diff --git a/src/lib/sw_engine/tvgSwStroke.cpp b/src/lib/sw_engine/tvgSwStroke.cpp index 046c17d5..6b375529 100644 --- a/src/lib/sw_engine/tvgSwStroke.cpp +++ b/src/lib/sw_engine/tvgSwStroke.cpp @@ -742,7 +742,6 @@ static void _getCounts(SwStrokeBorder* border, uint32_t& ptsCnt, uint32_t& cntrs bool inCntr = false; while (count > 0) { - if (tags[0] & SW_STROKE_TAG_BEGIN) { if (inCntr) goto fail; inCntr = true; @@ -758,7 +757,7 @@ static void _getCounts(SwStrokeBorder* border, uint32_t& ptsCnt, uint32_t& cntrs } if (inCntr) goto fail; - border->valid = true; + ptsCnt = _ptsCnt; cntrsCnt = _cntrsCnt; @@ -774,7 +773,7 @@ static void _exportBorderOutline(const SwStroke& stroke, SwOutline* outline, uin { auto border = stroke.borders + side; - if (!border->valid) return; + if (border->ptsCnt == 0) return; //invalid border memcpy(outline->pts + outline->ptsCnt, border->pts, border->ptsCnt * sizeof(SwPoint)); @@ -844,11 +843,8 @@ void strokeReset(SwStroke* stroke, const Shape* sdata, const Matrix* transform) stroke->borders[0].ptsCnt = 0; stroke->borders[0].start = -1; - stroke->borders[0].valid = false; - stroke->borders[1].ptsCnt = 0; stroke->borders[1].start = -1; - stroke->borders[1].valid = false; }