Commit 15cf5d66 authored by Boudewijn Rempt's avatar Boudewijn Rempt

autumn cleaning

Apply kdelibs' astyle to all of krita. We've got enough variation
in spaces around * and & anyway.

svn path=/trunk/koffice/; revision=1038712
parent e4bb2919
......@@ -19,7 +19,7 @@
/**
@mainpage Brush Engine API
All brush engines in Krita are plugins. The classes in this directory define
All brush engines in Krita are plugins. The classes in this directory define
the way brush engines are to be implemented. Brush engines are also known as paintops.
KisPaintInformation Information about the painting stroke
......@@ -33,7 +33,7 @@ KisPaintOpSettings A KisPropertiesConfiguration subclass that stores th
KisPaintOpSettingsWidget A KisConfigWidget that knows how to display and edit the KisPaintopSettings
These classes are used in the Krita core to handle painting: a further set
of utility classes for brush engine implementators is available in
of utility classes for brush engine implementators is available in
krita/plugins/paintops/libpaintop.
......
......@@ -33,11 +33,11 @@ struct KisPaintInformation::Private {
};
KisPaintInformation::KisPaintInformation(const QPointF & pos_, double pressure_,
double xTilt_, double yTilt_,
const KisVector2D& movement_,
double rotation_,
double tangentialPressure_)
: d(new Private)
double xTilt_, double yTilt_,
const KisVector2D& movement_,
double rotation_,
double tangentialPressure_)
: d(new Private)
{
d->pos = pos_;
d->pressure = pressure_;
......
......@@ -60,9 +60,9 @@ public:
*/
KisPaintInformation(const QPointF & pos = QPointF(),
double pressure = PRESSURE_DEFAULT,
double pressure = PRESSURE_DEFAULT,
double xTilt = 0.0,
double yTilt = 0.0,
double yTilt = 0.0,
const KisVector2D& movement = nullKisVector2D(),
double rotation = 0.0,
double tangentialPressure = 0.0
......
......@@ -49,8 +49,7 @@
struct KisPaintOp::Private {
Private()
: dab(0)
{
: dab(0) {
}
KisFixedPaintDeviceSP dab;
......@@ -168,8 +167,8 @@ double KisPaintOp::paintLine(const KisPaintInformation &pi1,
double ySpacing = 1.0;
double sp = spacing(xSpacing, ySpacing, pi1.pressure(), pi2.pressure());
Q_ASSERT( xSpacing >= 0.0);
Q_ASSERT( ySpacing >= 0.0);
Q_ASSERT(xSpacing >= 0.0);
Q_ASSERT(ySpacing >= 0.0);
KisVector2D scale(1, 1);
......
......@@ -86,7 +86,7 @@ void KisPaintOpPreset::setSettings(KisPaintOpSettingsSP settings)
{
Q_ASSERT(!settings->getString("paintop", "").isEmpty());
m_d->settings = settings->clone();
setValid( true );
setValid(true);
}
KisPaintOpSettingsSP KisPaintOpPreset::settings() const
......@@ -105,7 +105,7 @@ bool KisPaintOpPreset::load()
QDomDocument doc;
if (!f.open(QIODevice::ReadOnly))
return false;
return false;
if (!doc.setContent(&f)) {
f.close();
return false;
......@@ -115,16 +115,16 @@ bool KisPaintOpPreset::load()
QDomElement element = doc.documentElement();
QString paintopid = element.attribute("paintopid");
if( paintopid.isEmpty() )
if (paintopid.isEmpty())
return false;
KoID id(paintopid, "");
KoInputDevice input = KoInputDevice::mouse(); // TODO: Load inputdevice?
KisPaintOpSettingsSP settings = KisPaintOpRegistry::instance()->settings(id, input, 0);
if( !settings )
if (!settings)
return false;
settings->fromXML( element );
settings->fromXML(element);
setSettings(settings);
updateImg();
......@@ -143,7 +143,7 @@ bool KisPaintOpPreset::save()
QDomElement root = doc.createElement("preset");
QString paintopid = m_d->settings->getString("paintop", "");
if( paintopid.isEmpty() )
if (paintopid.isEmpty())
return false;
root.setAttribute("paintopid", paintopid);
......@@ -164,6 +164,6 @@ QImage KisPaintOpPreset::img() const
void KisPaintOpPreset::updateImg()
{
m_d->img = m_d->settings->sampleStroke( QSize( 100, 20 ) );
m_d->img = m_d->settings->sampleStroke(QSize(100, 20));
}
......@@ -57,7 +57,7 @@ KisPaintOpRegistry* KisPaintOpRegistry::instance()
K_GLOBAL_STATIC(KisPaintOpRegistry, s_instance);
if (!s_instance.exists()) {
KoPluginLoader::instance()->load("Krita/Paintop", "(Type == 'Service') and ([X-Krita-Version] == 3)");
}
return s_instance;
}
......@@ -73,7 +73,7 @@ KisPaintOp * KisPaintOpRegistry::paintOp(const QString & id, const KisPaintOpSet
painter->setBounds(image->bounds());
}
Q_ASSERT( settings );
Q_ASSERT(settings);
KisPaintOpFactory* f = value(id);
if (f) {
......@@ -84,8 +84,8 @@ KisPaintOp * KisPaintOpRegistry::paintOp(const QString & id, const KisPaintOpSet
KisPaintOp * KisPaintOpRegistry::paintOp(const KisPaintOpPresetSP preset, KisPainter * painter, KisImageWSP image) const
{
Q_ASSERT( preset );
Q_ASSERT( painter );
Q_ASSERT(preset);
Q_ASSERT(painter);
if (!preset) return 0;
......
......@@ -79,7 +79,7 @@ public:
static KisPaintOpRegistry* instance();
private:
KisPaintOpRegistry();
KisPaintOpRegistry(const KisPaintOpRegistry&);
KisPaintOpRegistry operator=(const KisPaintOpRegistry&);
......
......@@ -43,7 +43,7 @@ struct KisPaintOpSettings::Private {
};
KisPaintOpSettings::KisPaintOpSettings()
: d(new Private)
: d(new Private)
{
}
......@@ -71,7 +71,7 @@ KisNodeSP KisPaintOpSettings::node() const
return d->node;
}
QImage KisPaintOpSettings::sampleStroke(const QSize& size )
QImage KisPaintOpSettings::sampleStroke(const QSize& size)
{
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
int width = size.width();
......@@ -80,30 +80,30 @@ QImage KisPaintOpSettings::sampleStroke(const QSize& size )
KisLayerSP layer = new KisPaintLayer(0, "temporary for stroke sample", OPACITY_OPAQUE, cs);
KisImageSP image = new KisImage(0, width, height, cs, "stroke sample image", false);
KisPainter painter(layer->paintDevice());
painter.setPaintColor(KoColor(Qt::black, cs) );
painter.setPaintColor(KoColor(Qt::black, cs));
KisPaintOpPresetSP preset = new KisPaintOpPreset();
preset->setSettings( this ); // This clones
preset->settings()->setNode( layer );
preset->setSettings(this); // This clones
preset->settings()->setNode(layer);
painter.setPaintOpPreset(preset, image);
QPointF p1(0 , 7.0/12.0 * height);
QPointF p2(1.0/2.0 * width , 7.0/12.0 * height);
QPointF p3( width - 4.0, height - 4.0);
QPointF p1(0 , 7.0 / 12.0 * height);
QPointF p2(1.0 / 2.0 * width , 7.0 / 12.0 * height);
QPointF p3(width - 4.0, height - 4.0);
KisPaintInformation pi1(p1, 0.0);
KisPaintInformation pi2(p2, 0.95);
KisPaintInformation pi3(p3, 0.0);
QPointF c1( 1.0/4.0* width , height - 2.0);
QPointF c1(1.0 / 4.0* width , height - 2.0);
QPointF c2(c1);
painter.paintBezierCurve(pi1, c1, c2, pi2, 0);
c1.setX( 3.0/4.0 * width);
c1.setY( 0);
c2.setX( c1.x() );
c2.setY( c1.y() );
c1.setX(3.0 / 4.0 * width);
c1.setY(0);
c2.setX(c1.x());
c2.setY(c1.y());
painter.paintBezierCurve(pi2, c1, c2, pi3, 0);
return layer->paintDevice()->convertToQImage(0);
......
......@@ -103,19 +103,21 @@ public:
* @return true if we paint incrementally, false if we paint like Photoshop. By default, paintops
* do not support non-incremental.
*/
virtual bool paintIncremental() { return true; }
virtual bool paintIncremental() {
return true;
}
/**
* @return a sample stroke that fits in @param size.
*/
QImage sampleStroke(const QSize& size );
QImage sampleStroke(const QSize& size);
/**
* This enum defines the current mode for painting an outline.
*/
enum OutlineMode {
CURSOR_IS_OUTLINE = 1, ///< When this mode is set, then the outline is supposed to paint an outline around the cursor
CURSOR_ISNT_OUTLINE = 2 ///< When this mode is set, then the outline is no supposed to paint an outline for the cursor (useful for instance in the duplicate op to show the source)
CURSOR_IS_OUTLINE = 1, ///< When this mode is set, then the outline is supposed to paint an outline around the cursor
CURSOR_ISNT_OUTLINE = 2 ///< When this mode is set, then the outline is no supposed to paint an outline for the cursor (useful for instance in the duplicate op to show the source)
};
/**
* @return the rectangle covered by the current brush (or the previous brush??? and what about pressure???)
......@@ -144,7 +146,7 @@ public:
private:
struct Private;
Private* const d;
Private* const d;
};
......
......@@ -33,23 +33,20 @@ class KRITAIMAGE_EXPORT KisPaintOpSettingsWidget : public KisConfigWidget
public:
KisPaintOpSettingsWidget( QWidget * parent = 0, Qt::WFlags f = 0 )
: KisConfigWidget( parent, f )
{
KisPaintOpSettingsWidget(QWidget * parent = 0, Qt::WFlags f = 0)
: KisConfigWidget(parent, f) {
}
virtual ~KisPaintOpSettingsWidget()
{
virtual ~KisPaintOpSettingsWidget() {
}
/**
* Write the settings in this widget to the given properties
* configuration, which is cleared first.
*/
virtual void writeConfiguration( KisPropertiesConfiguration *config ) const = 0;
virtual void writeConfiguration(KisPropertiesConfiguration *config) const = 0;
virtual void setImage( KisImageWSP image )
{
virtual void setImage(KisImageWSP image) {
m_image = image;
}
......
......@@ -64,4 +64,4 @@ private:
QString m_before;
QString m_after;
};
#endif
#endif
......@@ -45,4 +45,4 @@ private:
KisSelectionSP m_newSelection;
KisSelectionSP m_oldDeselectedSelection;
};
#endif
#endif
......@@ -34,15 +34,15 @@
#include "kis_undo_adapter.h"
KisImageLayerAddCommand::KisImageLayerAddCommand(KisImageWSP image, KisNodeSP layer, KisNodeSP parent, KisNodeSP aboveThis)
: KisImageCommand(i18n("Add Layer"), image), m_index( -1 )
: KisImageCommand(i18n("Add Layer"), image), m_index(-1)
{
m_layer = layer;
m_parent = parent;
m_aboveThis = aboveThis;
}
KisImageLayerAddCommand::KisImageLayerAddCommand(KisImageWSP image, KisNodeSP layer, KisNodeSP parent, quint32 index )
: KisImageCommand(i18n("Add Layer"), image), m_index( index )
KisImageLayerAddCommand::KisImageLayerAddCommand(KisImageWSP image, KisNodeSP layer, KisNodeSP parent, quint32 index)
: KisImageCommand(i18n("Add Layer"), image), m_index(index)
{
m_layer = layer;
m_parent = parent;
......@@ -51,8 +51,7 @@ KisImageLayerAddCommand::KisImageLayerAddCommand(KisImageWSP image, KisNodeSP la
void KisImageLayerAddCommand::redo()
{
if( m_aboveThis || m_index == quint32(-1) )
{
if (m_aboveThis || m_index == quint32(-1)) {
m_image->addNode(m_layer, m_parent, m_aboveThis);
} else {
m_image->addNode(m_layer, m_parent, m_index);
......
......@@ -44,7 +44,7 @@ public:
* @param layer the layer to add
*/
KisImageLayerAddCommand(KisImageWSP image, KisNodeSP layer, KisNodeSP parent, KisNodeSP aboveThis);
KisImageLayerAddCommand(KisImageWSP image, KisNodeSP layer, KisNodeSP parent, quint32 index );