summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/effects/qgraphicseffect.cpp16
-rw-r--r--src/gui/effects/qgraphicseffect.h16
-rw-r--r--src/gui/image/qpixmapfilter.cpp20
-rw-r--r--src/gui/image/qpixmapfilter_p.h8
-rw-r--r--src/opengl/qglpixmapfilter.cpp4
5 files changed, 32 insertions, 32 deletions
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index 647fd1b..9ed003c 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -630,16 +630,16 @@ QGraphicsBlurEffect::~QGraphicsBlurEffect()
By default, the blur radius is 5 pixels.
*/
-int QGraphicsBlurEffect::blurRadius() const
+qreal QGraphicsBlurEffect::blurRadius() const
{
Q_D(const QGraphicsBlurEffect);
return d->filter->radius();
}
-void QGraphicsBlurEffect::setBlurRadius(int radius)
+void QGraphicsBlurEffect::setBlurRadius(qreal radius)
{
Q_D(QGraphicsBlurEffect);
- if (d->filter->radius() == radius)
+ if (qFuzzyCompare(d->filter->radius(), radius))
return;
d->filter->setRadius(radius);
@@ -648,7 +648,7 @@ void QGraphicsBlurEffect::setBlurRadius(int radius)
}
/*!
- \fn void QGraphicsBlurEffect::blurRadiusChanged(int radius)
+ \fn void QGraphicsBlurEffect::blurRadiusChanged(qreal radius)
This signal is emitted whenever the effect's blur radius changes.
The \a radius parameter holds the effect's new blur radius.
@@ -816,16 +816,16 @@ void QGraphicsDropShadowEffect::setOffset(const QPointF &offset)
\sa color(), offset().
*/
-int QGraphicsDropShadowEffect::blurRadius() const
+qreal QGraphicsDropShadowEffect::blurRadius() const
{
Q_D(const QGraphicsDropShadowEffect);
return d->filter->blurRadius();
}
-void QGraphicsDropShadowEffect::setBlurRadius(int blurRadius)
+void QGraphicsDropShadowEffect::setBlurRadius(qreal blurRadius)
{
Q_D(QGraphicsDropShadowEffect);
- if (d->filter->blurRadius() == blurRadius)
+ if (qFuzzyCompare(d->filter->blurRadius(), blurRadius))
return;
d->filter->setBlurRadius(blurRadius);
@@ -834,7 +834,7 @@ void QGraphicsDropShadowEffect::setBlurRadius(int blurRadius)
}
/*!
- \fn void QGraphicsDropShadowEffect::blurRadiusChanged(int blurRadius)
+ \fn void QGraphicsDropShadowEffect::blurRadiusChanged(qreal blurRadius)
This signal is emitted whenever the effect's blur radius changes.
The \a blurRadius parameter holds the effect's new blur radius.
diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h
index abf03b3..bf18581 100644
--- a/src/gui/effects/qgraphicseffect.h
+++ b/src/gui/effects/qgraphicseffect.h
@@ -182,22 +182,22 @@ class QGraphicsBlurEffectPrivate;
class Q_GUI_EXPORT QGraphicsBlurEffect: public QGraphicsEffect
{
Q_OBJECT
- Q_PROPERTY(int blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged)
+ Q_PROPERTY(qreal blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged)
Q_PROPERTY(Qt::RenderHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged)
public:
QGraphicsBlurEffect(QObject *parent = 0);
~QGraphicsBlurEffect();
QRectF boundingRectFor(const QRectF &rect) const;
- int blurRadius() const;
+ qreal blurRadius() const;
Qt::RenderHint blurHint() const;
public Q_SLOTS:
- void setBlurRadius(int blurRadius);
+ void setBlurRadius(qreal blurRadius);
void setBlurHint(Qt::RenderHint hint);
Q_SIGNALS:
- void blurRadiusChanged(int blurRadius);
+ void blurRadiusChanged(qreal blurRadius);
void blurHintChanged(Qt::RenderHint hint);
protected:
@@ -215,7 +215,7 @@ class Q_GUI_EXPORT QGraphicsDropShadowEffect: public QGraphicsEffect
Q_PROPERTY(QPointF offset READ offset WRITE setOffset NOTIFY offsetChanged)
Q_PROPERTY(qreal xOffset READ xOffset WRITE setXOffset NOTIFY offsetChanged)
Q_PROPERTY(qreal yOffset READ yOffset WRITE setYOffset NOTIFY offsetChanged)
- Q_PROPERTY(int blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged)
+ Q_PROPERTY(qreal blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
public:
QGraphicsDropShadowEffect(QObject *parent = 0);
@@ -230,7 +230,7 @@ public:
inline qreal yOffset() const
{ return offset().y(); }
- int blurRadius() const;
+ qreal blurRadius() const;
QColor color() const;
public Q_SLOTS:
@@ -248,12 +248,12 @@ public Q_SLOTS:
inline void setYOffset(qreal dy)
{ setOffset(QPointF(xOffset(), dy)); }
- void setBlurRadius(int blurRadius);
+ void setBlurRadius(qreal blurRadius);
void setColor(const QColor &color);
Q_SIGNALS:
void offsetChanged(const QPointF &offset);
- void blurRadiusChanged(int blurRadius);
+ void blurRadiusChanged(qreal blurRadius);
void colorChanged(const QColor &color);
protected:
diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp
index 9fcf776..f9ac79f 100644
--- a/src/gui/image/qpixmapfilter.cpp
+++ b/src/gui/image/qpixmapfilter.cpp
@@ -506,7 +506,7 @@ class QPixmapBlurFilterPrivate : public QPixmapFilterPrivate
public:
QPixmapBlurFilterPrivate() : radius(5), hint(Qt::PerformanceHint) {}
- int radius;
+ qreal radius;
Qt::RenderHint hint;
};
@@ -535,7 +535,7 @@ QPixmapBlurFilter::~QPixmapBlurFilter()
\internal
*/
-void QPixmapBlurFilter::setRadius(int radius)
+void QPixmapBlurFilter::setRadius(qreal radius)
{
Q_D(QPixmapBlurFilter);
d->radius = radius;
@@ -546,7 +546,7 @@ void QPixmapBlurFilter::setRadius(int radius)
\internal
*/
-int QPixmapBlurFilter::radius() const
+qreal QPixmapBlurFilter::radius() const
{
Q_D(const QPixmapBlurFilter);
return d->radius;
@@ -668,7 +668,7 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap
if (!painter->isActive())
return;
- if (d->radius == 0) {
+ if (d->radius <= 0) {
painter->drawPixmap(srcRect.translated(p), src, srcRect);
return;
}
@@ -688,12 +688,12 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap
if (srcRect.isNull()) {
srcImage = src.toImage();
- destImage = blurred(srcImage, srcImage.rect(), d->radius);
+ destImage = blurred(srcImage, srcImage.rect(), qRound(d->radius));
} else {
QRect rect = srcRect.toAlignedRect().intersected(src.rect());
srcImage = src.copy(rect).toImage();
- destImage = blurred(srcImage, srcImage.rect(), d->radius);
+ destImage = blurred(srcImage, srcImage.rect(), qRound(d->radius));
}
painter->drawImage(p, destImage);
@@ -902,7 +902,7 @@ public:
QPointF offset;
QColor color;
- int radius;
+ qreal radius;
};
/*!
@@ -966,7 +966,7 @@ QPixmapDropShadowFilter::~QPixmapDropShadowFilter()
\internal
*/
-int QPixmapDropShadowFilter::blurRadius() const
+qreal QPixmapDropShadowFilter::blurRadius() const
{
Q_D(const QPixmapDropShadowFilter);
return d->radius;
@@ -981,7 +981,7 @@ int QPixmapDropShadowFilter::blurRadius() const
\internal
*/
-void QPixmapDropShadowFilter::setBlurRadius(int radius)
+void QPixmapDropShadowFilter::setBlurRadius(qreal radius)
{
Q_D(QPixmapDropShadowFilter);
d->radius = radius;
@@ -1090,7 +1090,7 @@ void QPixmapDropShadowFilter::draw(QPainter *p,
QImage tmp = src.isNull() ? px.toImage() : px.copy(src.toAlignedRect()).toImage();
// blur the alpha channel
- tmp = blurred(tmp, tmp.rect(), d->radius, true);
+ tmp = blurred(tmp, tmp.rect(), qRound(d->radius), true);
// blacken the image...
QPainter tmpPainter(&tmp);
diff --git a/src/gui/image/qpixmapfilter_p.h b/src/gui/image/qpixmapfilter_p.h
index 8a2207a..fc70795 100644
--- a/src/gui/image/qpixmapfilter_p.h
+++ b/src/gui/image/qpixmapfilter_p.h
@@ -129,10 +129,10 @@ public:
QPixmapBlurFilter(QObject *parent = 0);
~QPixmapBlurFilter();
- void setRadius(int radius);
+ void setRadius(qreal radius);
void setBlurHint(Qt::RenderHint hint);
- int radius() const;
+ qreal radius() const;
Qt::RenderHint blurHint() const;
QRectF boundingRectFor(const QRectF &rect) const;
@@ -175,8 +175,8 @@ public:
QRectF boundingRectFor(const QRectF &rect) const;
void draw(QPainter *p, const QPointF &pos, const QPixmap &px, const QRectF &src = QRectF()) const;
- int blurRadius() const;
- void setBlurRadius(int radius);
+ qreal blurRadius() const;
+ void setBlurRadius(qreal radius);
QColor color() const;
void setColor(const QColor &color);
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index 0603369..656957d 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -341,7 +341,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const
{
QGLPixmapBlurFilter *filter = const_cast<QGLPixmapBlurFilter *>(this);
- int radius = this->radius();
+ int radius = qRound(this->radius());
if (!m_haveCached || (m_hint == Qt::QualityHint && radius != m_cachedRadius)) {
// Only regenerate the shader from source if parameters have changed.
m_haveCached = true;
@@ -530,7 +530,7 @@ bool QGLPixmapDropShadowFilter::processGL(QPainter *painter, const QPointF &pos,
{
QGLPixmapDropShadowFilter *filter = const_cast<QGLPixmapDropShadowFilter *>(this);
- int radius = this->blurRadius();
+ int radius = qRound(this->blurRadius());
if (!m_haveCached || (m_hint == Qt::QualityHint && radius != m_cachedRadius)) {
// Only regenerate the shader from source if parameters have changed.
m_haveCached = true;