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++
Make the assistants work with HDR canvases.
Wolthera van Hövell tot Westerflierf291e92cb2c0
diff --git a/libs/ui/kis_painting_assistant.cc b/libs/ui/kis_painting_assistant.ccindex 6460dc5179..c5a63d13e7 100644--- a/libs/ui/kis_painting_assistant.cc+++ b/libs/ui/kis_painting_assistant.cc@@ -16,6 +16,7 @@#include "kis_config.h"#include <KoStore.h>+#include <KoColorDisplayRendererInterface.h>#include <QGlobalStatic>#include <QPen>@@ -359,10 +360,10 @@ void KisPaintingAssistant::setEditorWidgetOffset(QPointF offset)}-void KisPaintingAssistant::drawPath(QPainter& painter, const QPainterPath &path, bool isSnappingOn)+void KisPaintingAssistant::drawPath(QPainter& painter, const QPainterPath &path, const KoColorDisplayRendererInterface *displayRenderInterface, bool isSnappingOn){- QColor paintingColor = effectiveAssistantColor();+ QColor paintingColor = displayRenderInterface->convertColorToDisplayColorSpace(KoColor(effectiveAssistantColor(), KoColorSpaceRegistry::instance()->rgb8()));;if (!isSnappingOn) {paintingColor.setAlpha(0.2 * paintingColor.alpha());@@ -376,10 +377,10 @@ void KisPaintingAssistant::drawPath(QPainter& painter, const QPainterPath &path,painter.restore();}-void KisPaintingAssistant::drawPreview(QPainter& painter, const QPainterPath &path)+void KisPaintingAssistant::drawPreview(QPainter& painter, const QPainterPath &path, const KoColorDisplayRendererInterface *displayRenderInterface){painter.save();- QPen pen_a(effectiveAssistantColor(), d->previewLineWidth);+ QPen pen_a(displayRenderInterface->convertColorToDisplayColorSpace(KoColor(effectiveAssistantColor(), KoColorSpaceRegistry::instance()->rgb8())), d->previewLineWidth);pen_a.setStyle(Qt::SolidLine);pen_a.setCosmetic(true);painter.setPen(pen_a);@@ -387,22 +388,23 @@ void KisPaintingAssistant::drawPreview(QPainter& painter, const QPainterPath &papainter.restore();}-void KisPaintingAssistant::drawError(QPainter &painter, const QPainterPath &path)+void KisPaintingAssistant::drawError(QPainter &painter, const QPainterPath &path, const KoColorDisplayRendererInterface *displayRenderInterface){painter.save();- QPen pen_a(QColor(255, 0, 0, 125), d->errorLineWidth * d->decorationThickness);+ const QColor error = displayRenderInterface->convertColorToDisplayColorSpace(KoColor(QColor(255, 0, 0, 125), KoColorSpaceRegistry::instance()->rgb8()));+ QPen pen_a(error, d->errorLineWidth * d->decorationThickness);pen_a.setCosmetic(true);painter.setPen(pen_a);painter.drawPath(path);painter.restore();}-void KisPaintingAssistant::drawX(QPainter &painter, const QPointF &pt)+void KisPaintingAssistant::drawX(QPainter &painter, const QPointF &pt, const KoColorDisplayRendererInterface *displayRenderInterface){QPainterPath path;path.moveTo(QPointF(pt.x() - 5.0, pt.y() - 5.0)); path.lineTo(QPointF(pt.x() + 5.0, pt.y() + 5.0));path.moveTo(QPointF(pt.x() - 5.0, pt.y() + 5.0)); path.lineTo(QPointF(pt.x() + 5.0, pt.y() - 5.0));- drawPath(painter, path);+ drawPath(painter, path, displayRenderInterface);}void KisPaintingAssistant::initHandles(QList<KisPaintingAssistantHandleSP> _handles)@@ -476,7 +478,7 @@ QPointF KisPaintingAssistant::viewportConstrainedEditorPosition(const KisCoordinreturn converter->widgetToDocument(editorWidgetPos);}-void KisPaintingAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool useCache, KisCanvas2* canvas, bool assistantVisible, bool previewVisible)+void KisPaintingAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool useCache, KisCanvas2* canvas, bool assistantVisible, bool previewVisible){Q_UNUSED(updateRect);@@ -486,7 +488,7 @@ void KisPaintingAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect,if (!useCache) {gc.save();- drawCache(gc, converter, assistantVisible);+ drawCache(gc, converter, displayRenderInterface, assistantVisible);gc.restore();return;}@@ -520,7 +522,7 @@ void KisPaintingAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect,QPainter painter(&cached);painter.setRenderHint(QPainter::Antialiasing);painter.setWindow(cacheRect);- drawCache(painter, converter, assistantVisible);+ drawCache(painter, converter, displayRenderInterface, assistantVisible);painter.end();d->s->cachedTransform = transform;d->s->cachedRect = cacheRect.translated(-widgetBound.topLeft());diff --git a/libs/ui/kis_painting_assistant.h b/libs/ui/kis_painting_assistant.hindex c4be7b637c..864a985965 100644--- a/libs/ui/kis_painting_assistant.h+++ b/libs/ui/kis_painting_assistant.h@@ -29,6 +29,7 @@ class KisCoordinatesConverter;class KisCanvas2;class QDomDocument;class QDomElement;+class KoColorDisplayRendererInterface;#include <kis_shared_ptr.h>#include <KoGenericRegistry.h>@@ -175,7 +176,7 @@ public:QColor assistantCustomColor();void setAssistantGlobalColorCache(const QColor &color);- virtual void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter *converter, bool cached, KisCanvas2 *canvas=0, bool assistantVisible=true, bool previewVisible=true);+ virtual void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2 *canvas=0, bool assistantVisible=true, bool previewVisible=true);void uncache();const QList<KisPaintingAssistantHandleSP>& handles() const;QList<KisPaintingAssistantHandleSP> handles();@@ -237,12 +238,12 @@ 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, bool drawActive=true);- void drawPreview(QPainter& painter, const QPainterPath& path);+ void drawPath(QPainter& painter, const QPainterPath& path, const KoColorDisplayRendererInterface *displayRenderInterface, bool drawActive=true);+ 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);+ void drawError(QPainter& painter, const QPainterPath& path, const KoColorDisplayRendererInterface *displayRenderInterface);// draw a vanishing point marker- void drawX(QPainter& painter, const QPointF& pt);+ void drawX(QPainter& painter, const QPointF& pt, const KoColorDisplayRendererInterface *displayRenderInterface);static double norm2(const QPointF& p);void setDecorationThickness(int thickness);@@ -253,7 +254,7 @@ protected:virtual QRect boundingRect() const;/// performance layer where the graphics can be drawn from a cache instead of generated every render update- virtual void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) = 0;+ virtual void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible=true) = 0;void initHandles(QList<KisPaintingAssistantHandleSP> _handles);QList<KisPaintingAssistantHandleSP> m_handles;diff --git a/libs/ui/kis_painting_assistants_decoration.cpp b/libs/ui/kis_painting_assistants_decoration.cppindex 2c08c8f8f6..4c61f6226f 100644--- a/libs/ui/kis_painting_assistants_decoration.cpp+++ b/libs/ui/kis_painting_assistants_decoration.cpp@@ -24,6 +24,7 @@#include "KisViewManager.h"#include <KoCompositeOpRegistry.h>#include "kis_tool_proxy.h"+#include <KoColorDisplayRendererInterface.h>#include <QPainter>#include <QPainterPath>@@ -325,26 +326,28 @@ void KisPaintingAssistantsDecoration::drawDecoration(QPainter& gc, const QRectF&kritaProxy->supportsPaintingAssistants();Q_FOREACH (KisPaintingAssistantSP assistant, assistants()) {- assistant->drawAssistant(gc, updateRect, converter, d->useCache, canvas, assistantVisibility(), outlineVisible);+ assistant->drawAssistant(gc, updateRect, converter, canvas->displayRendererInterface(), d->useCache, canvas, assistantVisibility(), outlineVisible);if (isEditingAssistants()) {- drawHandles(assistant, gc, converter);+ drawHandles(assistant, gc, converter, canvas->displayRendererInterface());}}// draw editor controls on top of all assistant lines (why this code is last)if (isEditingAssistants()) {Q_FOREACH (KisPaintingAssistantSP assistant, assistants()) {- drawEditorWidget(assistant, gc, converter);+ drawEditorWidget(assistant, gc, converter, canvas->displayRendererInterface());}}}-void KisPaintingAssistantsDecoration::drawHandles(KisPaintingAssistantSP assistant, QPainter& gc, const KisCoordinatesConverter *converter)+void KisPaintingAssistantsDecoration::drawHandles(KisPaintingAssistantSP assistant, QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *renderInterface){QTransform initialTransform = converter->documentToWidgetTransform();- QColor colorToPaint = assistant->effectiveAssistantColor();+ KoColor c;+ c.fromQColor(assistant->effectiveAssistantColor());+ QColor colorToPaint = renderInterface->convertColorToDisplayColorSpace(c);Q_FOREACH (const KisPaintingAssistantHandleSP handle, assistant->handles()) {@@ -556,7 +559,7 @@ QPointF KisPaintingAssistantsDecoration::snapToGuide(const QPointF& pt, const QP* we potentially could make some of these inline to speed up performance*/-void KisPaintingAssistantsDecoration::drawEditorWidget(KisPaintingAssistantSP assistant, QPainter& gc, const KisCoordinatesConverter *converter)+void KisPaintingAssistantsDecoration::drawEditorWidget(KisPaintingAssistantSP assistant, QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *renderInterface){if (!assistant->isAssistantComplete() || !globalEditorWidgetData.widgetActivated) {return;@@ -566,9 +569,12 @@ void KisPaintingAssistantsDecoration::drawEditorWidget(KisPaintingAssistantSP asQPointF actionsPosition = initialTransform.map(assistant->viewportConstrainedEditorPosition(converter, globalEditorWidgetData.boundingSize));//draw editor widget background- QBrush backgroundColor = d->m_canvas->viewManager()->mainWindowAsQWidget()->palette().window();+ QPalette sysPalette = renderInterface->systemPaletteForDisplayColorSpace();++ QBrush backgroundColor = sysPalette.window();QPointF actionsBGRectangle(actionsPosition + QPointF(globalEditorWidgetData.widgetOffset,globalEditorWidgetData.widgetOffset));- QPen stroke(QColor(60, 60, 60, 80), 2);+ QPen stroke(sysPalette.window(), 2);+gc.setRenderHint(QPainter::Antialiasing);@@ -582,7 +588,7 @@ void KisPaintingAssistantsDecoration::drawEditorWidget(KisPaintingAssistantSP asif (selectedAssistant()) { // there might not be a selected assistant, so do not seg faultif (assistant->getEditorPosition() == selectedAssistant()->getEditorPosition()) {stroke.setWidth(6);- stroke.setColor(qApp->palette().color(QPalette::Highlight));+ stroke.setColor(sysPalette.color(QPalette::Highlight));}}@@ -593,7 +599,9 @@ void KisPaintingAssistantsDecoration::drawEditorWidget(KisPaintingAssistantSP as//draw drag handle- QColor dragDecorationColor(150,150,150,255);+ KoColor c;+ c.fromQColor(QColor(150,150,150,255));+ QColor dragDecorationColor = renderInterface->convertColorToDisplayColorSpace(c);QPainterPath dragRect;int width = actionsPosition.x()+globalEditorWidgetData.boundingSize.width()-globalEditorWidgetData.dragDecorationWidth+globalEditorWidgetData.widgetOffset;@@ -603,7 +611,8 @@ void KisPaintingAssistantsDecoration::drawEditorWidget(KisPaintingAssistantSP as//draw dot decoration on handleQPainterPath dragRectDots;- QColor dragDecorationDotsColor(50,50,50,255);+ c.fromQColor(QColor(50,50,50,255));+ QColor dragDecorationDotsColor = renderInterface->convertColorToDisplayColorSpace(c);int dotSize = 2;dragRectDots.addEllipse(3,2.5,dotSize,dotSize);dragRectDots.addEllipse(3,7.5,dotSize,dotSize);@@ -620,24 +629,24 @@ void KisPaintingAssistantsDecoration::drawEditorWidget(KisPaintingAssistantSP as//loop over all visible buttons and render themif (globalEditorWidgetData.moveButtonActivated) {QPointF iconMovePosition(actionsPosition + globalEditorWidgetData.moveIconPosition);- gc.drawPixmap(iconMovePosition, globalEditorWidgetData.m_iconMove);+ gc.drawImage(iconMovePosition, renderInterface->convertImageToDisplayColorSpace(globalEditorWidgetData.m_iconMove));}if (globalEditorWidgetData.snapButtonActivated) {QPointF iconSnapPosition(actionsPosition + globalEditorWidgetData.snapIconPosition);if (assistant->isSnappingActive() == true) {- gc.drawPixmap(iconSnapPosition, globalEditorWidgetData.m_iconSnapOn);+ gc.drawImage(iconSnapPosition, renderInterface->convertImageToDisplayColorSpace(globalEditorWidgetData.m_iconSnapOn));}else {- gc.drawPixmap(iconSnapPosition, globalEditorWidgetData.m_iconSnapOff);+ gc.drawImage(iconSnapPosition, renderInterface->convertImageToDisplayColorSpace(globalEditorWidgetData.m_iconSnapOff));}}if (globalEditorWidgetData.lockButtonActivated) {QPointF iconLockedPosition(actionsPosition + globalEditorWidgetData.lockedIconPosition);if (assistant->isLocked()) {- gc.drawPixmap(iconLockedPosition, globalEditorWidgetData.m_iconLockOn);+ gc.drawImage(iconLockedPosition, renderInterface->convertImageToDisplayColorSpace(globalEditorWidgetData.m_iconLockOn));} else {qreal oldOpacity = gc.opacity();gc.setOpacity(0.35);- gc.drawPixmap(iconLockedPosition, globalEditorWidgetData.m_iconLockOff);+ gc.drawImage(iconLockedPosition, renderInterface->convertImageToDisplayColorSpace(globalEditorWidgetData.m_iconLockOff));gc.setOpacity(oldOpacity);}}@@ -647,15 +656,15 @@ void KisPaintingAssistantsDecoration::drawEditorWidget(KisPaintingAssistantSP as//draw button depressedqreal oldOpacity = gc.opacity();gc.setOpacity(0.35);- gc.drawPixmap(iconDuplicatePosition,globalEditorWidgetData.m_iconDuplicate);+ gc.drawImage(iconDuplicatePosition, renderInterface->convertImageToDisplayColorSpace(globalEditorWidgetData.m_iconDuplicate));gc.setOpacity(oldOpacity);}else {- gc.drawPixmap(iconDuplicatePosition,globalEditorWidgetData.m_iconDuplicate);+ gc.drawImage(iconDuplicatePosition, renderInterface->convertImageToDisplayColorSpace(globalEditorWidgetData.m_iconDuplicate));}}if (globalEditorWidgetData.deleteButtonActivated) {QPointF iconDeletePosition(actionsPosition + globalEditorWidgetData.deleteIconPosition);- gc.drawPixmap(iconDeletePosition, globalEditorWidgetData.m_iconDelete);+ gc.drawImage(iconDeletePosition, renderInterface->convertImageToDisplayColorSpace(globalEditorWidgetData.m_iconDelete));}diff --git a/libs/ui/kis_painting_assistants_decoration.h b/libs/ui/kis_painting_assistants_decoration.hindex b292d15891..24917c2493 100644--- a/libs/ui/kis_painting_assistants_decoration.h+++ b/libs/ui/kis_painting_assistants_decoration.h@@ -19,6 +19,7 @@#include <kritaui_export.h>class KisView;+class KoColorDisplayRendererInterface;class KisPaintingAssistantsDecoration;typedef KisSharedPtr<KisPaintingAssistantsDecoration> KisPaintingAssistantsDecorationSP;@@ -49,13 +50,13 @@ struct AssistantEditorData {//size of the side drag decorationconst int dragDecorationWidth = 15;//QPixMaps representing icons for buttons- const QPixmap m_iconMove = KisIconUtils::loadIcon("transform-move").pixmap(buttonSize+10, buttonSize+10);- const QPixmap m_iconSnapOn = KisIconUtils::loadIcon("visible").pixmap(buttonSize, buttonSize);- const QPixmap m_iconSnapOff = KisIconUtils::loadIcon("novisible").pixmap(buttonSize, buttonSize);- const QPixmap m_iconLockOn = KisIconUtils::loadIcon("layer-locked").pixmap(buttonSize, buttonSize);- const QPixmap m_iconLockOff = KisIconUtils::loadIcon("layer-unlocked").pixmap(buttonSize, buttonSize);- const QPixmap m_iconDuplicate = KisIconUtils::loadIcon("duplicateitem").pixmap(buttonSize, buttonSize);- const QPixmap m_iconDelete = KisIconUtils::loadIcon("deletelayer").pixmap(buttonSize, buttonSize);+ const QImage m_iconMove = KisIconUtils::loadIcon("transform-move").pixmap(buttonSize+10, buttonSize+10).toImage();+ const QImage m_iconSnapOn = KisIconUtils::loadIcon("visible").pixmap(buttonSize, buttonSize).toImage();+ const QImage m_iconSnapOff = KisIconUtils::loadIcon("novisible").pixmap(buttonSize, buttonSize).toImage();+ const QImage m_iconLockOn = KisIconUtils::loadIcon("layer-locked").pixmap(buttonSize, buttonSize).toImage();+ const QImage m_iconLockOff = KisIconUtils::loadIcon("layer-unlocked").pixmap(buttonSize, buttonSize).toImage();+ const QImage m_iconDuplicate = KisIconUtils::loadIcon("duplicateitem").pixmap(buttonSize, buttonSize).toImage();+ const QImage m_iconDelete = KisIconUtils::loadIcon("deletelayer").pixmap(buttonSize, buttonSize).toImage();//how many buttons fit horizontally before extending to the next rowconst int horizontalButtonLimit = 3;};@@ -159,8 +160,8 @@ public Q_SLOTS:protected:void drawDecoration(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter *converter,KisCanvas2* canvas) override;- void drawHandles(KisPaintingAssistantSP assistant, QPainter& gc, const KisCoordinatesConverter *converter);- void drawEditorWidget(KisPaintingAssistantSP assistant, QPainter& gc, const KisCoordinatesConverter *converter);+ void drawHandles(KisPaintingAssistantSP assistant, QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *renderInterface);+ void drawEditorWidget(KisPaintingAssistantSP assistant, QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *renderInterface);private:struct Private;diff --git a/plugins/assistants/Assistants/ConcentricEllipseAssistant.cc b/plugins/assistants/Assistants/ConcentricEllipseAssistant.ccindex ce3222da8c..2d91599740 100644--- a/plugins/assistants/Assistants/ConcentricEllipseAssistant.cc+++ b/plugins/assistants/Assistants/ConcentricEllipseAssistant.cc@@ -71,7 +71,7 @@ void ConcentricEllipseAssistant::adjustLine(QPointF &point, QPointF &strokeBeginpoint = project(point, strokeBegin);}-void ConcentricEllipseAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible)+void ConcentricEllipseAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible){gc.save();gc.resetTransform();@@ -95,17 +95,17 @@ void ConcentricEllipseAssistant::drawAssistant(QPainter& gc, const QRectF& updatQPainterPath path;// Draw the ellipsepath.addEllipse(QPointF(0, 0), m_ellipse.semiMajor()*Ratio, m_ellipse.semiMinor()*Ratio);- drawPreview(gc, path);+ drawPreview(gc, path, displayRenderInterface);}}}gc.restore();- KisPaintingAssistant::drawAssistant(gc, updateRect, converter, cached, canvas, assistantVisible, previewVisible);+ KisPaintingAssistant::drawAssistant(gc, updateRect, converter, displayRenderInterface, cached, canvas, assistantVisible, previewVisible);}-void ConcentricEllipseAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible)+void ConcentricEllipseAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible){if (assistantVisible == false || handles().size() < 2) { // 2 points means a line, so we can continue after 1 pointreturn;@@ -119,7 +119,7 @@ void ConcentricEllipseAssistant::drawCache(QPainter& gc, const KisCoordinatesConQPainterPath path;path.moveTo(*handles()[0]);path.lineTo(*handles()[1]);- drawPath(gc, path, isSnappingActive());+ drawPath(gc, path, displayRenderInterface, isSnappingActive());return;}@@ -133,7 +133,7 @@ void ConcentricEllipseAssistant::drawCache(QPainter& gc, const KisCoordinatesConpath.moveTo(QPointF(0, -m_ellipse.semiMinor())); path.lineTo(QPointF(0, m_ellipse.semiMinor()));// Draw the ellipsepath.addEllipse(QPointF(0, 0), m_ellipse.semiMajor(), m_ellipse.semiMinor());- drawPath(gc, path, isSnappingActive());+ drawPath(gc, path, displayRenderInterface, isSnappingActive());}}diff --git a/plugins/assistants/Assistants/ConcentricEllipseAssistant.h b/plugins/assistants/Assistants/ConcentricEllipseAssistant.hindex 909c3f8d30..24242c9d92 100644--- a/plugins/assistants/Assistants/ConcentricEllipseAssistant.h+++ b/plugins/assistants/Assistants/ConcentricEllipseAssistant.h@@ -35,8 +35,8 @@ public:protected:QRect boundingRect() const override;- void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true) override;- void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true) override;+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible=true) override;private:QPointF project(const QPointF& pt, const QPointF& strokeBegin) const;mutable Ellipse m_ellipse;diff --git a/plugins/assistants/Assistants/CurvilinearPerspectiveAssistant.cc b/plugins/assistants/Assistants/CurvilinearPerspectiveAssistant.ccindex 2499ae9f81..53cad429b5 100644--- a/plugins/assistants/Assistants/CurvilinearPerspectiveAssistant.cc+++ b/plugins/assistants/Assistants/CurvilinearPerspectiveAssistant.cc@@ -20,6 +20,7 @@#include <kis_canvas2.h>#include <kis_coordinates_converter.h>#include <kis_algebra_2d.h>+#include <KoColorDisplayRendererInterface.h>#include <math.h>#include <limits>@@ -45,13 +46,15 @@ void CurvilinearPerspectiveAssistant::adjustLine(QPointF &point, QPointF &strokestrokeBegin = QPointF();}-void CurvilinearPerspectiveAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible)+void CurvilinearPerspectiveAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible){Q_UNUSED(cached);Q_UNUSED(updateRect);gc.save();gc.resetTransform();++ const QColor canvasAssistantColor = displayRenderInterface->convertColorToDisplayColorSpace(KoColor(effectiveAssistantColor(), KoColorSpaceRegistry::instance()->rgb8()));if (isSnappingActive()) {@@ -88,15 +91,15 @@ void CurvilinearPerspectiveAssistant::drawAssistant(QPainter& gc, const QRectF&// Copied from Two-Point Perspective's fading effect for approaching vanishing points.// Set up the fading effect for the grid lines// Needed so the grid density doesn't look distracting- QColor color = effectiveAssistantColor();+ QColor color = canvasAssistantColor;QGradient fade = QLinearGradient(QPointF(p1.x() - deltaY, p1.y() + deltaX),QPointF(p1.x() + deltaY, p1.y() - deltaX));color.setAlphaF(0.0);- fade.setColorAt(0.42, effectiveAssistantColor());+ fade.setColorAt(0.42, canvasAssistantColor);fade.setColorAt(0.5, color);- fade.setColorAt(0.58, effectiveAssistantColor());+ fade.setColorAt(0.58, canvasAssistantColor);const QPen pen = gc.pen();const QBrush new_brush = QBrush(fade);int width = 0;@@ -169,11 +172,12 @@ void CurvilinearPerspectiveAssistant::drawAssistant(QPainter& gc, const QRectF&}-void CurvilinearPerspectiveAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible)+void CurvilinearPerspectiveAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible){Q_UNUSED(gc);Q_UNUSED(converter);Q_UNUSED(assistantVisible);+ Q_UNUSED(displayRenderInterface);}QLineF CurvilinearPerspectiveAssistant::identifyCircle(const QPointF thirdPoint) {diff --git a/plugins/assistants/Assistants/CurvilinearPerspectiveAssistant.h b/plugins/assistants/Assistants/CurvilinearPerspectiveAssistant.hindex db106d115b..646f08ca44 100644--- a/plugins/assistants/Assistants/CurvilinearPerspectiveAssistant.h+++ b/plugins/assistants/Assistants/CurvilinearPerspectiveAssistant.h@@ -30,8 +30,8 @@ public:bool isAssistantComplete() const override;protected:- void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true) override;- void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true) override;+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible=true) override;private:QLineF identifyCircle(const QPointF thirdPoint);explicit CurvilinearPerspectiveAssistant(const CurvilinearPerspectiveAssistant &rhs, QMap<KisPaintingAssistantHandleSP, KisPaintingAssistantHandleSP> &handleMap);diff --git a/plugins/assistants/Assistants/EllipseAssistant.cc b/plugins/assistants/Assistants/EllipseAssistant.ccindex a8fbb8fc18..285639cb3e 100644--- a/plugins/assistants/Assistants/EllipseAssistant.cc+++ b/plugins/assistants/Assistants/EllipseAssistant.cc@@ -64,7 +64,7 @@ void EllipseAssistant::adjustLine(QPointF &point, QPointF &strokeBegin)strokeBegin = p4;}-void EllipseAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible)+void EllipseAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible){gc.save();gc.resetTransform();@@ -94,17 +94,17 @@ void EllipseAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, con//path.moveTo(QPointF(0, -e.semiMinor())); path.lineTo(QPointF(0, e.semiMinor()));// Draw the ellipsepath.addEllipse(QPointF(0, 0), e.semiMajor(), e.semiMinor());- drawPreview(gc, path);+ drawPreview(gc, path, displayRenderInterface);}}}gc.restore();- KisPaintingAssistant::drawAssistant(gc, updateRect, converter, cached, canvas, assistantVisible, previewVisible);+ KisPaintingAssistant::drawAssistant(gc, updateRect, converter, displayRenderInterface, cached, canvas, assistantVisible, previewVisible);}-void EllipseAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible)+void EllipseAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible){if (assistantVisible == false || handles().size() < 2){@@ -119,7 +119,7 @@ void EllipseAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *coQPainterPath path;path.moveTo(*handles()[0]);path.lineTo(*handles()[1]);- drawPath(gc, path, isSnappingActive());+ drawPath(gc, path, displayRenderInterface, isSnappingActive());return;}if (e.set(*handles()[0], *handles()[1], *handles()[2])) {@@ -132,7 +132,7 @@ void EllipseAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *copath.moveTo(QPointF(0, -e.semiMinor())); path.lineTo(QPointF(0, e.semiMinor()));// Draw the ellipsepath.addEllipse(QPointF(0, 0), e.semiMajor(), e.semiMinor());- drawPath(gc, path, isSnappingActive());+ drawPath(gc, path, displayRenderInterface, isSnappingActive());}}diff --git a/plugins/assistants/Assistants/EllipseAssistant.h b/plugins/assistants/Assistants/EllipseAssistant.hindex 3aa2012398..700a8020ac 100644--- a/plugins/assistants/Assistants/EllipseAssistant.h+++ b/plugins/assistants/Assistants/EllipseAssistant.h@@ -28,8 +28,8 @@ public:protected:QRect boundingRect() const override;- void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true) override;- void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true) override;+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible=true) override;private:QPointF project(const QPointF& pt) const;explicit EllipseAssistant(const EllipseAssistant &rhs, QMap<KisPaintingAssistantHandleSP, KisPaintingAssistantHandleSP> &handleMap);diff --git a/plugins/assistants/Assistants/FisheyePointAssistant.cc b/plugins/assistants/Assistants/FisheyePointAssistant.ccindex 41559b9f97..f98c9ef019 100644--- a/plugins/assistants/Assistants/FisheyePointAssistant.cc+++ b/plugins/assistants/Assistants/FisheyePointAssistant.cc@@ -77,7 +77,7 @@ void FisheyePointAssistant::adjustLine(QPointF &point, QPointF &strokeBegin)strokeBegin = QPointF();}-void FisheyePointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible)+void FisheyePointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible){gc.save();gc.resetTransform();@@ -96,7 +96,7 @@ void FisheyePointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRectQPainterPath path;// Draw the ellipsepath.addEllipse(QPointF(0, 0), extraE.semiMajor(), extraE.semiMinor());- drawPreview(gc, path);+ drawPreview(gc, path, displayRenderInterface);}QLineF radius(*handles()[1], *handles()[0]);radius.setAngle(fmod(radius.angle()+180.0,360.0));@@ -106,7 +106,7 @@ void FisheyePointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRectQPainterPath path;// Draw the ellipsepath.addEllipse(QPointF(0, 0), extraE.semiMajor(), extraE.semiMinor());- drawPreview(gc, path);+ drawPreview(gc, path, displayRenderInterface);}QLineF radius2(*handles()[0], *handles()[1]);radius2.setAngle(fmod(radius2.angle()+180.0,360.0));@@ -116,7 +116,7 @@ void FisheyePointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRectQPainterPath path;// Draw the ellipsepath.addEllipse(QPointF(0, 0), extraE.semiMajor(), extraE.semiMinor());- drawPreview(gc, path);+ drawPreview(gc, path, displayRenderInterface);}}@@ -124,11 +124,11 @@ void FisheyePointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect}gc.restore();- KisPaintingAssistant::drawAssistant(gc, updateRect, converter, cached, canvas, assistantVisible, previewVisible);+ KisPaintingAssistant::drawAssistant(gc, updateRect, converter, displayRenderInterface, cached, canvas, assistantVisible, previewVisible);}-void FisheyePointAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible)+void FisheyePointAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible){if (assistantVisible == false){return;@@ -142,7 +142,7 @@ void FisheyePointAssistant::drawCache(QPainter& gc, const KisCoordinatesConverteQPainterPath path;path.moveTo(*handles()[0]);path.lineTo(*handles()[1]);- drawPath(gc, path, isSnappingActive());+ drawPath(gc, path, displayRenderInterface, isSnappingActive());return;}if (e.set(*handles()[0], *handles()[1], *handles()[2])) {@@ -161,7 +161,7 @@ void FisheyePointAssistant::drawCache(QPainter& gc, const KisCoordinatesConverte//path.moveTo(QPointF(0, -e.semiMinor())); path.lineTo(QPointF(0, e.semiMinor()));// Draw the ellipsepath.addEllipse(QPointF(0, 0), e.semiMajor(), e.semiMinor());- drawPath(gc, path, isSnappingActive());+ drawPath(gc, path, displayRenderInterface, isSnappingActive());}}diff --git a/plugins/assistants/Assistants/FisheyePointAssistant.h b/plugins/assistants/Assistants/FisheyePointAssistant.hindex 730786add3..a8ea8d384e 100644--- a/plugins/assistants/Assistants/FisheyePointAssistant.h+++ b/plugins/assistants/Assistants/FisheyePointAssistant.h@@ -32,8 +32,8 @@ public:protected:QRect boundingRect() const override;- void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true) override;- void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true) override;+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible=true) override;private:QPointF project(const QPointF& pt, const QPointF& strokeBegin);explicit FisheyePointAssistant(const FisheyePointAssistant &rhs, QMap<KisPaintingAssistantHandleSP, KisPaintingAssistantHandleSP> &handleMap);diff --git a/plugins/assistants/Assistants/InfiniteRulerAssistant.cc b/plugins/assistants/Assistants/InfiniteRulerAssistant.ccindex 0a88252085..ed3fbd363b 100644--- a/plugins/assistants/Assistants/InfiniteRulerAssistant.cc+++ b/plugins/assistants/Assistants/InfiniteRulerAssistant.cc@@ -76,7 +76,7 @@ void InfiniteRulerAssistant::adjustLine(QPointF &point, QPointF &strokeBegin)strokeBegin = project(strokeBegin, strokeBegin, false, 0.0);}-void InfiniteRulerAssistant::drawSubdivisions(QPainter& gc, const KisCoordinatesConverter *converter) {+void InfiniteRulerAssistant::drawSubdivisions(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface) {if (subdivisions() == 0) {return;}@@ -160,13 +160,13 @@ void InfiniteRulerAssistant::drawSubdivisions(QPainter& gc, const KisCoordinates}// Draw highlight as regular path (2 px wide)- drawPath(gc, highlight);+ drawPath(gc, highlight, displayRenderInterface);// Draw normal lines as preview (1 px wide)- drawPreview(gc, path);+ drawPreview(gc, path, displayRenderInterface);}}-void InfiniteRulerAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible)+void InfiniteRulerAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRendererInterface, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible){gc.save();gc.resetTransform();@@ -183,19 +183,19 @@ void InfiniteRulerAssistant::drawAssistant(QPainter& gc, const QRectF& updateRecQPainterPath path;path.moveTo(snapLine.p1());path.lineTo(snapLine.p2());- drawPreview(gc, path);+ drawPreview(gc, path, displayRendererInterface);// Add the extended subdivisions, if active// When the number of subdivisions (or minor subdivisions) is set to// 0, the respective feature is turned off and won't be rendered.if (subdivisions() > 0) {- drawSubdivisions(gc, converter);+ drawSubdivisions(gc, converter, displayRendererInterface);}}gc.restore();- RulerAssistant::drawAssistant(gc, updateRect, converter, cached, canvas, assistantVisible, previewVisible);+ RulerAssistant::drawAssistant(gc, updateRect, converter, displayRendererInterface, cached, canvas, assistantVisible, previewVisible);}InfiniteRulerAssistant::ClippingResult InfiniteRulerAssistant::clipLineParametric(QLineF line, QRectF rect, bool extendFirst, bool extendSecond) {diff --git a/plugins/assistants/Assistants/InfiniteRulerAssistant.h b/plugins/assistants/Assistants/InfiniteRulerAssistant.hindex e9575e5cea..323db71e65 100644--- a/plugins/assistants/Assistants/InfiniteRulerAssistant.h+++ b/plugins/assistants/Assistants/InfiniteRulerAssistant.h@@ -30,13 +30,13 @@ public:bool isAssistantComplete() const override;protected:- void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true) override;+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRendererInterface, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true) override;private:QPointF project(const QPointF& pt, const QPointF& strokeBegin, const bool checkForInitialMovement, qreal moveThresholdPt);explicit InfiniteRulerAssistant(const InfiniteRulerAssistant &rhs, QMap<KisPaintingAssistantHandleSP, KisPaintingAssistantHandleSP> &handleMap);- void drawSubdivisions(QPainter& gc, const KisCoordinatesConverter *converter);+ void drawSubdivisions(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface);// Helper struct for clipLineParametric's return typestruct ClippingResult {diff --git a/plugins/assistants/Assistants/ParallelRulerAssistant.cc b/plugins/assistants/Assistants/ParallelRulerAssistant.ccindex 5e828d59c8..2d60b398da 100644--- a/plugins/assistants/Assistants/ParallelRulerAssistant.cc+++ b/plugins/assistants/Assistants/ParallelRulerAssistant.cc@@ -79,7 +79,7 @@ void ParallelRulerAssistant::adjustLine(QPointF &point, QPointF &strokeBegin)point = project(point, strokeBegin, 0.0);}-void ParallelRulerAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible)+void ParallelRulerAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible){gc.save();gc.resetTransform();@@ -101,7 +101,7 @@ void ParallelRulerAssistant::drawAssistant(QPainter& gc, const QRectF& updateRecpath.lineTo(initialTransform.map(local.bottomRight()));path.lineTo(initialTransform.map(local.bottomLeft()));path.lineTo(initialTransform.map(local.topLeft()));- drawPath(gc, path, isSnappingActive());//and we draw the preview.+ drawPath(gc, path, displayRenderInterface, isSnappingActive());//and we draw the preview.}@@ -121,15 +121,15 @@ void ParallelRulerAssistant::drawAssistant(QPainter& gc, const QRectF& updateRecpath.moveTo(snapLine.p1());path.lineTo(snapLine.p2());- drawPreview(gc, path);//and we draw the preview.+ drawPreview(gc, path, displayRenderInterface);//and we draw the preview.}gc.restore();- KisPaintingAssistant::drawAssistant(gc, updateRect, converter, cached, canvas, assistantVisible, previewVisible);+ KisPaintingAssistant::drawAssistant(gc, updateRect, converter, displayRenderInterface, cached, canvas, assistantVisible, previewVisible);}-void ParallelRulerAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible)+void ParallelRulerAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible){if (assistantVisible == false || handles().size() < 2) {return;@@ -145,7 +145,7 @@ void ParallelRulerAssistant::drawCache(QPainter& gc, const KisCoordinatesConvertQPainterPath path;path.moveTo(p1);path.lineTo(p2);- drawPath(gc, path, isSnappingActive());+ drawPath(gc, path, displayRenderInterface, isSnappingActive());}diff --git a/plugins/assistants/Assistants/ParallelRulerAssistant.h b/plugins/assistants/Assistants/ParallelRulerAssistant.hindex 87b22d4355..a206b0a409 100644--- a/plugins/assistants/Assistants/ParallelRulerAssistant.h+++ b/plugins/assistants/Assistants/ParallelRulerAssistant.h@@ -33,8 +33,8 @@ public:bool loadCustomXml(QXmlStreamReader* xml) override;protected:- void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true) override;- void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true) override;+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible=true) override;KisPaintingAssistantHandleSP firstLocalHandle() const override;KisPaintingAssistantHandleSP secondLocalHandle() const override;diff --git a/plugins/assistants/Assistants/PerspectiveAssistant.cc b/plugins/assistants/Assistants/PerspectiveAssistant.ccindex a7af9c3468..a358dc830d 100644--- a/plugins/assistants/Assistants/PerspectiveAssistant.cc+++ b/plugins/assistants/Assistants/PerspectiveAssistant.cc@@ -139,7 +139,7 @@ bool PerspectiveAssistant::isActive() constreturn isSnappingActive();}-void PerspectiveAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible)+void PerspectiveAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible){gc.save();gc.resetTransform();@@ -150,10 +150,10 @@ void PerspectiveAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect,if (getTransform(poly, transform) && assistantVisible==true) {// draw vanishing pointsif (m_cache.vanishingPoint1) {- drawX(gc, initialTransform.map(m_cache.vanishingPoint1.get()));+ drawX(gc, initialTransform.map(m_cache.vanishingPoint1.get()), displayRenderInterface);}if (m_cache.vanishingPoint2) {- drawX(gc, initialTransform.map(m_cache.vanishingPoint2.get()));+ drawX(gc, initialTransform.map(m_cache.vanishingPoint2.get()), displayRenderInterface);}}@@ -206,7 +206,7 @@ void PerspectiveAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect,}}}- drawPreview(gc, path2);+ drawPreview(gc, path2, displayRenderInterface);}}@@ -223,11 +223,11 @@ void PerspectiveAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect,QPainterPath path;// that will create a triangle with a point inside connected to all vertices of the trianglepath.addPolygon(PerspectiveBasedAssistantHelper::getAllConnectedTetragon(handles()));- drawError(gc, path);+ drawError(gc, path, displayRenderInterface);} else {QPainterPath path;path.addPolygon(poly);- drawPath(gc, path, isSnappingActive());+ drawPath(gc, path, displayRenderInterface, isSnappingActive());}} else {gc.setPen(QColor(0, 0, 0, 125));@@ -250,7 +250,7 @@ void PerspectiveAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect,path.lineTo(line.p2());}- drawPath(gc, path, isSnappingActive());+ drawPath(gc, path, displayRenderInterface, isSnappingActive());}}//@@ -258,14 +258,15 @@ void PerspectiveAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect,gc.restore();- KisPaintingAssistant::drawAssistant(gc, updateRect, converter, cached,canvas, assistantVisible, previewVisible);+ KisPaintingAssistant::drawAssistant(gc, updateRect, converter, displayRenderInterface, cached,canvas, assistantVisible, previewVisible);}-void PerspectiveAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible)+void PerspectiveAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible){Q_UNUSED(gc);Q_UNUSED(converter);Q_UNUSED(assistantVisible);+ Q_UNUSED(displayRenderInterface);}QPointF PerspectiveAssistant::getDefaultEditorPosition() constdiff --git a/plugins/assistants/Assistants/PerspectiveAssistant.h b/plugins/assistants/Assistants/PerspectiveAssistant.hindex e1d298d694..56d13bdfdf 100644--- a/plugins/assistants/Assistants/PerspectiveAssistant.h+++ b/plugins/assistants/Assistants/PerspectiveAssistant.h@@ -31,7 +31,7 @@ public:QPointF getDefaultEditorPosition() const override;int numHandles() const override { return 4; }- void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true) override;+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true) override;bool contains(const QPointF& point) const override;qreal distance(const QPointF& point) const override;@@ -46,7 +46,7 @@ public:bool loadCustomXml(QXmlStreamReader *xml) override;protected:- void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible=true) override;private:QPointF project(const QPointF& pt, const QPointF& strokeBegin, const bool snapToAnyDirection, qreal moveThresholdPt);// creates the convex hull, returns false if it's not a quadrilateraldiff --git a/plugins/assistants/Assistants/PerspectiveEllipseAssistant.cc b/plugins/assistants/Assistants/PerspectiveEllipseAssistant.ccindex 6aa13756ac..3fcb87972f 100644--- a/plugins/assistants/Assistants/PerspectiveEllipseAssistant.cc+++ b/plugins/assistants/Assistants/PerspectiveEllipseAssistant.cc@@ -371,7 +371,7 @@ void PerspectiveEllipseAssistant::adjustLine(QPointF &point, QPointF &strokeBegistrokeBegin = QPointF();}-void PerspectiveEllipseAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible)+void PerspectiveEllipseAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible){gc.save();gc.resetTransform();@@ -394,10 +394,10 @@ void PerspectiveEllipseAssistant::drawAssistant(QPainter& gc, const QRectF& updaif (isEllipseValid() && assistantVisible==true) {// draw vanishing pointsif (d->cache.vanishingPoint1) {- drawX(gc, initialTransform.map(d->cache.vanishingPoint1.get()));+ drawX(gc, initialTransform.map(d->cache.vanishingPoint1.get()), displayRenderInterface);}if (d->cache.vanishingPoint2) {- drawX(gc, initialTransform.map(d->cache.vanishingPoint2.get()));+ drawX(gc, initialTransform.map(d->cache.vanishingPoint2.get()), displayRenderInterface);}}@@ -411,9 +411,9 @@ void PerspectiveEllipseAssistant::drawAssistant(QPainter& gc, const QRectF& updapath.addEllipse(QPointF(0.0, 0.0), d->simpleEllipse.semiMajor(), d->simpleEllipse.semiMinor());if (assistantVisible || isEditing) {- drawPath(gc, path, isSnappingActive());+ drawPath(gc, path, displayRenderInterface, isSnappingActive());} else if (previewVisible && isSnappingActive() && boundingRect().contains(initialTransform.inverted().map(mousePos.toPoint()), false)) {- drawPreview(gc, path);+ drawPreview(gc, path, displayRenderInterface);}if (isEditing) {@@ -460,7 +460,7 @@ void PerspectiveEllipseAssistant::drawAssistant(QPainter& gc, const QRectF& updatouchingLine.lineTo(pt4);if (assistantVisible) {- drawPath(gc, touchingLine, isSnappingActive());+ drawPath(gc, touchingLine, displayRenderInterface, isSnappingActive());}}@@ -476,11 +476,11 @@ void PerspectiveEllipseAssistant::drawAssistant(QPainter& gc, const QRectF& upda// that will create a triangle with a point inside connected to all vertices of the trianglepolyAllConnected << *handles()[0] << *handles()[1] << *handles()[2] << *handles()[3] << *handles()[0] << *handles()[2] << *handles()[1] << *handles()[3];path.addPolygon(polyAllConnected);- drawError(gc, path);+ drawError(gc, path, displayRenderInterface);} else {QPainterPath path;path.addPolygon(poly);- drawPath(gc, path, isSnappingActive());+ drawPath(gc, path, displayRenderInterface, isSnappingActive());}} else {gc.setPen(QColor(0, 0, 0, 125));@@ -501,21 +501,22 @@ void PerspectiveEllipseAssistant::drawAssistant(QPainter& gc, const QRectF& updapath.lineTo(line.p2());}- drawPath(gc, path, isSnappingActive());+ drawPath(gc, path, displayRenderInterface, isSnappingActive());}}gc.restore();- KisPaintingAssistant::drawAssistant(gc, updateRect, converter, cached, canvas, assistantVisible, previewVisible);+ KisPaintingAssistant::drawAssistant(gc, updateRect, converter, displayRenderInterface, cached, canvas, assistantVisible, previewVisible);}-void PerspectiveEllipseAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible)+void PerspectiveEllipseAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible){Q_UNUSED(converter);Q_UNUSED(gc);Q_UNUSED(assistantVisible);+ Q_UNUSED(displayRenderInterface);}QRect PerspectiveEllipseAssistant::boundingRect() constdiff --git a/plugins/assistants/Assistants/PerspectiveEllipseAssistant.h b/plugins/assistants/Assistants/PerspectiveEllipseAssistant.hindex 0628029bd0..5f80cd17d8 100644--- a/plugins/assistants/Assistants/PerspectiveEllipseAssistant.h+++ b/plugins/assistants/Assistants/PerspectiveEllipseAssistant.h@@ -33,8 +33,8 @@ public:protected:QRect boundingRect() const override;- void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true) override;- void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true) override;+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible=true) override;private:QPointF project(const QPointF& pt, const QPointF& strokeBegin);diff --git a/plugins/assistants/Assistants/RulerAssistant.cc b/plugins/assistants/Assistants/RulerAssistant.ccindex cd074ad409..977a5929d5 100644--- a/plugins/assistants/Assistants/RulerAssistant.cc+++ b/plugins/assistants/Assistants/RulerAssistant.cc@@ -80,7 +80,7 @@ void RulerAssistant::adjustLine(QPointF &point, QPointF &strokeBegin)strokeBegin = project(strokeBegin);}-void RulerAssistant::drawSubdivisions(QPainter& gc, const KisCoordinatesConverter *converter) {+void RulerAssistant::drawSubdivisions(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface) {if (subdivisions() == 0) {return;}@@ -142,12 +142,12 @@ void RulerAssistant::drawSubdivisions(QPainter& gc, const KisCoordinatesConvertegc.save();gc.resetTransform();- drawPath(gc, path, isSnappingActive());+ drawPath(gc, path, displayRenderInterface, isSnappingActive());gc.restore();}}-void RulerAssistant::drawHandleAnnotations(QPainter& gc, const KisCoordinatesConverter* converter) {+void RulerAssistant::drawHandleAnnotations(QPainter& gc, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface) {gc.save();gc.resetTransform();@@ -175,29 +175,29 @@ void RulerAssistant::drawHandleAnnotations(QPainter& gc, const KisCoordinatesConpath.arcTo(bounds, i * 180, -90);}- drawPath(gc, path);+ drawPath(gc, path, displayRenderInterface);gc.restore();}-void RulerAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible)+void RulerAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible){// Draw the subdivisions// When the number of subdivisions (or minor subdivisions) is set to// 0, the respective feature is turned off and won't be rendered.if (assistantVisible && isAssistantComplete() && subdivisions() > 0) {- drawSubdivisions(gc, converter);+ drawSubdivisions(gc, converter, displayRenderInterface);}// Indicate handle type on fixed-length handlesif (canvas && canvas->paintingAssistantsDecoration()->isEditingAssistants() && hasFixedLength()) {- drawHandleAnnotations(gc, converter);+ drawHandleAnnotations(gc, converter, displayRenderInterface);}// Draw the ruler itself via drawCache- KisPaintingAssistant::drawAssistant(gc, updateRect, converter, cached, canvas, assistantVisible, previewVisible);+ KisPaintingAssistant::drawAssistant(gc, updateRect, converter, displayRenderInterface, cached, canvas, assistantVisible, previewVisible);}-void RulerAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible)+void RulerAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible){if (!assistantVisible || !isAssistantComplete()){return;@@ -213,7 +213,7 @@ void RulerAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *convQPainterPath path;path.moveTo(p1);path.lineTo(p2);- drawPath(gc, path, isSnappingActive());+ drawPath(gc, path, displayRenderInterface, isSnappingActive());}QPointF RulerAssistant::getDefaultEditorPosition() constdiff --git a/plugins/assistants/Assistants/RulerAssistant.h b/plugins/assistants/Assistants/RulerAssistant.hindex 794260d1fa..1ee646579f 100644--- a/plugins/assistants/Assistants/RulerAssistant.h+++ b/plugins/assistants/Assistants/RulerAssistant.h@@ -42,15 +42,15 @@ public:void ensureLength();protected:- void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true) override;- void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true) override;+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible=true) override;explicit RulerAssistant(const QString& id, const QString& name);explicit RulerAssistant(const RulerAssistant &rhs, QMap<KisPaintingAssistantHandleSP, KisPaintingAssistantHandleSP> &handleMap);private:QPointF project(const QPointF& pt) const;- void drawSubdivisions(QPainter& gc, const KisCoordinatesConverter *converter);- void drawHandleAnnotations(QPainter& gc, const KisCoordinatesConverter *converter);+ void drawSubdivisions(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface);+ void drawHandleAnnotations(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface);int m_subdivisions {0};int m_minorSubdivisions {0};diff --git a/plugins/assistants/Assistants/SplineAssistant.cc b/plugins/assistants/Assistants/SplineAssistant.ccindex 5714530288..c8c463f0ee 100644--- a/plugins/assistants/Assistants/SplineAssistant.cc+++ b/plugins/assistants/Assistants/SplineAssistant.cc@@ -19,6 +19,7 @@#include <kis_coordinates_converter.h>#include "kis_debug.h"#include "KisBezierUtils.h"+#include <KoColorDisplayRendererInterface.h>#include <math.h>#include <limits>@@ -218,7 +219,7 @@ void SplineAssistant::adjustLine(QPointF &point, QPointF &strokeBegin)strokeBegin = QPointF();}-void SplineAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible)+void SplineAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible){gc.save();gc.resetTransform();@@ -255,7 +256,7 @@ void SplineAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, cons//then we use this path to check the bounding rectangle//if (isSnappingActive() && path.boundingRect().contains(initialTransform.inverted().map(mousePos)) && previewVisible==true){- drawPreview(gc, path);//and we draw the preview.+ drawPreview(gc, path, displayRenderInterface);//and we draw the preview.}}gc.restore();@@ -263,11 +264,11 @@ void SplineAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, cons// there is some odd rectangle that is getting rendered when there is only one point, so don't start rendering the line until after 2// this issue only exists with this spline assistant...none of the othersif (handles().size() > 2) {- KisPaintingAssistant::drawAssistant(gc, updateRect, converter, cached, canvas, assistantVisible, previewVisible);+ KisPaintingAssistant::drawAssistant(gc, updateRect, converter, displayRenderInterface, cached, canvas, assistantVisible, previewVisible);}}-void SplineAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible)+void SplineAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible){if (assistantVisible == false || handles().size() < 2 ){return;@@ -286,7 +287,7 @@ void SplineAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *con{ // Draw bezier handles control lines only if we are editing the assistantgc.save();- QColor assistantColor = effectiveAssistantColor();+ QColor assistantColor = displayRenderInterface->convertColorToDisplayColorSpace(KoColor(effectiveAssistantColor(), KoColorSpaceRegistry::instance()->rgb8()));QPen bezierlinePen(assistantColor);bezierlinePen.setStyle(Qt::DotLine);bezierlinePen.setWidth(2);@@ -317,7 +318,7 @@ void SplineAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *conQPainterPath path;path.moveTo(pts[0]);path.cubicTo(pts[2], pts[3], pts[1]);- drawPath(gc, path, isSnappingActive());+ drawPath(gc, path, displayRenderInterface, isSnappingActive());}diff --git a/plugins/assistants/Assistants/SplineAssistant.h b/plugins/assistants/Assistants/SplineAssistant.hindex d37c5df9ba..8966ad0a37 100644--- a/plugins/assistants/Assistants/SplineAssistant.h+++ b/plugins/assistants/Assistants/SplineAssistant.h@@ -24,8 +24,8 @@ public:bool isAssistantComplete() const override;protected:- void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true) override;- void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true) override;+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible=true) override;private:QPointF project(const QPointF& pt, const QPointF& strokeBegin) const;explicit SplineAssistant(const SplineAssistant &rhs, QMap<KisPaintingAssistantHandleSP, KisPaintingAssistantHandleSP> &handleMap);diff --git a/plugins/assistants/Assistants/TwoPointAssistant.cc b/plugins/assistants/Assistants/TwoPointAssistant.ccindex a5816ebc20..29791a1262 100644--- a/plugins/assistants/Assistants/TwoPointAssistant.cc+++ b/plugins/assistants/Assistants/TwoPointAssistant.cc@@ -22,6 +22,7 @@#include <math.h>#include <QtCore/qmath.h>#include <kis_assert.h>+#include <KoColorDisplayRendererInterface.h>TwoPointAssistant::TwoPointAssistant(): KisPaintingAssistant("two point", i18n("Two point assistant"))@@ -148,13 +149,15 @@ void TwoPointAssistant::adjustLine(QPointF &point, QPointF &strokeBegin)point = p;}-void TwoPointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible)+void TwoPointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible){Q_UNUSED(updateRect);Q_UNUSED(cached);gc.save();gc.resetTransform();+ const QColor canvasAssistantColor = displayRenderInterface->convertColorToDisplayColorSpace(KoColor(effectiveAssistantColor(), KoColorSpaceRegistry::instance()->rgb8()));+const QTransform initialTransform = converter->documentToWidgetTransform();bool isEditing = false;bool showLocal = isLocal() && handles().size() == 5;@@ -170,7 +173,7 @@ void TwoPointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, coQPainterPath pathCenter;pathCenter.addEllipse(ellipse);- drawPath(gc, pathCenter, isSnappingActive());+ drawPath(gc, pathCenter, displayRenderInterface, isSnappingActive());// Draw circle to represent center of visionif (handles().length() == 3 && handle == handles()[2]) {@@ -183,7 +186,7 @@ void TwoPointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, coQRectF center_ellipse = QRectF(QPointF(center.x() -15, center.y() -15), QSizeF(30, 30));QPainterPath pathCenter;pathCenter.addEllipse(center_ellipse);- drawPath(gc, pathCenter, isSnappingActive());+ drawPath(gc, pathCenter, displayRenderInterface, isSnappingActive());}}@@ -222,7 +225,7 @@ void TwoPointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, co}- drawPreview(gc, path);//and we draw the preview.+ drawPreview(gc, path, displayRenderInterface);//and we draw the preview.}}@@ -296,8 +299,8 @@ void TwoPointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, co}- drawPreview(gc,previewPath);- drawPath(gc, path, isSnappingActive());+ drawPreview(gc,previewPath, displayRenderInterface);+ drawPath(gc, path, displayRenderInterface, isSnappingActive());if (handles().size() >= 3 && isSnappingActive()) {path = QPainterPath(); // clear@@ -326,7 +329,7 @@ void TwoPointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, copath.moveTo(initialTransform.map(inv.map(QPointF(0,vp_a.y()-10))));path.lineTo(initialTransform.map(inv.map(QPointF(0,vp_a.y()+10))));}- drawPreview(gc,path);+ drawPreview(gc,path, displayRenderInterface);path = QPainterPath(); // clear}}@@ -336,13 +339,13 @@ void TwoPointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, co// Set up the fading effect for the grid lines// Needed so the grid density doesn't look distracting- QColor color = effectiveAssistantColor();+ QColor color = canvasAssistantColor;QGradient fade = QLinearGradient(initialTransform.map(inv.map(upper)),initialTransform.map(inv.map(lower)));color.setAlphaF(0);- fade.setColorAt(0.4, effectiveAssistantColor());+ fade.setColorAt(0.4, canvasAssistantColor);fade.setColorAt(0.5, color);- fade.setColorAt(0.6, effectiveAssistantColor());+ fade.setColorAt(0.6, canvasAssistantColor);const QPen pen = gc.pen();const QBrush new_brush = QBrush(fade);int width = 1;@@ -395,11 +398,12 @@ void TwoPointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, co//KisPaintingAssistant::drawAssistant(gc, updateRect, converter, cached, canvas, assistantVisible, previewVisible);}-void TwoPointAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible)+void TwoPointAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible){Q_UNUSED(gc);Q_UNUSED(converter);Q_UNUSED(assistantVisible);+ Q_UNUSED(displayRenderInterface);if (!m_canvas || !isAssistantComplete()) {return;}diff --git a/plugins/assistants/Assistants/TwoPointAssistant.h b/plugins/assistants/Assistants/TwoPointAssistant.hindex 96bdd4fff4..04e68c943c 100644--- a/plugins/assistants/Assistants/TwoPointAssistant.h+++ b/plugins/assistants/Assistants/TwoPointAssistant.h@@ -63,8 +63,8 @@ public:QTransform localTransform(QPointF vp_a, QPointF vp_b, QPointF pt_c, qreal* size);protected:- void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=nullptr, bool assistantVisible=true, bool previewVisible=true) override;- void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached = true,KisCanvas2* canvas=nullptr, bool assistantVisible=true, bool previewVisible=true) override;+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible=true) override;KisPaintingAssistantHandleSP firstLocalHandle() const override;KisPaintingAssistantHandleSP secondLocalHandle() const override;diff --git a/plugins/assistants/Assistants/VanishingPointAssistant.cc b/plugins/assistants/Assistants/VanishingPointAssistant.ccindex da83631771..cfaaa05756 100644--- a/plugins/assistants/Assistants/VanishingPointAssistant.cc+++ b/plugins/assistants/Assistants/VanishingPointAssistant.cc@@ -80,7 +80,7 @@ void VanishingPointAssistant::adjustLine(QPointF &point, QPointF &strokeBegin)point = project(point, strokeBegin, 0.0);}-void VanishingPointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible)+void VanishingPointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached, KisCanvas2* canvas, bool assistantVisible, bool previewVisible){// HACK ALERT: side handles aren't saved in old krita versions// we need to just add a default position for now if we are loading a vanishing point@@ -119,7 +119,7 @@ void VanishingPointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRepath.moveTo(snapLine.p2());path.lineTo(snapLine.p1());- drawPreview(gc, path);//and we draw the preview.+ drawPreview(gc, path, displayRenderInterface);//and we draw the preview.}}@@ -143,7 +143,7 @@ void VanishingPointAssistant::drawAssistant(QPainter& gc, const QRectF& updateReQPainterPath pathCenter;pathCenter.addEllipse(ellipse);- drawPath(gc, pathCenter, isSnappingActive());+ drawPath(gc, pathCenter, displayRenderInterface, isSnappingActive());QColor paintingColor = effectiveAssistantColor();@@ -184,7 +184,7 @@ void VanishingPointAssistant::drawAssistant(QPainter& gc, const QRectF& updateRepath.lineTo(initialTransform.map(p3));path.lineTo(initialTransform.map(p4));path.lineTo(initialTransform.map(p1));- drawPath(gc, path, isSnappingActive());//and we draw the rectangle+ drawPath(gc, path, displayRenderInterface, isSnappingActive());//and we draw the rectangle}@@ -211,17 +211,17 @@ void VanishingPointAssistant::drawAssistant(QPainter& gc, const QRectF& updateReQPainterPath path;path.moveTo(snapLine.p1());path.lineTo(snapLine.p2());- drawPreview(gc, path);//and we draw the preview.+ drawPreview(gc, path, displayRenderInterface);//and we draw the preview.}}gc.restore();- KisPaintingAssistant::drawAssistant(gc, updateRect, converter, cached, canvas, assistantVisible, previewVisible);+ KisPaintingAssistant::drawAssistant(gc, updateRect, converter, displayRenderInterface, cached, canvas, assistantVisible, previewVisible);}-void VanishingPointAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible)+void VanishingPointAssistant::drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible){if (!m_canvas || !isAssistantComplete()) {return;@@ -243,7 +243,7 @@ void VanishingPointAssistant::drawCache(QPainter& gc, const KisCoordinatesConverpath.lineTo(QPointF(p0.x() + 10.0, p0.y() - 10.0));- drawPath(gc, path, isSnappingActive());+ drawPath(gc, path, displayRenderInterface, isSnappingActive());}KisPaintingAssistantHandleSP VanishingPointAssistant::firstLocalHandle() constdiff --git a/plugins/assistants/Assistants/VanishingPointAssistant.h b/plugins/assistants/Assistants/VanishingPointAssistant.hindex fb86745e68..cc376317b8 100644--- a/plugins/assistants/Assistants/VanishingPointAssistant.h+++ b/plugins/assistants/Assistants/VanishingPointAssistant.h@@ -55,8 +55,8 @@ public:bool loadCustomXml(QXmlStreamReader* xml) override;protected:- void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=nullptr, bool assistantVisible=true, bool previewVisible=true) override;- void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached = true,KisCanvas2* canvas=nullptr, bool assistantVisible=true, bool previewVisible=true) override;+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible=true) override;KisPaintingAssistantHandleSP firstLocalHandle() const override;KisPaintingAssistantHandleSP secondLocalHandle() const override;diff --git a/plugins/assistants/Assistants/kis_assistant_tool.cc b/plugins/assistants/Assistants/kis_assistant_tool.ccindex 8ae1420b92..27f59ce171 100644--- a/plugins/assistants/Assistants/kis_assistant_tool.cc+++ b/plugins/assistants/Assistants/kis_assistant_tool.cc@@ -26,6 +26,7 @@#include <KoFileDialog.h>#include <KoViewConverter.h>#include <KoPointerEvent.h>+#include <KoColorDisplayRendererInterface.h>#include <canvas/kis_canvas2.h>#include <kis_abstract_perspective_grid.h>@@ -1375,10 +1376,10 @@ void KisAssistantTool::paint(QPainter& _gc, const KoViewConverter &_converter)// show special display while a new assistant is in the process of being createdif (m_newAssistant) {- QColor assistantColor = m_newAssistant->effectiveAssistantColor();+ QColor assistantColor = m_canvas->displayRendererInterface()->convertColorToDisplayColorSpace(KoColor(m_newAssistant->effectiveAssistantColor(), KoColorSpaceRegistry::instance()->rgb8()));assistantColor.setAlpha(80);- m_newAssistant->drawAssistant(_gc, canvasSize, m_canvas->coordinatesConverter(), false, m_canvas, true, false);+ m_newAssistant->drawAssistant(_gc, canvasSize, m_canvas->coordinatesConverter(), m_canvas->displayRendererInterface(), false, m_canvas, true, false);Q_FOREACH (const KisPaintingAssistantHandleSP handle, m_newAssistant->handles()) {QPainterPath path;path.addEllipse(QRectF(_converter.documentToView(*handle) - QPointF(m_handleSize * 0.5, m_handleSize * 0.5), QSizeF(m_handleSize, m_handleSize)));@@ -1394,7 +1395,7 @@ void KisAssistantTool::paint(QPainter& _gc, const KoViewConverter &_converter)Q_FOREACH (KisPaintingAssistantSP assistant, m_canvas->paintingAssistantsDecoration()->assistants()) {- QColor assistantColor = assistant->effectiveAssistantColor();+ QColor assistantColor = m_canvas->displayRendererInterface()->convertColorToDisplayColorSpace(KoColor(assistant->effectiveAssistantColor(), KoColorSpaceRegistry::instance()->rgb8()));assistantColor.setAlpha(80);Q_FOREACH (const KisPaintingAssistantHandleSP handle, m_handles) {