mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-13 19:44:28 +00:00
sw_engine: code refactoring.
use macro for single maintenance.
This commit is contained in:
parent
5a21b3bd68
commit
b1a91acd6a
3 changed files with 7 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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...
|
||||
|
|
Loading…
Add table
Reference in a new issue