Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit b6704d0a authored by Bart Coppens's avatar Bart Coppens

Two small selection fixes:

* feather extends only to the image size if the selection would be bigger (no more fuzzy borders now)
* the select similar tool didn't select anything due to uninitialized opacity

svn path=/trunk/koffice/; revision=443494
parent 2f375d46
......@@ -654,6 +654,7 @@ void KisSelectionManager::feather()
QRect rect = selection -> extent();
// Make sure we've got enough space around the edges.
rect = QRect(rect.x() - 3, rect.y() - 3, rect.width() + 6, rect.height() + 6);
rect &= QRect(0, 0, img -> width(), img -> height());
painter.applyMatrix(&k, rect.x(), rect.y(), rect.width(), rect.height(), BORDER_AVOID, FLAG_ALPHA);
painter.end();
......
......@@ -51,7 +51,7 @@ void selectByColor(KisPaintDeviceSP dev, KisSelectionSP selection, const Q_UINT8
// XXX: Multithread this!
Q_INT32 x, y, w, h;
QUANTUM opacity;
QUANTUM opacity = OPACITY_OPAQUE;
dev -> exactBounds(x, y, w, h);
KisStrategyColorSpace * cs = dev -> colorStrategy();
......@@ -61,6 +61,8 @@ void selectByColor(KisPaintDeviceSP dev, KisSelectionSP selection, const Q_UINT8
KisHLineIterator hiter = dev -> createHLineIterator(x, y2, w, false);
KisHLineIterator selIter = selection -> createHLineIterator(x, y2, w, true);
while (!hiter.isDone()) {
if (dev -> colorStrategy() -> hasAlpha())
dev -> colorStrategy() -> getAlpha(hiter.rawData(), &opacity);
// XXX: Don't try to select transparent pixels. The Gimp has an option to match transparent pixels; we don't, for the moment.
if (opacity > OPACITY_TRANSPARENT) {
......@@ -131,7 +133,7 @@ void KisToolSelectSimilar::buttonPress(KisButtonPressEvent *e)
KisImageSP img;
KisPaintDeviceSP dev;
QPoint pos;
QUANTUM opacity;
QUANTUM opacity = OPACITY_OPAQUE;
if (e -> button() != QMouseEvent::LeftButton && e -> button() != QMouseEvent::RightButton)
return;
......@@ -150,6 +152,8 @@ void KisToolSelectSimilar::buttonPress(KisButtonPressEvent *e)
KisSelectedTransaction *t = new KisSelectedTransaction(i18n("Similar Selection"),dev);
KisColor c = dev->colorAt(pos.x(), pos.y());
if (dev -> colorStrategy() -> hasAlpha())
dev -> colorStrategy() -> getAlpha(c.data(), &opacity);
if (opacity > OPACITY_TRANSPARENT)
selectByColor(dev, dev -> selection(), c.data(), m_fuzziness, m_currentSelectAction);
......
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