SkSVGPresentationAttributes SkSVGPresentationAttributes::MakeInitial() { SkSVGPresentationAttributes result; result.fFill.set(SkSVGPaint(SkSVGColorType(SK_ColorBLACK))); result.fFillOpacity.set(SkSVGNumberType(1)); result.fStroke.set(SkSVGPaint(SkSVGPaint::Type::kNone)); result.fStrokeLineCap.set(SkSVGLineCap(SkSVGLineCap::Type::kButt)); result.fStrokeLineJoin.set(SkSVGLineJoin(SkSVGLineJoin::Type::kMiter)); result.fStrokeOpacity.set(SkSVGNumberType(1)); result.fStrokeWidth.set(SkSVGLength(1)); return result; }
// https://www.w3.org/TR/SVG/painting.html#StrokeLinejoinProperty bool SkSVGAttributeParser::parseLineJoin(SkSVGLineJoin* join) { static const struct { SkSVGLineJoin::Type fType; const char* fName; } gJoinInfo[] = { { SkSVGLineJoin::Type::kMiter , "miter" }, { SkSVGLineJoin::Type::kRound , "round" }, { SkSVGLineJoin::Type::kBevel , "bevel" }, { SkSVGLineJoin::Type::kInherit, "inherit" }, }; bool parsedValue = false; for (size_t i = 0; i < SK_ARRAY_COUNT(gJoinInfo); ++i) { if (this->parseExpectedStringToken(gJoinInfo[i].fName)) { *join = SkSVGLineJoin(gJoinInfo[i].fType); parsedValue = true; break; } } return parsedValue && this->parseEOSToken(); }