Commit 6ed320c4 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Remove the link to KisNode in KisPaintOpSettings

The settings object is purely XML data so we shouldn't store a shared
pointer there. It causes really subtle bugs related to the lifetime of
the node in question.

Now the node is passed to the PaontOp directly via constructor. And the
options widget gets it directly from KisPaintOpBox.

BUG:341847
parent b5254779
......@@ -79,8 +79,7 @@ void KisLowMemoryBenchmark::benchmarkWideArea(const QString presetFileName,
KisPainter *painter = new KisPainter(layer->paintDevice());
painter->setPaintColor(KoColor(Qt::black, colorSpace));
painter->setPaintOpPreset(preset, image);
preset->settings()->setNode(layer);
painter->setPaintOpPreset(preset, layer, image);
/**
* A simple adapter that will store all the transactions for us
......
......@@ -363,8 +363,7 @@ inline void KisStrokeBenchmark::benchmarkLine(QString presetFileName)
{
KisPaintOpPresetSP preset = new KisPaintOpPreset(m_dataPath + presetFileName);
preset->load();
preset->settings()->setNode(m_layer);
m_painter->setPaintOpPreset(preset, m_image);
m_painter->setPaintOpPreset(preset, m_layer, m_image);
QPointF startPoint(0.10 * TEST_IMAGE_WIDTH, 0.5 * TEST_IMAGE_HEIGHT);
QPointF endPoint(0.90 * TEST_IMAGE_WIDTH, 0.5 * TEST_IMAGE_HEIGHT);
......@@ -393,9 +392,7 @@ void KisStrokeBenchmark::benchmarkCircle(QString presetFileName)
return;
}
preset->settings()->setNode(m_layer);
m_painter->setPaintOpPreset(preset, m_image);
m_painter->setPaintOpPreset(preset, m_layer, m_image);
QBENCHMARK{
......@@ -449,8 +446,7 @@ void KisStrokeBenchmark::benchmarkRandomLines(QString presetFileName)
qDebug() << "preset : " << presetFileName;
}
preset->settings()->setNode(m_layer);
m_painter->setPaintOpPreset(preset, m_image);
m_painter->setPaintOpPreset(preset, m_layer, m_image);
QBENCHMARK{
KisDistanceInformation currentDistance;
......@@ -477,8 +473,7 @@ void KisStrokeBenchmark::benchmarkStroke(QString presetFileName)
qDebug() << "preset : " << presetFileName;
}
preset->settings()->setNode(m_layer);
m_painter->setPaintOpPreset(preset, m_image);
m_painter->setPaintOpPreset(preset, m_layer, m_image);
QBENCHMARK{
KisDistanceInformation currentDistance;
......
......@@ -67,7 +67,7 @@ public:
* @param settings the settings associated with the input device
* @param painter the painter used to draw
*/
virtual KisPaintOp * createOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisImageWSP image) = 0;
virtual KisPaintOp * createOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image) = 0;
virtual QString id() const = 0;
virtual QString name() const = 0;
virtual QString category() const = 0;
......
......@@ -83,7 +83,7 @@ void KisPaintOpRegistry::preinitializePaintOpIfNeeded(const KisPaintOpPresetSP p
}
#endif /* HAVE_THREADED_TEXT_RENDERING_WORKAROUND */
KisPaintOp * KisPaintOpRegistry::paintOp(const QString & id, const KisPaintOpSettingsSP settings, KisPainter * painter, KisImageWSP image) const
KisPaintOp * KisPaintOpRegistry::paintOp(const QString & id, const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image) const
{
if (painter == 0) {
warnKrita << " KisPaintOpRegistry::paintOp painter is null";
......@@ -94,7 +94,7 @@ KisPaintOp * KisPaintOpRegistry::paintOp(const QString & id, const KisPaintOpSet
KisPaintOpFactory* f = value(id);
if (f) {
KisPaintOp * op = f->createOp(settings, painter, image);
KisPaintOp * op = f->createOp(settings, painter, node, image);
if (op) {
return op;
}
......@@ -103,14 +103,14 @@ KisPaintOp * KisPaintOpRegistry::paintOp(const QString & id, const KisPaintOpSet
return 0;
}
KisPaintOp * KisPaintOpRegistry::paintOp(const KisPaintOpPresetSP preset, KisPainter * painter, KisImageWSP image) const
KisPaintOp * KisPaintOpRegistry::paintOp(const KisPaintOpPresetSP preset, KisPainter * painter, KisNodeSP node, KisImageSP image) const
{
Q_ASSERT(preset);
Q_ASSERT(painter);
if (!preset) return 0;
return paintOp(preset->paintOp().id(), preset->settings(), painter, image);
return paintOp(preset->paintOp().id(), preset->settings(), painter, node, image);
}
KisPaintOpSettingsSP KisPaintOpRegistry::settings(const KoID& id) const
......
......@@ -58,7 +58,7 @@ public:
* Create and return a paintop based on the given preset. A preset defines
* a paintop, a settings object and possible a brush tip.
*/
KisPaintOp* paintOp(const KisPaintOpPresetSP preset, KisPainter * painter, KisImageWSP image) const;
KisPaintOp* paintOp(const KisPaintOpPresetSP preset, KisPainter * painter, KisNodeSP node, KisImageSP image) const;
/**
* Create and return an (abstracted) configuration widget
......@@ -99,7 +99,7 @@ private:
/**
* Return a newly created paintop. You are responsible for deleting
*/
KisPaintOp * paintOp(const QString& id, const KisPaintOpSettingsSP settings, KisPainter * painter, KisImageWSP image = 0) const;
KisPaintOp * paintOp(const QString& id, const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image) const;
};
......
......@@ -28,7 +28,6 @@
#include <KoCompositeOpRegistry.h>
#include <KoViewConverter.h>
#include "kis_node.h"
#include "kis_paint_layer.h"
#include "kis_image.h"
#include "kis_painter.h"
......@@ -43,7 +42,6 @@
struct KisPaintOpSettings::Private {
Private() : disableDirtyNotifications(false) {}
KisNodeWSP node;
QPointer<KisPaintOpSettingsWidget> settingsWidget;
QString modelName;
KisPaintOpPresetWSP preset;
......@@ -147,16 +145,6 @@ void KisPaintOpSettings::activate()
{
}
void KisPaintOpSettings::setNode(KisNodeSP node)
{
d->node = node;
}
KisNodeSP KisPaintOpSettings::node() const
{
return d->node;
}
void KisPaintOpSettings::changePaintOpSize(qreal x, qreal y)
{
if (!d->settingsWidget.isNull()) {
......
......@@ -82,12 +82,6 @@ public:
*/
virtual KisPaintOpSettingsSP clone() const;
/**
* Override this function if your paintop is interested in which
* node is currently active.
*/
virtual void setNode(KisNodeSP node);
/**
* @return the node the paintop is working on.
*/
......
......@@ -50,6 +50,10 @@ public:
m_image = image;
}
virtual void setNode(KisNodeWSP node) {
m_node = node;
}
/**
* @see KisPaintOpSettings::changePaintOpSize(qreal x, qreal y)
*/
......@@ -83,6 +87,7 @@ public:
protected:
KisImageWSP m_image;
KisNodeWSP m_node;
};
#endif
......@@ -2450,10 +2450,10 @@ const KoAbstractGradient* KisPainter::gradient() const
return d->gradient;
}
void KisPainter::setPaintOpPreset(KisPaintOpPresetSP preset, KisImageWSP image)
void KisPainter::setPaintOpPreset(KisPaintOpPresetSP preset, KisNodeSP node, KisImageSP image)
{
d->paintOpPreset = preset;
KisPaintOp *paintop = KisPaintOpRegistry::instance()->paintOp(preset, this, image);
KisPaintOp *paintop = KisPaintOpRegistry::instance()->paintOp(preset, this, node, image);
Q_ASSERT(paintop);
if (paintop) {
delete d->paintOp;
......
......@@ -582,7 +582,7 @@ public:
* Some paintops really want to know about the image they work
* for, e.g. the clone paintop.
*/
void setPaintOpPreset(KisPaintOpPresetSP preset, KisImageWSP image);
void setPaintOpPreset(KisPaintOpPresetSP preset, KisNodeSP node, KisImageSP image);
/// Return the paintop preset
KisPaintOpPresetSP preset() const;
......
......@@ -287,10 +287,8 @@ void KisRecordedPaintAction::play(KisNodeSP node, const KisPlayInfo& info, KoUpd
painter->setPaintColor(d->foregroundColor);
painter->setBackgroundColor(d->backgroundColor);
if (d->paintOpPreset)
{
d->paintOpPreset->settings()->setNode(node);
painter->setPaintOpPreset(d->paintOpPreset, info.image());
if (d->paintOpPreset) {
painter->setPaintOpPreset(d->paintOpPreset, node, info.image());
}
painter->setStrokeStyle(d->strokeStyle);
......@@ -320,9 +318,6 @@ void KisRecordedPaintAction::play(KisNodeSP node, const KisPlayInfo& info, KoUpd
}
delete painter;
if (d->paintOpPreset)
d->paintOpPreset->settings()->setNode(0);
transaction.commit(info.undoAdapter());
}
......
......@@ -37,10 +37,11 @@
#include <kis_pressure_opacity_option.h>
KisChalkPaintOp::KisChalkPaintOp(const KisChalkPaintOpSettings *settings, KisPainter * painter, KisImageWSP image)
KisChalkPaintOp::KisChalkPaintOp(const KisChalkPaintOpSettings *settings, KisPainter * painter, KisNodeSP node, KisImageSP image)
: KisPaintOp(painter)
{
Q_UNUSED(image);
Q_UNUSED(node);
m_opacityOption.readOptionSetting(settings);
m_opacityOption.resetAllSensors();
......
......@@ -33,7 +33,7 @@ class KisChalkPaintOp : public KisPaintOp
public:
KisChalkPaintOp(const KisChalkPaintOpSettings *settings, KisPainter * painter, KisImageWSP image);
KisChalkPaintOp(const KisChalkPaintOpSettings *settings, KisPainter * painter, KisNodeSP node, KisImageSP image);
virtual ~KisChalkPaintOp();
KisSpacingInformation paintAt(const KisPaintInformation& info);
......
......@@ -37,7 +37,7 @@
#include <kis_fixed_paint_device.h>
KisColorSmudgeOp::KisColorSmudgeOp(const KisBrushBasedPaintOpSettings* settings, KisPainter* painter, KisImageWSP image):
KisColorSmudgeOp::KisColorSmudgeOp(const KisBrushBasedPaintOpSettings* settings, KisPainter* painter, KisNodeSP node, KisImageSP image):
KisBrushBasedPaintOp(settings, painter),
m_firstRun(true), m_image(image),
m_tempDev(painter->device()->createCompositionSourceDevice()),
......@@ -48,6 +48,8 @@ KisColorSmudgeOp::KisColorSmudgeOp(const KisBrushBasedPaintOpSettings* settings,
m_colorRateOption("ColorRate"),
m_smudgeRadiusOption("SmudgeRadius")
{
Q_UNUSED(node);
Q_ASSERT(settings);
Q_ASSERT(painter);
......
......@@ -43,7 +43,7 @@ class KisPainter;
class KisColorSmudgeOp: public KisBrushBasedPaintOp
{
public:
KisColorSmudgeOp(const KisBrushBasedPaintOpSettings* settings, KisPainter* painter, KisImageWSP image);
KisColorSmudgeOp(const KisBrushBasedPaintOpSettings* settings, KisPainter* painter, KisNodeSP node, KisImageSP image);
virtual ~KisColorSmudgeOp();
KisSpacingInformation paintAt(const KisPaintInformation& info);
......
......@@ -29,11 +29,12 @@
#include "kis_painter.h"
#include "kis_types.h"
KisCurvePaintOp::KisCurvePaintOp(const KisCurvePaintOpSettings *settings, KisPainter * painter, KisImageWSP image)
KisCurvePaintOp::KisCurvePaintOp(const KisCurvePaintOpSettings *settings, KisPainter * painter, KisNodeSP node, KisImageSP image)
: KisPaintOp(painter), m_painter(0)
{
Q_ASSERT(settings);
Q_UNUSED(image);
Q_UNUSED(node);
m_curveProperties.readOptionSetting(settings);
m_opacityOption.readOptionSetting(settings);
......
......@@ -34,7 +34,7 @@ class KisCurvePaintOp : public KisPaintOp
{
public:
KisCurvePaintOp(const KisCurvePaintOpSettings *settings, KisPainter * painter, KisImageWSP image);
KisCurvePaintOp(const KisCurvePaintOpSettings *settings, KisPainter * painter, KisNodeSP node, KisImageSP image);
virtual ~KisCurvePaintOp();
KisSpacingInformation paintAt(const KisPaintInformation& info);
......
......@@ -11,7 +11,6 @@ set(kritadefaultpaintops_PART_SRCS
brush/kis_brushop.cpp
brush/kis_brushop_settings_widget.cpp
duplicate/kis_duplicateop.cpp
duplicate/kis_duplicateop_factory.cpp
duplicate/kis_duplicateop_settings.cpp
duplicate/kis_duplicateop_settings_widget.cpp
duplicate/kis_duplicateop_option.cpp
......
......@@ -41,8 +41,8 @@
#include <kis_pressure_sharpness_option.h>
#include <kis_fixed_paint_device.h>
KisBrushOp::KisBrushOp(const KisBrushBasedPaintOpSettings *settings, KisPainter *painter, KisImageWSP image)
: KisBrushBasedPaintOp(settings, painter), m_opacityOption(settings->node()), m_hsvTransformation(0)
KisBrushOp::KisBrushOp(const KisBrushBasedPaintOpSettings *settings, KisPainter *painter, KisNodeSP node, KisImageSP image)
: KisBrushBasedPaintOp(settings, painter), m_opacityOption(node), m_hsvTransformation(0)
{
Q_UNUSED(image);
Q_ASSERT(settings);
......
......@@ -51,7 +51,7 @@ class KisBrushOp : public KisBrushBasedPaintOp
public:
KisBrushOp(const KisBrushBasedPaintOpSettings *settings, KisPainter * painter, KisImageWSP image);
KisBrushOp(const KisBrushBasedPaintOpSettings *settings, KisPainter * painter, KisNodeSP node, KisImageSP image);
~KisBrushOp();
KisSpacingInformation paintAt(const KisPaintInformation& info);
......
......@@ -29,7 +29,8 @@
#include "kis_simple_paintop_factory.h"
#include "kis_brushop.h"
#include "kis_brushop_settings_widget.h"
#include "kis_duplicateop_factory.h"
#include "kis_duplicateop.h"
#include "kis_duplicateop_settings.h"
#include "kis_global.h"
#include "kis_paintop_registry.h"
#include "kis_brush_based_paintop_settings.h"
......@@ -44,7 +45,7 @@ DefaultPaintOpsPlugin::DefaultPaintOpsPlugin(QObject *parent, const QVariantList
{
KisPaintOpRegistry *r = KisPaintOpRegistry::instance();
r->add(new KisSimplePaintOpFactory<KisBrushOp, KisBrushBasedPaintOpSettings, KisBrushOpSettingsWidget>("paintbrush", i18n("Pixel"), KisPaintOpFactory::categoryStable(), "krita-paintbrush.png", QString(), QStringList(), 1));
r->add(new KisDuplicateOpFactory);
r->add(new KisSimplePaintOpFactory<KisDuplicateOp, KisDuplicateOpSettings, KisDuplicateOpSettingsWidget>("duplicate", i18nc("clone paintbrush (previously \"Duplicate\")", "Clone"), KisPaintOpFactory::categoryStable(), "krita-duplicate.png", QString(), QStringList(COMPOSITE_COPY), 15));
QStringList whiteList;
whiteList << COMPOSITE_COPY;
KisBrushServer::instance();
......
......@@ -66,9 +66,10 @@
#include "kis_duplicateop_settings_widget.h"
#include "kis_duplicateop_option.h"
KisDuplicateOp::KisDuplicateOp(KisImageWSP image, const KisDuplicateOpSettings *settings, KisPainter *painter)
KisDuplicateOp::KisDuplicateOp(const KisDuplicateOpSettings *settings, KisPainter *painter, KisNodeSP node, KisImageSP image)
: KisBrushBasedPaintOp(settings, painter)
, m_image(image)
, m_node(node)
, m_settings(settings)
{
Q_ASSERT(settings);
......@@ -88,7 +89,6 @@ KisDuplicateOp::~KisDuplicateOp()
#define CLAMP(x,l,u) ((x)<(l)?(l):((x)>(u)?(u):(x)))
KisSpacingInformation KisDuplicateOp::paintAt(const KisPaintInformation& info)
{
if (!painter()->device()) return 1.0;
......@@ -111,7 +111,7 @@ KisSpacingInformation KisDuplicateOp::paintAt(const KisPaintInformation& info)
realSourceDevice = m_image->projection();
}
else {
realSourceDevice = m_settings->node()->projection();
realSourceDevice = m_node->projection();
}
qreal scale = m_sizeOption.apply(info);
......
......@@ -45,7 +45,7 @@ class KisDuplicateOp : public KisBrushBasedPaintOp
public:
KisDuplicateOp(KisImageWSP image, const KisDuplicateOpSettings *m_settings, KisPainter * painter);
KisDuplicateOp(const KisDuplicateOpSettings *m_settings, KisPainter * painter, KisNodeSP node, KisImageSP image);
~KisDuplicateOp();
KisSpacingInformation paintAt(const KisPaintInformation& info);
......@@ -56,7 +56,9 @@ private:
private:
KisImageWSP m_image;
KisImageSP m_image;
KisNodeSP m_node;
const KisDuplicateOpSettings * m_settings;
KisPaintDeviceSP m_srcdev;
KisPaintDeviceSP m_target;
......
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004-2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2004 Clarence Dang <dang@kde.org>
* Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_duplicateop_factory.h"
#include <KoInputDevice.h>
#include <KoCompositeOpRegistry.h>
#include <kis_painter.h>
#include <kis_paintop_settings.h>
#include <kis_image.h>
#include "kis_duplicateop_settings_widget.h"
#include "kis_duplicateop_settings.h"
#include "kis_duplicateop.h"
KisDuplicateOpFactory::KisDuplicateOpFactory()
: KisPaintOpFactory(QStringList(COMPOSITE_COPY))
{
setPriority(15);
}
KisDuplicateOpFactory::~KisDuplicateOpFactory()
{
}
KisPaintOp * KisDuplicateOpFactory::createOp(const KisPaintOpSettingsSP settings,
KisPainter * painter,
KisImageWSP image)
{
const KisDuplicateOpSettings *duplicateopSettings = dynamic_cast<const KisDuplicateOpSettings *>(settings.data());
Q_ASSERT(settings != 0 && duplicateopSettings != 0);
KisPaintOp * op = new KisDuplicateOp(image, duplicateopSettings, painter);
Q_CHECK_PTR(op);
return op;
}
KisPaintOpSettingsSP KisDuplicateOpFactory::settings()
{
return new KisDuplicateOpSettings();
}
KisPaintOpSettingsWidget* KisDuplicateOpFactory::createSettingsWidget(QWidget* parent)
{
return new KisDuplicateOpSettingsWidget(parent);
}
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004-2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2004 Clarence Dang <dang@kde.org>
* Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DUPLICATEOP_FACTORY_H_
#define KIS_DUPLICATEOP_FACTORY_H_
#include <kis_paintop_factory.h>
#include <kis_types.h>
#include <klocale.h>
#include <QString>
class KisPaintOp;
class KisPainter;
class QWidget;
class KoInputDevice;
class KisDuplicateOpFactory : public KisPaintOpFactory
{
public:
KisDuplicateOpFactory();
virtual ~KisDuplicateOpFactory();
virtual KisPaintOp * createOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisImageWSP image);
virtual QString id() const {
return "duplicate";
}
virtual QString name() const {
return i18nc("clone paintbrush (previously \"Duplicate\")", "Clone");
}
virtual QString pixmap() {
return "krita-duplicate.png";
}
virtual QString category() const {
return KisPaintOpFactory::categoryStable();
}
virtual KisPaintOpSettingsSP settings();
virtual KisPaintOpSettingsWidget* createSettingsWidget(QWidget* parent);
};
#endif // KIS_DUPLICATEOP_FACTORY_H_
......@@ -72,10 +72,6 @@ bool KisDuplicateOpSettings::mousePressEvent(const KisPaintInformation &info, Qt
{
bool ignoreEvent = true;
if (m_activeNode && modifiers == (Qt::ControlModifier | Qt::AltModifier)) {
KisPaintOpSettings::setNode(m_activeNode);
}
if (modifiers == Qt::ControlModifier) {
m_position = info.pos();
m_isOffsetNotUptodate = true;
......@@ -158,12 +154,3 @@ QPainterPath KisDuplicateOpSettings::brushOutline(const KisPaintInformation &inf
return path;
}
void KisDuplicateOpSettings::setNode(KisNodeSP node)
{
// Only pass the node to the base class when it's the first time it's called
if (!KisPaintOpSettings::node()) {
KisPaintOpSettings::setNode(node);
}
m_activeNode = node;
}
......@@ -54,15 +54,8 @@ public:
KisPaintOpSettingsSP clone() const;
QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) const;
// hijack the setNode of the KisPaintopSettings class. We want to be able to
// switch nodes to duplicated onto a new layer without starting to clone from
// the new layer; only if the user ctrl-shift-clicks, we start cloning from the
// currently selected layer.
virtual void setNode(KisNodeSP node);
public:
KisNodeSP m_activeNode;
QPointF m_offset;
bool m_isOffsetNotUptodate;
QPointF m_position; // Give the position of the last alt-click
......
......@@ -3,7 +3,6 @@ set(kritadeformpaintop_PART_SRCS
deform_paintop_plugin.cpp
kis_deform_paintop.cpp
kis_deform_paintop_settings.cpp
kis_deform_paintop_factory.cpp
kis_deform_option.cpp
kis_deform_paintop_settings_widget.cpp
)
......
......@@ -22,11 +22,14 @@
#include <kis_debug.h>
#include <kpluginfactory.h>
#include <KoCompositeOpRegistry.h>
#include <kis_paintop_registry.h>
#include "kis_deform_paintop.h"
#include "kis_deform_paintop_factory.h"
#include "kis_global.h"
#include "kis_simple_paintop_factory.h"
#include "kis_deform_paintop_settings_widget.h"
K_PLUGIN_FACTORY(DeformPaintOpPluginFactory, registerPlugin<DeformPaintOpPlugin>();)
K_EXPORT_PLUGIN(DeformPaintOpPluginFactory("krita"))
......@@ -36,8 +39,7 @@ DeformPaintOpPlugin::DeformPaintOpPlugin(QObject *parent, const QVariantList &)
: QObject(parent)
{
KisPaintOpRegistry *r = KisPaintOpRegistry::instance();
r->add(new KisDeformPaintOpFactory);
r->add(new KisSimplePaintOpFactory<KisDeformPaintOp, KisDeformPaintOpSettings, KisDeformPaintOpSettingsWidget>("deformbrush", i18n("Deform"), KisPaintOpFactory::categoryStable(), "krita-deform.png", QString(), QStringList(COMPOSITE_COPY), 16));
}
DeformPaintOpPlugin::~DeformPaintOpPlugin()
......
......@@ -49,10 +49,11 @@
#define drand48() (static_cast<double>(qrand()) / static_cast<double>(RAND_MAX))
#endif
KisDeformPaintOp::KisDeformPaintOp(const KisDeformPaintOpSettings *settings, KisPainter * painter, KisImageWSP image)
KisDeformPaintOp::KisDeformPaintOp(const KisDeformPaintOpSettings *settings, KisPainter * painter, KisNodeSP node, KisImageSP image)
: KisPaintOp(painter)
{
Q_UNUSED(image);
Q_UNUSED(node);
Q_ASSERT(settings);
m_sizeProperties.readOptionSetting(settings);
......
......@@ -38,7 +38,7 @@ class KisDeformPaintOp : public KisPaintOp
{
public:
KisDeformPaintOp(const KisDeformPaintOpSettings *settings, KisPainter * painter, KisImageWSP image);
KisDeformPaintOp(const KisDeformPaintOpSettings *settings, KisPainter * painter, KisNodeSP node, KisImageSP image);
virtual ~KisDeformPaintOp();
KisSpacingInformation paintAt(const KisPaintInformation& info);
......
/*
* Copyright (c) 2008 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_deform_paintop_factory.h"
#include <kis_painter.h>
#include <kis_paintop_settings.h>
#include <kis_image.h>
#include <KoInputDevice.h>
#include <KoCompositeOpRegistry.h>
#include "kis_deform_paintop_settings_widget.h"
#include "kis_deform_paintop_settings.h"
#include "kis_deform_paintop.h"
KisDeformPaintOpFactory::KisDeformPaintOpFactory()
: KisPaintOpFactory(QStringList(COMPOSITE_COPY))
{
setPriority(16);
}
KisPaintOp * KisDeformPaintOpFactory::createOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisImageWSP image = 0)
{