fix possibly broken rect size calculation in Krita blur filters (minus on...

fix possibly broken rect size calculation in Krita blur filters (minus on unsigned int gives complement)

REVIEW: 108708

thanks boud for review
parent b902dd03
......@@ -114,8 +114,8 @@ void KisBlurFilter::process(KisPaintDeviceSP device,
QRect KisBlurFilter::neededRect(const QRect & rect, const KisFilterConfiguration* _config) const
{
QVariant value;
uint halfWidth = (_config->getProperty("halfWidth", value)) ? value.toUInt() : 5;
uint halfHeight = (_config->getProperty("halfHeight", value)) ? value.toUInt() : 5;
const int halfWidth = (_config->getProperty("halfWidth", value)) ? value.toUInt() : 5;
const int halfHeight = (_config->getProperty("halfHeight", value)) ? value.toUInt() : 5;
return rect.adjusted(-halfWidth * 2, -halfHeight * 2, halfWidth * 2, halfHeight * 2);
}
......@@ -123,8 +123,8 @@ QRect KisBlurFilter::neededRect(const QRect & rect, const KisFilterConfiguration
QRect KisBlurFilter::changedRect(const QRect & rect, const KisFilterConfiguration* _config) const
{
QVariant value;
uint halfWidth = (_config->getProperty("halfWidth", value)) ? value.toUInt() : 5;
uint halfHeight = (_config->getProperty("halfHeight", value)) ? value.toUInt() : 5;
const int halfWidth = (_config->getProperty("halfWidth", value)) ? value.toUInt() : 5;
const int halfHeight = (_config->getProperty("halfHeight", value)) ? value.toUInt() : 5;
return rect.adjusted(-halfWidth, -halfHeight, halfWidth, halfHeight);
}
......@@ -166,8 +166,8 @@ void KisGaussianBlurFilter::process(KisPaintDeviceSP device,
QRect KisGaussianBlurFilter::neededRect(const QRect & rect, const KisFilterConfiguration* _config) const
{
QVariant value;
uint halfWidth = (_config->getProperty("horizRadius", value)) ? value.toUInt() : 5;
uint halfHeight = (_config->getProperty("vertRadius", value)) ? value.toUInt() : 5;
const int halfWidth = (_config->getProperty("horizRadius", value)) ? value.toUInt() : 5;
const int halfHeight = (_config->getProperty("vertRadius", value)) ? value.toUInt() : 5;
return rect.adjusted(-halfWidth * 2, -halfHeight * 2, halfWidth * 2, halfHeight * 2);
}
......@@ -175,8 +175,8 @@ QRect KisGaussianBlurFilter::neededRect(const QRect & rect, const KisFilterConfi
QRect KisGaussianBlurFilter::changedRect(const QRect & rect, const KisFilterConfiguration* _config) const
{
QVariant value;
uint halfWidth = (_config->getProperty("horizRadius", value)) ? value.toUInt() : 5;
uint halfHeight = (_config->getProperty("vertRadius", value)) ? value.toUInt() : 5;
const int halfWidth = (_config->getProperty("horizRadius", value)) ? value.toUInt() : 5;
const int halfHeight = (_config->getProperty("vertRadius", value)) ? value.toUInt() : 5;
return rect.adjusted(-halfWidth, -halfHeight, halfWidth, halfHeight);
}
......@@ -141,8 +141,8 @@ QRect KisMotionBlurFilter::neededRect(const QRect & rect, const KisFilterConfigu
uint blurLength = (_config->getProperty("blurLength", value)) ? value.toUInt() : 5;
qreal angleRadians = blurAngle / 360.0 * 2 * M_PI;
uint halfWidth = ceil(fabs(blurLength / 2.0 * cos(angleRadians)));
uint halfHeight = ceil(fabs(blurLength / 2.0 * cos(angleRadians)));
const int halfWidth = ceil(fabs(blurLength / 2.0 * cos(angleRadians)));
const int halfHeight = ceil(fabs(blurLength / 2.0 * cos(angleRadians)));
return rect.adjusted(-halfWidth * 2, -halfHeight * 2, halfWidth * 2, halfHeight * 2);
}
......@@ -154,8 +154,8 @@ QRect KisMotionBlurFilter::changedRect(const QRect & rect, const KisFilterConfig
uint blurLength = (_config->getProperty("blurLength", value)) ? value.toUInt() : 5;
qreal angleRadians = blurAngle / 360.0 * 2 * M_PI;
uint halfWidth = ceil(fabs(blurLength * cos(angleRadians)));
uint halfHeight = ceil(fabs(blurLength * cos(angleRadians)));
const int halfWidth = ceil(fabs(blurLength * cos(angleRadians)));
const int halfHeight = ceil(fabs(blurLength * cos(angleRadians)));
return rect.adjusted(-halfWidth * 2, -halfHeight * 2, halfWidth * 2, halfHeight * 2);
}
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