Commit 280a76ea authored by Boudewijn Rempt's avatar Boudewijn Rempt

Merge remote-tracking branch 'origin' into rempt/T379-resource-management

parents 465f6e9e da3cca7e
......@@ -518,7 +518,7 @@ set_package_properties(GIF PROPERTIES
TYPE OPTIONAL
PURPOSE "Required by the Krita GIF filter")
find_package(HEIF "1.2.0")
find_package(HEIF "1.3.0")
set_package_properties(HEIF PROPERTIES
DESCRIPTION "Library for loading and saving heif files."
URL "https://github.com/strukturag/libheif"
......
......@@ -23,5 +23,8 @@ kundo2_aware_xgettext krita.pot i18ndata rc.cpp \
`find . -name \*.cc -o -name \*.h -o -name \*.cpp | \
grep -v '/tests/' | grep -v './sdk/templates' | grep -v './krita/crashreporter/'`
# Extract the messages in Python plugins.
$XGETTEXT -L Python `find . -name \*.py` -j -o $podir/krita.pot
# Clean up
rm -f i18ndata rc.cpp
......@@ -11,7 +11,7 @@ This repository contains the current, Qt5-based, development version of Krita 3.
### User Manual
https://docs.krita.org/Category:User_Manual
https://docs.krita.org/en/user_manual.html
### Development Notes and Build Instructions
If you're building on Windows or OSX you'll need to build some third-party dependencies first. You should look at the README in the 3rdparty folder for directions.
......
......@@ -26,7 +26,7 @@ PyQt,https://www.riverbankcomputing.com/software/pyqt/download5,GPLv3
Python,http://www.python.org,Python Software Foundation License v2
Qt,https://www.qt.io,GPLv2 + GPLv3 + LGPLv2.1 + LGPLv3
SIP,https://www.riverbankcomputing.com/software/sip/download,GPLv3
libiff,http://www.remotesensing.org/libtiff,BSD
libtiff,http://libtiff.org/,BSD
Vc,https://github.com/VcDevel/Vc,BSD
zlib,http://www.zlib.net/,BSD
KDE Frameworks 5,https://www.kde.org,LGPLv+
......@@ -4,7 +4,7 @@
<text>Interaction Tool</text>
<Action name="object_order_raise">
<iconText>Raise</iconText>
<shortcut>Ctrl+]</shortcut>
<shortcut>Ctrl+Alt+]</shortcut>
<toolTip>Raise</toolTip>
<icon>object-order-raise-calligra</icon>
<whatsThis></whatsThis>
......@@ -104,7 +104,7 @@
</Action>
<Action name="object_order_lower">
<iconText>Lower</iconText>
<shortcut>Ctrl+[</shortcut>
<shortcut>Ctrl+Alt+[</shortcut>
<toolTip>Lower</toolTip>
<icon>object-order-lower-calligra</icon>
<whatsThis></whatsThis>
......
......@@ -1310,10 +1310,10 @@
</Action>
<Action name="KritaShape/KisToolLazyBrush">
<icon></icon>
<text>Lazy Brush Tool</text>
<text>Colorize Mask Tool</text>
<whatsThis></whatsThis>
<toolTip>Lazy Brush Tool</toolTip>
<iconText>Lazy Brush Tool</iconText>
<toolTip>Colorize Mask Tool</toolTip>
<iconText>Colorize Mask Tool</iconText>
<shortcut></shortcut>
<statusTip></statusTip>
</Action>
......
......@@ -49,6 +49,7 @@
#include "KisApplicationArguments.h"
#include <opengl/kis_opengl.h>
#include "input/KisQtWidgetsTweaker.h"
#include <kis_debug.h>
#if defined Q_OS_WIN
#include <windows.h>
......@@ -111,11 +112,11 @@ void resetRotation()
pSetDisplayAutoRotationPreferences_t pSetDisplayAutoRotationPreferences
= reinterpret_cast<pSetDisplayAutoRotationPreferences_t>(user32Lib.resolve("SetDisplayAutoRotationPreferences"));
if (!pSetDisplayAutoRotationPreferences) {
qDebug() << "Failed to load function SetDisplayAutoRotationPreferences";
dbgKrita << "Failed to load function SetDisplayAutoRotationPreferences";
return;
}
bool result = pSetDisplayAutoRotationPreferences(ORIENTATION_PREFERENCE_NONE);
qDebug() << "SetDisplayAutoRotationPreferences(ORIENTATION_PREFERENCE_NONE) returned" << result;
dbgKrita << "SetDisplayAutoRotationPreferences(ORIENTATION_PREFERENCE_NONE) returned" << result;
}
} // namespace
#endif
......@@ -215,12 +216,12 @@ extern "C" int main(int argc, char **argv)
qputenv("XDG_DATA_DIRS", QFile::encodeName(root + "share"));
#endif
qDebug() << "Setting XDG_DATA_DIRS" << qgetenv("XDG_DATA_DIRS");
dbgKrita << "Setting XDG_DATA_DIRS" << qgetenv("XDG_DATA_DIRS");
// Now that the paths are set, set the language. First check the override from the language
// selection dialog.
qDebug() << "Override language:" << language;
dbgKrita << "Override language:" << language;
if (!language.isEmpty()) {
KLocalizedString::setLanguages(language.split(":"));
......@@ -248,7 +249,7 @@ extern "C" int main(int argc, char **argv)
i++;
}
}
qDebug() << "Setting Krita's language to:" << uiLanguages;
dbgKrita << "Setting Krita's language to:" << uiLanguages;
qputenv("LANG", uiLanguages.first().toLocal8Bit());
KLocalizedString::setLanguages(uiLanguages);
}
......@@ -258,9 +259,9 @@ extern "C" int main(int argc, char **argv)
KisApplication app(key, argc, argv);
KLocalizedString::setApplicationDomain("krita");
qDebug() << "Available translations" << KLocalizedString::availableApplicationTranslations();
qDebug() << "Available domain translations" << KLocalizedString::availableDomainTranslations("krita");
qDebug() << "Qt UI languages" << QLocale::system().uiLanguages() << qgetenv("LANG");
dbgKrita << "Available translations" << KLocalizedString::availableApplicationTranslations();
dbgKrita << "Available domain translations" << KLocalizedString::availableDomainTranslations("krita");
dbgKrita << "Qt UI languages" << QLocale::system().uiLanguages() << qgetenv("LANG");
#ifdef Q_OS_WIN
......@@ -272,7 +273,7 @@ extern "C" int main(int argc, char **argv)
+ appdir.absolutePath() + ";"
+ path));
qDebug() << "PATH" << qgetenv("PATH");
dbgKrita << "PATH" << qgetenv("PATH");
#endif
if (qApp->applicationDirPath().contains(KRITA_BUILD_DIR)) {
......@@ -368,9 +369,9 @@ extern "C" int main(int argc, char **argv)
if (penFilter->init()) {
// penFilter.registerPointerDeviceNotifications();
app.installNativeEventFilter(penFilter);
qDebug() << "Using Win8 Pointer Input for tablet support";
dbgKrita << "Using Win8 Pointer Input for tablet support";
} else {
qDebug() << "No Win8 Pointer Input available";
dbgKrita << "No Win8 Pointer Input available";
delete penFilter;
}
}
......
......@@ -7,6 +7,7 @@
<developer_name>Krita Foundation</developer_name>
<developer_name xml:lang="ca">Fundació Krita</developer_name>
<developer_name xml:lang="ca-valencia">Fundació Krita</developer_name>
<developer_name xml:lang="cs">Krita Foundation</developer_name>
<developer_name xml:lang="es">Fundación Krita</developer_name>
<developer_name xml:lang="it">Fondazione Krita</developer_name>
<developer_name xml:lang="nl">Krita Foundation</developer_name>
......
......@@ -30,7 +30,7 @@ KoPathToolFactory::KoPathToolFactory()
setToolTip(i18n("Edit Shapes Tool"));
setSection(mainToolType());
setIconName(koIconNameCStr("shape_handling"));
setPriority(1);
setPriority(2);
setActivationShapeId("flake/always,KoPathShape");
}
......
......@@ -21,6 +21,8 @@
#include "kis_circle_mask_generator.h"
#include "kis_circle_mask_generator_p.h"
#include "kis_gauss_circle_mask_generator_p.h"
#include "kis_curve_circle_mask_generator_p.h"
#include "kis_brush_mask_applicators.h"
#include "kis_brush_mask_applicator_base.h"
......@@ -51,6 +53,16 @@ MaskApplicatorFactory<KisGaussCircleMaskGenerator, KisBrushMaskVectorApplicator>
return new KisBrushMaskVectorApplicator<KisGaussCircleMaskGenerator,Vc::CurrentImplementation::current()>(maskGenerator);
}
template<>
template<>
MaskApplicatorFactory<KisCurveCircleMaskGenerator, KisBrushMaskVectorApplicator>::ReturnType
MaskApplicatorFactory<KisCurveCircleMaskGenerator, KisBrushMaskVectorApplicator>::create<Vc::CurrentImplementation::current()>(ParamType maskGenerator)
{
return new KisBrushMaskVectorApplicator<KisCurveCircleMaskGenerator,Vc::CurrentImplementation::current()>(maskGenerator);
}
#if defined HAVE_VC
struct KisCircleMaskGenerator::FastRowProcessor
......@@ -247,4 +259,120 @@ FastRowProcessor::process<Vc::CurrentImplementation::current()>(float* buffer, i
}
}
struct KisCurveCircleMaskGenerator::FastRowProcessor
{
FastRowProcessor(KisCurveCircleMaskGenerator *maskGenerator)
: d(maskGenerator->d.data()) {}
template<Vc::Implementation _impl>
void process(float* buffer, int width, float y, float cosa, float sina,
float centerX, float centerY);
KisCurveCircleMaskGenerator::Private *d;
};
template<> void KisCurveCircleMaskGenerator::
FastRowProcessor::process<Vc::CurrentImplementation::current()>(float* buffer, int width, float y, float cosa, float sina,
float centerX, float centerY)
{
const bool antialiasOn = d->fadeMaker.getAliasingEnabled();
float y_ = y - centerY;
float sinay_ = sina * y_;
float cosay_ = cosa * y_;
float* bufferPointer = buffer;
qreal* curveDataPointer = d->curveData.data();
Vc::float_v currentIndices = Vc::float_v::IndexesFromZero();
Vc::float_v increment((float)Vc::float_v::size());
Vc::float_v vCenterX(centerX);
Vc::float_v vCosa(cosa);
Vc::float_v vSina(sina);
Vc::float_v vCosaY_(cosay_);
Vc::float_v vSinaY_(sinay_);
Vc::float_v vYCoeff(d->ycoef);
Vc::float_v vXCoeff(d->xcoef);
Vc::float_v vCurveResolution(d->curveResolution);
Vc::float_v vCurvedData(Vc::Zero);
Vc::float_v vCurvedData1(Vc::Zero);
Vc::float_v vFadeRadius(d->fadeMaker.getRadius());
Vc::float_v vFadeStartValue(d->fadeMaker.getFadeStartValue());
Vc::float_v vFadeAFadeStart(d->fadeMaker.getAntialiasingFadeStart());
Vc::float_v vFadeAFadeCoeff(d->fadeMaker.getAntialiasingFadeCoeff());
Vc::float_v vOne(Vc::One);
Vc::float_v vZero(Vc::Zero);
Vc::float_v vValMax(255.f);
for (int i=0; i < width; i+= Vc::float_v::size()){
Vc::float_v x_ = currentIndices - vCenterX;
Vc::float_v xr = x_ * vCosa - vSinaY_;
Vc::float_v yr = x_ * vSina + vCosaY_;
Vc::float_v dist = pow2(xr * vXCoeff) + pow2(yr * vYCoeff);
// BEGIN FadeMaker needFade vectorized
// follow fademaker rules for outsideMask
Vc::float_m outsideMask = dist > vFadeRadius;
dist(outsideMask) = vOne;
Vc::float_m fadeStartMask(false);
// if antialias is off, do not process
if(antialiasOn){
fadeStartMask = dist > vFadeAFadeStart;
dist((outsideMask ^ fadeStartMask) & fadeStartMask) = (vFadeStartValue + (dist - vFadeAFadeStart) * vFadeAFadeCoeff) / vValMax;
}
Vc::float_m excludeMask = outsideMask | fadeStartMask;
if (!excludeMask.isFull()) {
Vc::float_v valDist = dist * vCurveResolution;
// truncate
Vc::SimdArray<quint16,Vc::float_v::size()> vAlphaValue(valDist);
Vc::float_v vFloatAlphaValue = vAlphaValue;
Vc::float_v alphaValueF = valDist - vFloatAlphaValue;
vCurvedData.gather(curveDataPointer,vAlphaValue);
vCurvedData1.gather(curveDataPointer,vAlphaValue + 1);
// Vc::float_v vCurvedData1(curveDataPointer,vAlphaValue + 1);
// vAlpha
Vc::float_v fullFade = (
(1.0f - alphaValueF) * vCurvedData +
alphaValueF * vCurvedData1);
Vc::float_m mask;
// Mask in the inner circe of the mask
mask = fullFade < vZero;
fullFade.setZero(mask);
// Mask outer circle of mask
mask = fullFade >= vOne;
Vc::float_v vFade = (1.0f - fullFade);
vFade.setZero(mask);
// return original dist values before vFade transform
vFade(excludeMask) = dist;
vFade.store(bufferPointer, Vc::Aligned);
} else {
dist.store(bufferPointer, Vc::Aligned);
}
currentIndices = currentIndices + increment;
bufferPointer += Vc::float_v::size();
}
}
#endif /* defined HAVE_VC */
......@@ -17,9 +17,27 @@
*/
#include <compositeops/KoVcMultiArchBuildSupport.h> //MSVC requires that Vc come first
#include <cmath>
#include <config-vc.h>
#ifdef HAVE_VC
#if defined(__clang__)
#pragma GCC diagnostic ignored "-Wundef"
#pragma GCC diagnostic ignored "-Wlocal-type-template-args"
#endif
#if defined _MSC_VER
// Lets shut up the "possible loss of data" and "forcing value to bool 'true' or 'false'
#pragma warning ( push )
#pragma warning ( disable : 4244 )
#pragma warning ( disable : 4800 )
#endif
#include <Vc/Vc>
#include <Vc/IO>
#if defined _MSC_VER
#pragma warning ( pop )
#endif
#endif
#include <QDomDocument>
#include <QVector>
#include <QPointF>
......@@ -29,38 +47,13 @@
#include "kis_fast_math.h"
#include "kis_base_mask_generator.h"
#include "kis_curve_circle_mask_generator.h"
#include "kis_cubic_curve.h"
#include "kis_antialiasing_fade_maker.h"
#include "kis_brush_mask_applicator_factories.h"
#include "kis_curve_circle_mask_generator.h"
#include "kis_curve_circle_mask_generator_p.h"
#include "kis_cubic_curve.h"
struct Q_DECL_HIDDEN KisCurveCircleMaskGenerator::Private
{
Private(bool enableAntialiasing)
: fadeMaker(*this, enableAntialiasing)
{
}
Private(const Private &rhs)
: xcoef(rhs.xcoef),
ycoef(rhs.ycoef),
curveResolution(rhs.curveResolution),
curveData(rhs.curveData),
curvePoints(rhs.curvePoints),
dirty(true),
fadeMaker(rhs.fadeMaker,*this)
{
}
qreal xcoef, ycoef;
qreal curveResolution;
QVector<qreal> curveData;
QList<QPointF> curvePoints;
bool dirty;
KisAntialiasingFadeMaker1D<Private> fadeMaker;
inline quint8 value(qreal dist) const;
};
KisCurveCircleMaskGenerator::KisCurveCircleMaskGenerator(qreal diameter, qreal ratio, qreal fh, qreal fv, int spikes, const KisCubicCurve &curve, bool antialiasEdges)
: KisMaskGenerator(diameter, ratio, fh, fv, spikes, antialiasEdges, CIRCLE, SoftId), d(new Private(antialiasEdges))
......@@ -73,12 +66,15 @@ KisCurveCircleMaskGenerator::KisCurveCircleMaskGenerator(qreal diameter, qreal r
d->dirty = false;
setScale(1.0, 1.0);
d->applicator.reset(createOptimizedClass<MaskApplicatorFactory<KisCurveCircleMaskGenerator, KisBrushMaskVectorApplicator> >(this));
}
KisCurveCircleMaskGenerator::KisCurveCircleMaskGenerator(const KisCurveCircleMaskGenerator &rhs)
: KisMaskGenerator(rhs),
d(new Private(*rhs.d))
{
d->applicator.reset(createOptimizedClass<MaskApplicatorFactory<KisCurveCircleMaskGenerator, KisBrushMaskVectorApplicator> >(this));
}
KisCurveCircleMaskGenerator::~KisCurveCircleMaskGenerator()
......@@ -108,6 +104,16 @@ bool KisCurveCircleMaskGenerator::shouldSupersample() const
return effectiveSrcWidth() < 10 || effectiveSrcHeight() < 10;
}
bool KisCurveCircleMaskGenerator::shouldVectorize() const
{
return !shouldSupersample() && spikes() == 2;
}
KisBrushMaskApplicatorBase* KisCurveCircleMaskGenerator::applicator()
{
return d->applicator.data();
}
inline quint8 KisCurveCircleMaskGenerator::Private::value(qreal dist) const
{
qreal distance = dist * curveResolution;
......@@ -118,6 +124,7 @@ inline quint8 KisCurveCircleMaskGenerator::Private::value(qreal dist) const
qreal alpha = (
(1.0 - alphaValueF) * curveData.at(alphaValue) +
alphaValueF * curveData.at(alphaValue+1));
return (1.0 - alpha) * 255;
}
......@@ -178,3 +185,8 @@ void KisCurveCircleMaskGenerator::transformCurveForSoftness(qreal softness,const
KisCubicCurve curve(newList);
result = curve.floatTransfer( curveResolution );
}
void KisCurveCircleMaskGenerator::resetMaskApplicator(bool forceScalar)
{
d->applicator.reset(createOptimizedClass<MaskApplicatorFactory<KisCurveCircleMaskGenerator, KisBrushMaskVectorApplicator> >(this,forceScalar));
}
......@@ -19,11 +19,12 @@
#ifndef _KIS_CURVE_CIRCLE_MASK_GENERATOR_H_
#define _KIS_CURVE_CIRCLE_MASK_GENERATOR_H_
#include <QScopedPointer>
#include "kritaimage_export.h"
#include <QList>
#include <QVector>
#include <QScopedPointer>
#include "kritaimage_export.h"
#include "kis_mask_generator.h"
class KisCubicCurve;
class QDomElement;
......@@ -38,7 +39,8 @@ class QPointF;
*/
class KRITAIMAGE_EXPORT KisCurveCircleMaskGenerator : public KisMaskGenerator
{
public:
struct FastRowProcessor;
public:
KisCurveCircleMaskGenerator(qreal radius, qreal ratio, qreal fh, qreal fv, int spikes,const KisCubicCurve& curve, bool antialiasEdges);
......@@ -55,6 +57,11 @@ public:
void toXML(QDomDocument& , QDomElement&) const override;
void setSoftness(qreal softness) override;
bool shouldVectorize() const override;
KisBrushMaskApplicatorBase* applicator() override;
void resetMaskApplicator(bool forceScalar);
static void transformCurveForSoftness(qreal softness,const QList<QPointF> &points, int curveResolution, QVector<qreal> &result);
private:
......
/*
* Copyright (c) 2010 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.
*/
#ifndef KIS_CURVE_CIRCLE_MASK_GENERATOR_P_H
#define KIS_CURVE_CIRCLE_MASK_GENERATOR_P_H
#include "kis_antialiasing_fade_maker.h"
#include "kis_brush_mask_applicator_base.h"
struct Q_DECL_HIDDEN KisCurveCircleMaskGenerator::Private
{
Private(bool enableAntialiasing)
: fadeMaker(*this, enableAntialiasing)
{
}
Private(const Private &rhs)
: xcoef(rhs.xcoef),
ycoef(rhs.ycoef),
curveResolution(rhs.curveResolution),
curveData(rhs.curveData),
curvePoints(rhs.curvePoints),
dirty(true),
fadeMaker(rhs.fadeMaker,*this)
{
}
qreal xcoef, ycoef;
qreal curveResolution;
QVector<qreal> curveData;
QList<QPointF> curvePoints;
bool dirty;
KisAntialiasingFadeMaker1D<Private> fadeMaker;
QScopedPointer<KisBrushMaskApplicatorBase> applicator;
inline quint8 value(qreal dist) const;
};
#endif // KIS_CURVE_CIRCLE_MASK_GENERATOR_P_H
......@@ -20,6 +20,7 @@
#define _KIS_GAUSS_MASK_GENERATOR_P_H_
#include "kis_antialiasing_fade_maker.h"
#include "kis_brush_mask_applicator_base.h"
struct Q_DECL_HIDDEN KisGaussCircleMaskGenerator::Private
{
......
......@@ -148,6 +148,7 @@ const KisTimeRange& KisImageAnimationInterface::fullClipRange() const
void KisImageAnimationInterface::setFullClipRange(const KisTimeRange range)
{
KIS_SAFE_ASSERT_RECOVER_RETURN(!range.isInfinite());
m_d->fullClipRange = range;
emit sigFullClipRangeChanged();
}
......@@ -171,6 +172,7 @@ const KisTimeRange& KisImageAnimationInterface::playbackRange() const
void KisImageAnimationInterface::setPlaybackRange(const KisTimeRange range)
{
KIS_SAFE_ASSERT_RECOVER_RETURN(!range.isInfinite());
m_d->playbackRange = range;
emit sigPlaybackRangeChanged();
}
......
......@@ -63,9 +63,9 @@ public:
if (rhs.isInfinite() || isInfinite()) {
m_end = std::numeric_limits<int>::min();
} else if (!isValid()) {
m_end = rhs.end();
m_end = rhs.m_end;
} else {
m_end = std::max(m_end, rhs.end());
m_end = std::max(m_end, rhs.m_end);
}
return *this;
......@@ -76,16 +76,16 @@ public:
return *this;
} else if (!rhs.isValid()) {
m_start = rhs.start();
m_end = rhs.end();
m_end = rhs.m_end;
return *this;
} else {
m_start = std::max(m_start, rhs.start());
}
if (isInfinite()) {
m_end = rhs.end();
m_end = rhs.m_end;
} else if (!rhs.isInfinite()) {
m_end = std::min(m_end, rhs.end());
m_end = std::min(m_end, rhs.m_end);
}
return *this;
......
......@@ -17,6 +17,7 @@
*/
#include <QTest>
#include <QPointF>
#include <KoColor.h>
#include <QElapsedTimer>
......@@ -26,6 +27,7 @@
#include "kis_brush_mask_applicator_base.h"
#include "kis_mask_generator.h"
#include "kis_cubic_curve.h"
#include "krita_utils.h"
#include "testutil.h"
......@@ -107,4 +109,30 @@ void KisMaskGeneratorBenchmark::testCircularGaussVectorMask()
}
}
void KisMaskGeneratorBenchmark::testCircularSoftScalarMask()
{
QRect bounds(0,0,1000,1000);
KisCubicCurve pointsCurve;
pointsCurve.fromString(QString("0,1;1,0"));
{
KisCurveCircleMaskGenerator circScalar(1000, 1.0, 0.5, 0.5, 2, pointsCurve, true);
circScalar.setSoftness(0.5);
circScalar.resetMaskApplicator(true); // Force usage of scalar backend
KisMaskGeneratorBenchmarkTester(circScalar.applicator(), bounds);
}
}
void KisMaskGeneratorBenchmark::testCircularSoftVectorMask()
{
QRect bounds(0,0,1000,1000);
KisCubicCurve pointsCurve;
pointsCurve.fromString(QString("0,1;1,0"));
{
KisCurveCircleMaskGenerator circVectr(1000, 1.0, 0.5, 0.5, 2, pointsCurve, true);
circVectr.setSoftness(0.5);
KisMaskGeneratorBenchmarkTester(circVectr.applicator(), bounds);
}
}
QTEST_MAIN(KisMaskGeneratorBenchmark)
......@@ -31,6 +31,9 @@ private Q_SLOTS:
void testCircularGaussScalarMask();
void testCircularGaussVectorMask();
void testCircularSoftScalarMask();
void testCircularSoftVectorMask();
};
#endif // KISMASKGENERATORBENCHMARK_H
......@@ -19,18 +19,25 @@
#include "kis_mask_similarity_test.h"
#include <QTest>
#include <QPointF>
#include <KoColor.h>
#include <testutil.h>
#include "kis_brush_mask_applicator_base.h"
#include "kis_mask_generator.h"
#include "kis_cubic_curve.h"
#include "krita_utils.h"
enum MaskType {
DEFAULT, CIRC_GAUSS, CIRC_SOFT, RECT_GAUSS, RECT_SOFT, STAMP
};
class KisMaskSimilarityTester
{
public:
KisMaskSimilarityTester(KisBrushMaskApplicatorBase *_legacy, KisBrushMaskApplicatorBase *_vectorized, QRect _bounds)
KisMaskSimilarityTester(KisBrushMaskApplicatorBase *_legacy, KisBrushMaskApplicatorBase *_vectorized, QRect _bounds, MaskType type, bool renderImage = true)
: legacy(_legacy)
, vectorized(_vectorized)
, m_bounds(_bounds)
......@@ -49,7 +56,6 @@ public:
QImage scalarImage(m_paintDev->convertToQImage(m_colorSpace->profile()));
scalarImage.invertPixels(); // Make pixel color black
scalarImage.save(QString("scalar_mask.png"),"PNG");
// Start vector processing
m_paintDev->initialize(255);
......@@ -58,29 +64,42 @@ public:
QImage vectorImage(m_paintDev->convertToQImage(m_colorSpace->profile()));