[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/krita
From: Boudewijn Rempt <boud () valdyas ! org>
Date: 2010-11-24 20:20:12
Message-ID: 20101124202012.A4E86AC8A3 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1200357 by rempt:
Fix histogram
Patch by William Steidtmann
CCMAIL: billstei@hbci.com
M +24 -7 image/kis_histogram.cc
M +8 -4 image/kis_histogram.h
M +2 -2 plugins/extensions/histogram/dlg_histogram.cc
M +1 -1 plugins/extensions/histogram/dlg_histogram.h
M +3 -3 plugins/extensions/histogram/histogram.cc
M +2 -2 plugins/extensions/histogram/kis_histogram_widget.cc
M +1 -1 plugins/extensions/histogram/kis_histogram_widget.h
M +3 -4 plugins/filters/levelfilter/kis_level_filter.cpp
M +1 -1 plugins/filters/levelfilter/kis_level_filter.h
M +2 -2 ui/kis_histogram_view.cc
M +1 -1 ui/kis_histogram_view.h
--- trunk/koffice/krita/image/kis_histogram.cc #1200356:1200357
@@ -33,8 +33,8 @@
KoHistogramProducerSP producer,
const enumHistogramType type)
{
- KisPaintDeviceSP pd = layer->projection();
- m_dev = pd;
+ m_paintDevice = layer->projection();
+ m_bounds = layer->image()->bounds();
m_type = type;
m_producer = producer;
m_selection = false;
@@ -43,11 +43,13 @@
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_dev = paintdev;
+ m_paintDevice = paintdev;
+ m_bounds = m_paintDevice->exactBounds();
m_type = type;
m_producer = producer;
m_selection = false;
@@ -56,6 +58,23 @@
updateHistogram();
}
+KisHistogram::KisHistogram(const KisPaintDeviceSP paintdev,
+ const QRect &bounds,
+ KoHistogramProducerSP producer,
+ const enumHistogramType type)
+{
+ m_paintDevice = paintdev;
+ m_bounds = bounds;
+ m_producer = producer;
+ m_type = type;
+
+ m_selection = false;
+ m_channel = 0;
+
+ // TODO: Why does Krita crash when updateHistogram() is *not* called here?
+ updateHistogram();
+}
+
KisHistogram::~KisHistogram()
{
}
@@ -64,10 +83,8 @@
{
if (!m_producer) return;
- QRect r;
- r = m_dev->exactBounds();
- KisRectConstIteratorPixel srcIt = m_dev->createRectConstIterator(r.x(), r.y(), r.width(), \
r.height());
- const KoColorSpace* cs = m_dev->colorSpace();
+ KisRectConstIteratorPixel srcIt = m_paintDevice->createRectConstIterator(m_bounds.left(), \
m_bounds.top(), m_bounds.width(), m_bounds.height()); + const KoColorSpace* cs = \
m_paintDevice->colorSpace();
// Let the producer do it's work
m_producer->clear();
--- trunk/koffice/krita/image/kis_histogram.h #1200356:1200357
@@ -20,6 +20,7 @@
#define KIS_HISTOGRAM_
#include <QVector>
+#include <QRect>
#include "KoHistogramProducer.h"
@@ -111,6 +112,11 @@
KoHistogramProducerSP producer,
const enumHistogramType type);
+ KisHistogram(KisPaintDeviceSP paintdev,
+ const QRect &bounds,
+ KoHistogramProducerSP producer,
+ const enumHistogramType type);
+
virtual ~KisHistogram();
/** Updates the information in the producer */
@@ -176,17 +182,15 @@
QVector<Calculations> calculateForRange(double from, double to);
Calculations calculateSingleRange(int channel, double from, double to);
- KisPaintDeviceSP m_device;
+ const KisPaintDeviceSP m_paintDevice;
+ QRect m_bounds;
KoHistogramProducerSP m_producer;
-
enumHistogramType m_type;
qint32 m_channel;
double m_selFrom, m_selTo;
bool m_selection;
- const KisPaintDeviceSP m_dev;
-
QVector<Calculations> m_completeCalculations, m_selectionCalculations;
};
--- trunk/koffice/krita/plugins/extensions/histogram/dlg_histogram.cc #1200356:1200357
@@ -61,9 +61,9 @@
delete m_page;
}
-void DlgHistogram::setPaintDevice(KisPaintDeviceSP dev)
+void DlgHistogram::setPaintDevice(KisPaintDeviceSP dev, const QRect &bounds)
{
- m_page->setPaintDevice(dev);
+ m_page->setPaintDevice(dev, bounds);
}
void DlgHistogram::okClicked()
--- trunk/koffice/krita/plugins/extensions/histogram/dlg_histogram.h #1200356:1200357
@@ -42,7 +42,7 @@
const char* name = 0);
~DlgHistogram();
- void setPaintDevice(KisPaintDeviceSP dev);
+ void setPaintDevice(KisPaintDeviceSP dev, const QRect &bounds);
private slots:
void okClicked();
--- trunk/koffice/krita/plugins/extensions/histogram/histogram.cc #1200356:1200357
@@ -98,9 +98,9 @@
if (layer) {
KisPaintDeviceSP dev = layer->paintDevice();
- if (dev)
- dlgHistogram->setPaintDevice(dev);
-
+ if (dev) {
+ dlgHistogram->setPaintDevice(dev, layer->image()->bounds());
+ }
if (dlgHistogram->exec() == QDialog::Accepted) {
// Do nothing; this is an informational dialog
}
--- trunk/koffice/krita/plugins/extensions/histogram/kis_histogram_widget.cc #1200356:1200357
@@ -51,12 +51,12 @@
{
}
-void KisHistogramWidget::setPaintDevice(KisPaintDeviceSP dev)
+void KisHistogramWidget::setPaintDevice(KisPaintDeviceSP dev, const QRect &bounds)
{
grpType->disconnect(this);
cmbChannel->disconnect(this);
- m_histogramView->setPaintDevice(dev);
+ m_histogramView->setPaintDevice(dev, bounds);
setActiveChannel(0); // So we have the colored one if there are colors
// The channels
--- trunk/koffice/krita/plugins/extensions/histogram/kis_histogram_widget.h #1200356:1200357
@@ -45,7 +45,7 @@
KisHistogramWidget(QWidget *parent, const char *name);
virtual ~KisHistogramWidget();
- void setPaintDevice(KisPaintDeviceSP dev);
+ void setPaintDevice(KisPaintDeviceSP dev, const QRect &bounds);
private slots:
void setActiveChannel(int channel);
--- trunk/koffice/krita/plugins/filters/levelfilter/kis_level_filter.cpp #1200356:1200357
@@ -59,8 +59,7 @@
KisConfigWidget * KisLevelFilter::createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev, \
const KisImageWSP image) const {
- Q_UNUSED(image);
- return new KisLevelConfigWidget(parent, dev);
+ return new KisLevelConfigWidget(parent, dev, image->bounds());
}
bool KisLevelFilter::workWith(KoColorSpace* cs) const
@@ -100,7 +99,7 @@
return cs->createBrightnessContrastAdjustment(transfer);
}
-KisLevelConfigWidget::KisLevelConfigWidget(QWidget * parent, KisPaintDeviceSP dev)
+KisLevelConfigWidget::KisLevelConfigWidget(QWidget * parent, KisPaintDeviceSP dev, const QRect &bounds)
: KisConfigWidget(parent)
{
m_page.setupUi(this);
@@ -145,7 +144,7 @@
connect((QObject*)(m_page.chkLogarithmic), SIGNAL(toggled(bool)), this, \
SLOT(slotDrawHistogram(bool)));
KoHistogramProducerSP producer = KoHistogramProducerSP(new KoGenericLabHistogramProducer());
- histogram = new KisHistogram(dev, producer, LINEAR);
+ histogram = new KisHistogram(dev, bounds, producer, LINEAR);
m_histlog = false;
slotDrawHistogram();
--- trunk/koffice/krita/plugins/filters/levelfilter/kis_level_filter.h #1200356:1200357
@@ -62,7 +62,7 @@
{
Q_OBJECT
public:
- KisLevelConfigWidget(QWidget * parent, KisPaintDeviceSP dev);
+ KisLevelConfigWidget(QWidget * parent, KisPaintDeviceSP dev, const QRect &bounds);
virtual ~KisLevelConfigWidget();
virtual KisPropertiesConfiguration* configuration() const;
--- trunk/koffice/krita/ui/kis_histogram_view.cc #1200356:1200357
@@ -60,7 +60,7 @@
{
}
-void KisHistogramView::setPaintDevice(KisPaintDeviceSP dev)
+void KisHistogramView::setPaintDevice(KisPaintDeviceSP dev, const QRect &bounds)
{
m_cs = dev->colorSpace();
@@ -72,7 +72,7 @@
m_from = m_currentProducer->viewFrom();
m_width = m_currentProducer->viewWidth();
- m_histogram = new KisHistogram(dev, m_currentProducer, LINEAR);
+ m_histogram = new KisHistogram(dev, bounds, m_currentProducer, LINEAR);
updateHistogram();
}
--- trunk/koffice/krita/ui/kis_histogram_view.h #1200356:1200357
@@ -63,7 +63,7 @@
virtual ~KisHistogramView();
- void setPaintDevice(KisPaintDeviceSP dev);
+ void setPaintDevice(KisPaintDeviceSP dev, const QRect &bounds);
void setHistogram(KisHistogramSP histogram);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic