Skip to content

Commit

Permalink
Fix stroke-miterlimit parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
sammycage committed Oct 28, 2024
1 parent 2246b6a commit e8e5747
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions source/svglayoutstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,15 @@ static float parseNumberOrPercentage(std::string_view input, bool allowPercentag
float value;
if(!parseNumber(input, value))
return defaultValue;
if(allowPercentage && skipDelimiter(input, '%'))
value /= 100.f;
return !input.empty() ? defaultValue : std::clamp(value, 0.f, 1.f);
if(allowPercentage) {
if(skipDelimiter(input, '%'))
value /= 100.f;
value = std::clamp(value, 0.f, 1.f);
}

if(!input.empty())
return defaultValue;
return value;
}

static Length parseLength(const std::string_view& input, LengthNegativeMode mode, const Length& defaultValue)
Expand Down

0 comments on commit e8e5747

Please sign in to comment.