Skip to content

Commit

Permalink
SVG import default values fix for stroke and fill.
Browse files Browse the repository at this point in the history
  • Loading branch information
vestineo authored and rodlie committed Jun 30, 2024
1 parent a37a3db commit 147fc91
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/core/svgimporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class FillSvgAttributes {
protected:
qreal mOpacity = 1;
QColor mColor;
PaintType mPaintType = NOPAINT;
PaintType mPaintType = FLATPAINT;
Gradient *mGradient = nullptr;
GradientType mGradientType = GradientType::LINEAR;
QPointF mGradientP1;
Expand All @@ -119,7 +119,9 @@ class FillSvgAttributes {

class StrokeSvgAttributes : public FillSvgAttributes {
public:
StrokeSvgAttributes() {}
StrokeSvgAttributes() {
mPaintType = NOPAINT;
}

qreal getLineWidth() const;
SkPaint::Cap getCapStyle() const;
Expand All @@ -135,11 +137,11 @@ class StrokeSvgAttributes : public FillSvgAttributes {

void apply(BoundingBox *box, const qreal scale) const;
protected:
SkPaint::Cap mCapStyle = SkPaint::kRound_Cap;
SkPaint::Join mJoinStyle = SkPaint::kRound_Join;
SkPaint::Cap mCapStyle = SkPaint::kButt_Cap;
SkPaint::Join mJoinStyle = SkPaint::kMiter_Join;
QPainter::CompositionMode mOutlineCompositionMode =
QPainter::CompositionMode_Source;
qreal mLineWidth = 0;
qreal mLineWidth = 1;
};

class BoxSvgAttributes {
Expand Down Expand Up @@ -1256,6 +1258,8 @@ void StrokeSvgAttributes::setOutlineCompositionMode(const QPainter::CompositionM

void StrokeSvgAttributes::apply(BoundingBox *box, const qreal scale) const {
box->strokeWidthAction(QrealAction::sMakeSet(mLineWidth*scale));
box->setStrokeJoinStyle(mJoinStyle);
box->setStrokeCapStyle(mCapStyle);
FillSvgAttributes::apply(box, PaintSetting::OUTLINE);
//box->setStrokePaintType(mPaintType, mColor, mGradient);
}
Expand Down

0 comments on commit 147fc91

Please sign in to comment.