From: Hermet Park Date: Thu, 10 Sep 2020 06:28:44 +0000 (+0900) Subject: sw_engine: code refactoring. X-Git-Tag: accepted/tizen/unified/20200914.131341~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=08b3dbfbd6de3b7868ddc1781c1adf2a73334a30;p=platform%2Fcore%2Fgraphics%2Ftizenvg.git sw_engine: code refactoring. use macro for single maintenance. Change-Id: I8a76b5f13abc371cd1f9fa3c9d797becc294f0b2 --- diff --git a/src/lib/sw_engine/tvgSwCommon.h b/src/lib/sw_engine/tvgSwCommon.h index 256c4bb..37a40c5 100644 --- a/src/lib/sw_engine/tvgSwCommon.h +++ b/src/lib/sw_engine/tvgSwCommon.h @@ -247,6 +247,11 @@ static inline uint8_t ALPHA_MULTIPLY(uint32_t c, uint32_t a) return (c * a) >> 8; } +static inline SwCoord HALF_STROKE(float width) +{ + return TO_SWCOORD(width * 0.5); +} + int64_t mathMultiply(int64_t a, int64_t b); int64_t mathDivide(int64_t a, int64_t b); int64_t mathMulDiv(int64_t a, int64_t b, int64_t c); diff --git a/src/lib/sw_engine/tvgSwRenderer.cpp b/src/lib/sw_engine/tvgSwRenderer.cpp index 7a69038..ff1055f 100644 --- a/src/lib/sw_engine/tvgSwRenderer.cpp +++ b/src/lib/sw_engine/tvgSwRenderer.cpp @@ -41,7 +41,7 @@ struct SwTask : Task //Valid Stroking? uint8_t strokeAlpha = 0; auto strokeWidth = sdata->strokeWidth(); - if (TO_SWCOORD(strokeWidth * 0.5) > 0) { + if (HALF_STROKE(strokeWidth) > 0) { sdata->strokeColor(nullptr, nullptr, nullptr, &strokeAlpha); } diff --git a/src/lib/sw_engine/tvgSwStroke.cpp b/src/lib/sw_engine/tvgSwStroke.cpp index 08754f8..e87ec4c 100644 --- a/src/lib/sw_engine/tvgSwStroke.cpp +++ b/src/lib/sw_engine/tvgSwStroke.cpp @@ -831,7 +831,7 @@ void strokeReset(SwStroke* stroke, const Shape* sdata, const Matrix* transform) stroke->sx = stroke->sy = 1.0f; } - stroke->width = TO_SWCOORD(sdata->strokeWidth() * 0.5); + stroke->width = HALF_STROKE(sdata->strokeWidth()); stroke->cap = sdata->strokeCap(); //Save line join: it can be temporarily changed when stroking curves...