Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Fix remainder non-color-managed lines in the assistants.

Wolthera van Hövell tot Westerflier6cfee81a099d
diff --git a/libs/ui/kis_painting_assistant.cc b/libs/ui/kis_painting_assistant.cc
index 7735f80d6d..111837fc35 100644
--- a/libs/ui/kis_painting_assistant.cc
+++ b/libs/ui/kis_painting_assistant.cc
@@ -371,7 +371,7 @@ void KisPaintingAssistant::setEditorWidgetOffset(QPointF offset)
}
-void KisPaintingAssistant::drawPath(QPainter& painter, const QPainterPath &path, const KoColorDisplayRendererInterface *displayRenderInterface, bool isSnappingOn)
+void KisPaintingAssistant::drawPath(QPainter& painter, const QPainterPath &path, const KoColorDisplayRendererInterface *displayRenderInterface, bool isSnappingOn, QPen startingPen)
{
QColor paintingColor = displayRenderInterface->convertColorToDisplayColorSpace(KoColor(effectiveAssistantColor(), KoColorSpaceRegistry::instance()->rgb8()));;
@@ -381,7 +381,9 @@ void KisPaintingAssistant::drawPath(QPainter& painter, const QPainterPath &path,
}
painter.save();
- QPen pen_a(paintingColor, d->mainLineWidth * d->decorationThickness);
+ QPen pen_a = startingPen;
+ pen_a.setColor(paintingColor);
+ pen_a.setWidth(d->mainLineWidth * d->decorationThickness);
pen_a.setCosmetic(true);
painter.setPen(pen_a);
painter.drawPath(path);
diff --git a/libs/ui/kis_painting_assistant.h b/libs/ui/kis_painting_assistant.h
index 573ef0ad5c..33b4003df3 100644
--- a/libs/ui/kis_painting_assistant.h
+++ b/libs/ui/kis_painting_assistant.h
@@ -16,6 +16,7 @@
#include <QColor>
#include <QXmlStreamWriter>
#include <QMap>
+#include <QPen>
#include <kritaui_export.h>
#include <kis_shared.h>
@@ -240,7 +241,7 @@ public:
/**
* This will render the final output. The drawCache does rendering most of the time so be sure to check that
*/
- void drawPath(QPainter& painter, const QPainterPath& path, const KoColorDisplayRendererInterface *displayRenderInterface, bool drawActive=true);
+ void drawPath(QPainter& painter, const QPainterPath& path, const KoColorDisplayRendererInterface *displayRenderInterface, bool drawActive=true, QPen startingPen = QPen());
void drawPreview(QPainter& painter, const QPainterPath& path, const KoColorDisplayRendererInterface *displayRenderInterface);
// draw a path in a red color, signalizing incorrect state
void drawError(QPainter& painter, const QPainterPath& path, const KoColorDisplayRendererInterface *displayRenderInterface);
diff --git a/plugins/assistants/Assistants/PerspectiveEllipseAssistant.cc b/plugins/assistants/Assistants/PerspectiveEllipseAssistant.cc
index 3fcb87972f..6de5505017 100644
--- a/plugins/assistants/Assistants/PerspectiveEllipseAssistant.cc
+++ b/plugins/assistants/Assistants/PerspectiveEllipseAssistant.cc
@@ -426,18 +426,9 @@ void PerspectiveEllipseAssistant::drawAssistant(QPainter& gc, const QRectF& upda
gc.save();
- QPen p(gc.pen());
- p.setCosmetic(true);
- p.setStyle(Qt::DotLine);
- QColor color = effectiveAssistantColor();
- if (!isSnappingActive()) {
- color.setAlpha(color.alpha()*0.2);
- }
- p.setWidthF(1.5);
- p.setColor(color);
- gc.setPen(p);
-
- gc.drawPath(axes);
+ QPen dotted(Qt::DotLine);
+ // needs dotline
+ drawPath(gc, axes, displayRenderInterface, isSnappingActive(), dotted);
gc.restore();
}
diff --git a/plugins/assistants/Assistants/VanishingPointAssistant.cc b/plugins/assistants/Assistants/VanishingPointAssistant.cc
index cfaaa05756..5cf5b0842c 100644
--- a/plugins/assistants/Assistants/VanishingPointAssistant.cc
+++ b/plugins/assistants/Assistants/VanishingPointAssistant.cc
@@ -149,21 +149,18 @@ void VanishingPointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRe
// draw the lines connecting the different nodes
- QPen penStyle(paintingColor, 2.0, Qt::SolidLine);
-
- if (!isSnappingActive()) {
- QColor snappingColor = paintingColor;
- snappingColor.setAlpha(snappingColor.alpha() * 0.2);
-
- penStyle.setColor(snappingColor);
- }
gc.save();
- gc.setPen(penStyle);
- gc.drawLine(p0, p1);
- gc.drawLine(p0, p3);
- gc.drawLine(p1, p2);
- gc.drawLine(p3, p4);
+ QPainterPath lines;
+ lines.moveTo(p0);
+ lines.lineTo(p1);
+ lines.moveTo(p0);
+ lines.lineTo(p3);
+ lines.moveTo(p1);
+ lines.lineTo(p2);
+ lines.moveTo(p3);
+ lines.lineTo(p4);
+ drawPath(gc, lines, displayRenderInterface, isSnappingActive());
gc.restore();
}