[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-kimageshop
Subject: Histogram White Spike bug in Brightness Contrast Filter dialog
From: William Steidtmann <billstei () hbci ! com>
Date: 2010-11-30 1:33:44
Message-ID: 4CF45478.2010800 () hbci ! com
[Download RAW message or body]
Attached is a patch that eliminates the KisHistogram::KisHistogram()
constructor that does not pass a "bounds" parameter when using a paint
device, and modifies all calls to the new KisHistogram constructor that
does use "bounds". Most of these calls are (temporarily) passing
exactBounds (and so this code does not change behaviour there), with the
exception of the Brightness Contrast filter, which now passes image
bounds, and thus fixes the White Spike bug in the Brightness Contrast
filter dialog. This is very much the same as the Levels Filter
histogram patch (see Commit #1200357).
To recreate the (pre-patch) bug:
1) Create a 10x10 image, 8 bit sRGB.
2) Set the color to a dark gray 92,92,92.
3) Use a pixel brush to paint all (most) of the image this dark gray.
4) Use menu Filter->Adjust->Brightness/Contrast curve...
5) Note that the graph has little or no indication (count) in the second
quadrant where this dark gray should be.
After the patch, the second quadrant in step 5) will have an appropriate
pixel count.
William Steidtmann
["BrightnessContrastPatch1.patch" (text/x-patch)]
Index: krita/plugins/extensions/dockers/defaultdockers/histogramdock.cpp
===================================================================
--- krita/plugins/extensions/dockers/defaultdockers/histogramdock.cpp (revision \
1202068)
+++ krita/plugins/extensions/dockers/defaultdockers/histogramdock.cpp (working copy)
@@ -172,7 +172,8 @@
// use dummy layer as a source; we are not going to actually use or need it
// All of these are SP, no need to delete them afterwards
- m_histogram = new KisHistogram(new \
KisPaintDevice(KoColorSpaceRegistry::instance()->alpha8()), + KisPaintDeviceSP \
paintDevice = new KisPaintDevice(KoColorSpaceRegistry::instance()->alpha8()); + \
m_histogram = new KisHistogram(paintDevice, \
paintDevice->exactBounds(),
KoHistogramProducerSP(m_producer), LOGARITHMIC);
kDebug() << "created histogram " << m_histogram;
Index: krita/plugins/extensions/scripting/kritacore/krs_histogram.cpp
===================================================================
--- krita/plugins/extensions/scripting/kritacore/krs_histogram.cpp (revision 1202068)
+++ krita/plugins/extensions/scripting/kritacore/krs_histogram.cpp (working copy)
@@ -38,7 +38,7 @@
: QObject(layer)
{
setObjectName("KritaHistogram");
- m_histogram = new KisHistogram(layer->paintDevice(), producer, type);
+ m_histogram = new KisHistogram(layer->paintDevice(), \
layer->paintDevice()->exactBounds(), producer, type); }
Histogram::~Histogram()
Index: krita/plugins/filters/colorsfilters/kis_brightness_contrast_filter.cpp
===================================================================
--- krita/plugins/filters/colorsfilters/kis_brightness_contrast_filter.cpp (revision \
1202068)
+++ krita/plugins/filters/colorsfilters/kis_brightness_contrast_filter.cpp (working \
copy) @@ -152,8 +152,7 @@
KisConfigWidget * KisBrightnessContrastFilter::createConfigurationWidget(QWidget \
*parent, const KisPaintDeviceSP dev, const KisImageWSP image) const {
- Q_UNUSED(image);
- return new KisBrightnessContrastConfigWidget(parent, dev);
+ return new KisBrightnessContrastConfigWidget(parent, dev, image->bounds());
}
KisFilterConfiguration* KisBrightnessContrastFilter::factoryConfiguration(const \
KisPaintDeviceSP) @@ -177,7 +176,7 @@
return adjustment;
}
-KisBrightnessContrastConfigWidget::KisBrightnessContrastConfigWidget(QWidget * \
parent, KisPaintDeviceSP dev, Qt::WFlags f) \
+KisBrightnessContrastConfigWidget::KisBrightnessContrastConfigWidget(QWidget * \
parent, KisPaintDeviceSP dev, const QRect &bounds, Qt::WFlags f) : \
KisConfigWidget(parent, f) {
int i;
@@ -219,7 +218,7 @@
m_page->vgradient->setPixmap(vgradientpix);
KoHistogramProducerSP producer = KoHistogramProducerSP(new \
KoGenericLabHistogramProducer());
- KisHistogram histogram(dev, producer, LINEAR);
+ KisHistogram histogram(dev, bounds, producer, LINEAR);
QPixmap pix(256, height);
pix.fill();
QPainter p(&pix);
Index: krita/plugins/filters/colorsfilters/kis_brightness_contrast_filter.h
===================================================================
--- krita/plugins/filters/colorsfilters/kis_brightness_contrast_filter.h (revision \
1202068)
+++ krita/plugins/filters/colorsfilters/kis_brightness_contrast_filter.h (working \
copy) @@ -98,7 +98,7 @@
{
public:
- KisBrightnessContrastConfigWidget(QWidget * parent, KisPaintDeviceSP dev, \
Qt::WFlags f = 0); + KisBrightnessContrastConfigWidget(QWidget * parent, \
KisPaintDeviceSP dev, const QRect &bounds, Qt::WFlags f = 0); virtual \
~KisBrightnessContrastConfigWidget() {}
virtual KisBrightnessContrastFilterConfiguration * configuration() const;
Index: krita/plugins/filters/colorsfilters/colorsfilters.cpp
===================================================================
--- krita/plugins/filters/colorsfilters/colorsfilters.cpp (revision 1202068)
+++ krita/plugins/filters/colorsfilters/colorsfilters.cpp (working copy)
@@ -116,7 +116,7 @@
Q_UNUSED(config);
// initialize
KoHistogramProducerSP producer = KoHistogramProducerSP(new \
KoGenericLabHistogramProducer());
- KisHistogram histogram(src, producer, LINEAR);
+ KisHistogram histogram(src, src->exactBounds(), producer, LINEAR);
int minvalue = int(255 * histogram.calculations().getMin() + 0.5);
int maxvalue = int(255 * histogram.calculations().getMax() + 0.5);
Index: krita/plugins/filters/colorsfilters/kis_perchannel_filter.cpp
===================================================================
--- krita/plugins/filters/colorsfilters/kis_perchannel_filter.cpp (revision 1202068)
+++ krita/plugins/filters/colorsfilters/kis_perchannel_filter.cpp (working copy)
@@ -87,7 +87,7 @@
{
KoHistogramProducerFactory *hpf;
hpf = KoHistogramProducerFactoryRegistry::instance()->get(keys.at(0));
- m_histogram = new KisHistogram(m_dev, hpf->generate(), LINEAR);
+ m_histogram = new KisHistogram(m_dev, m_dev->exactBounds(), hpf->generate(), \
LINEAR); }
connect(m_page->curveWidget, SIGNAL(modified()), this, \
SIGNAL(sigConfigurationItemChanged()));
Index: krita/image/kis_histogram.cc
===================================================================
--- krita/image/kis_histogram.cc (revision 1202068)
+++ krita/image/kis_histogram.cc (working copy)
@@ -43,22 +43,7 @@
updateHistogram();
}
-// TODO: get rid of this, make all Histogram clients pass bounds (they can pass \
paintdev->exactBounds() if they want) KisHistogram::KisHistogram(const \
KisPaintDeviceSP paintdev,
- KoHistogramProducerSP producer,
- const enumHistogramType type)
-{
- m_paintDevice = paintdev;
- m_bounds = m_paintDevice->exactBounds();
- m_type = type;
- m_producer = producer;
- m_selection = false;
- m_channel = 0;
-
- updateHistogram();
-}
-
-KisHistogram::KisHistogram(const KisPaintDeviceSP paintdev,
const QRect &bounds,
KoHistogramProducerSP producer,
const enumHistogramType type)
Index: krita/image/kis_histogram.h
===================================================================
--- krita/image/kis_histogram.h (revision 1202068)
+++ krita/image/kis_histogram.h (working copy)
@@ -109,10 +109,6 @@
const enumHistogramType type);
KisHistogram(KisPaintDeviceSP paintdev,
- KoHistogramProducerSP producer,
- const enumHistogramType type);
-
- KisHistogram(KisPaintDeviceSP paintdev,
const QRect &bounds,
KoHistogramProducerSP producer,
const enumHistogramType type);
_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic