Commit a5f1b871 authored by Thorsten Zachmann's avatar Thorsten Zachmann

Revert "Revert "Use the KisColorTransformationConfiguration""

This reverts commit ae00bf64f3e2bf5ced79cf06e3f013c460c854ae and fixes the problem
described in BUG 351009 by creating a transformation per thread as some seem to be
not thread save.
parent 48135195
......@@ -19,19 +19,20 @@
#include "filter/kis_color_transformation_configuration.h"
#include <QMutexLocker>
#include <QMap>
#include <QThread>
#include "filter/kis_color_transformation_filter.h"
struct KisColorTransformationConfiguration::Private {
Private()
: colorTransformation(0)
{}
~Private()
{
delete colorTransformation;
qDeleteAll(colorTransformation);
}
KoColorTransformation *colorTransformation;
QMap<QThread*, KoColorTransformation*> colorTransformation;
QMutex mutex;
};
......@@ -48,11 +49,13 @@ KisColorTransformationConfiguration::~KisColorTransformationConfiguration()
KoColorTransformation* KisColorTransformationConfiguration::colorTransformation(const KoColorSpace *cs, const KisColorTransformationFilter * filter) const
{
if (!d->colorTransformation) {
QMutexLocker locker(&d->mutex);
if (!d->colorTransformation) {
d->colorTransformation = filter->createTransformation(cs, this);
}
qDebug() << QThread::currentThread();
QMutexLocker locker(&d->mutex);
KoColorTransformation *transformation = d->colorTransformation.value(QThread::currentThread(), 0);
if (!transformation) {
transformation = filter->createTransformation(cs, this);
d->colorTransformation.insert(QThread::currentThread(), transformation);
}
return d->colorTransformation;
locker.unlock();
return transformation;
}
......@@ -18,7 +18,7 @@
*/
#include "kis_color_balance_filter.h"
#include "filter/kis_filter_configuration.h"
#include "filter/kis_color_transformation_configuration.h"
#include "kis_selection.h"
#include "kis_paint_device.h"
#include "kis_processing_information.h"
......@@ -59,7 +59,7 @@ KoColorTransformation * KisColorBalanceFilter::createTransformation(const KoColo
KisFilterConfiguration* KisColorBalanceFilter::factoryConfiguration(const KisPaintDeviceSP) const
{
KisFilterConfiguration* config = new KisFilterConfiguration(id().id(), 0);
KisColorTransformationConfiguration* config = new KisColorTransformationConfiguration(id().id(), 0);
config->setProperty("cyan_red_midtones", 0);
config->setProperty("yellow_green_midtones", 0);
config->setProperty("magenta_blue_midtones", 0);
......@@ -149,7 +149,7 @@ KisColorBalanceConfigWidget::~KisColorBalanceConfigWidget()
KisPropertiesConfiguration * KisColorBalanceConfigWidget::configuration() const
{
KisFilterConfiguration* c = new KisFilterConfiguration(KisColorBalanceFilter::id().id(), 0);
KisColorTransformationConfiguration* c = new KisColorTransformationConfiguration(KisColorBalanceFilter::id().id(), 0);
c->setProperty("cyan_red_shadows", m_page->cyanRedShadowsSlider->value());
c->setProperty("magenta_green_shadows", m_page->magentaGreenShadowsSlider->value());
......
......@@ -38,7 +38,7 @@
#include "KoBasicHistogramProducers.h"
#include <KoColorSpace.h>
#include <KoColorTransformation.h>
#include <filter/kis_filter_configuration.h>
#include <filter/kis_color_transformation_configuration.h>
#include <kis_paint_device.h>
#include <kis_processing_information.h>
#include <KisDocument.h>
......@@ -82,7 +82,7 @@ KoColorTransformation* KisDesaturateFilter::createTransformation(const KoColorSp
KisFilterConfiguration *KisDesaturateFilter::factoryConfiguration(const KisPaintDeviceSP) const
{
KisFilterConfiguration* config = new KisFilterConfiguration(id().id(), 1);
KisColorTransformationConfiguration* config = new KisColorTransformationConfiguration(id().id(), 1);
config->setProperty("type", 0);
return config;
}
......@@ -109,7 +109,7 @@ KisDesaturateConfigWidget::~KisDesaturateConfigWidget()
KisPropertiesConfiguration * KisDesaturateConfigWidget::configuration() const
{
KisFilterConfiguration* c = new KisFilterConfiguration(KisDesaturateFilter::id().id(), 0);
KisColorTransformationConfiguration* c = new KisColorTransformationConfiguration(KisDesaturateFilter::id().id(), 0);
c->setProperty("type", m_group->checkedId());
return c;
}
......
......@@ -19,7 +19,7 @@
#include "kis_hsv_adjustment_filter.h"
#include <filter/kis_filter_configuration.h>
#include <filter/kis_color_transformation_configuration.h>
#include <kis_selection.h>
#include <kis_paint_device.h>
#include <kis_processing_information.h>
......@@ -59,7 +59,7 @@ KoColorTransformation* KisHSVAdjustmentFilter::createTransformation(const KoColo
KisFilterConfiguration* KisHSVAdjustmentFilter::factoryConfiguration(const KisPaintDeviceSP) const
{
KisFilterConfiguration* config = new KisFilterConfiguration(id().id(), 1);
KisColorTransformationConfiguration* config = new KisColorTransformationConfiguration(id().id(), 1);
config->setProperty("h", 0);
config->setProperty("s", 0);
config->setProperty("v", 0);
......@@ -96,7 +96,7 @@ KisHSVConfigWidget::~KisHSVConfigWidget()
KisPropertiesConfiguration * KisHSVConfigWidget::configuration() const
{
KisFilterConfiguration* c = new KisFilterConfiguration(KisHSVAdjustmentFilter::id().id(), 0);
KisColorTransformationConfiguration* c = new KisColorTransformationConfiguration(KisHSVAdjustmentFilter::id().id(), 0);
c->setProperty("h", m_page->hue->value());
c->setProperty("s", m_page->saturation->value());
c->setProperty("v", m_page->value->value());
......
......@@ -16,7 +16,7 @@
*/
#include "DodgeBurn.h"
#include <filter/kis_filter_configuration.h>
#include <filter/kis_color_transformation_configuration.h>
#include <kis_paint_device.h>
#include "ui_DodgeBurnConfigurationBaseWidget.h"
......@@ -74,7 +74,7 @@ KisDodgeBurnConfigWidget::~KisDodgeBurnConfigWidget()
KisPropertiesConfiguration * KisDodgeBurnConfigWidget::configuration() const
{
KisFilterConfiguration* c = new KisFilterConfiguration(m_id, 0);
KisColorTransformationConfiguration* c = new KisColorTransformationConfiguration(m_id, 0);
int type = 0;
if(m_page->radioButtonHighlights->isChecked())
{
......
......@@ -27,7 +27,7 @@
#include <kis_global.h>
#include <KoColorSpaceMaths.h>
#include <KoColorSpaceRegistry.h>
#include <filter/kis_filter_configuration.h>
#include <filter/kis_color_transformation_configuration.h>
#include <widgets/kis_multi_integer_filter_widget.h>
#include "kiswdgindexcolors.h"
......@@ -87,7 +87,7 @@ KisConfigWidget* KisFilterIndexColors::createConfigurationWidget(QWidget* parent
KisFilterConfiguration* KisFilterIndexColors::factoryConfiguration(const KisPaintDeviceSP) const
{
KisFilterConfiguration* config = new KisFilterConfiguration(id().id(), 0);
KisColorTransformationConfiguration* config = new KisColorTransformationConfiguration(id().id(), 0);
PaletteGeneratorConfig palCfg; // Default constructor is factory config
config->setProperty("paletteGen", palCfg.toByteArray());
......
......@@ -36,7 +36,7 @@
#include <kis_global.h>
#include <KoColorSpaceMaths.h>
#include <filter/kis_filter_configuration.h>
#include <filter/kis_color_transformation_configuration.h>
#include <widgets/kis_multi_integer_filter_widget.h>
K_PLUGIN_FACTORY(PosterizeFactory, registerPlugin<Posterize>();)
......@@ -80,7 +80,7 @@ KisConfigWidget* KisFilterPosterize::createConfigurationWidget(QWidget* parent,
KisFilterConfiguration* KisFilterPosterize::factoryConfiguration(const KisPaintDeviceSP) const
{
KisFilterConfiguration* config = new KisFilterConfiguration(id().id(), 0);
KisColorTransformationConfiguration* config = new KisColorTransformationConfiguration(id().id(), 0);
config->setProperty("steps", 16);
return config;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment