From cb1df5078b282c95aad7fa23d8ab1c96e38d58c7 Mon Sep 17 00:00:00 2001 From: zach Date: Tue, 19 May 2026 03:55:48 +0200 Subject: [PATCH] revert blobs --- Plugins/ZShell/Blobs/blobgroup.cpp | 40 ++++++------------------------ Plugins/ZShell/Blobs/blobgroup.hpp | 2 +- Plugins/ZShell/Blobs/blobshape.cpp | 2 +- 3 files changed, 10 insertions(+), 34 deletions(-) diff --git a/Plugins/ZShell/Blobs/blobgroup.cpp b/Plugins/ZShell/Blobs/blobgroup.cpp index 1ccd85f..e77cf05 100644 --- a/Plugins/ZShell/Blobs/blobgroup.cpp +++ b/Plugins/ZShell/Blobs/blobgroup.cpp @@ -67,48 +67,24 @@ void BlobGroup::markDirty() { } } -void BlobGroup::markShapeDirty(BlobShape* source, const QRectF& oldGeometry) { +void BlobGroup::markShapeDirty(BlobShape* source) { m_physicsUpdated = false; source->polish(); source->update(); + // Use cached padded rects to find spatial neighbors const float pad = static_cast(m_smoothing) * 2.0f; + const QRectF srcRect(static_cast(source->m_cachedPaddedX - pad), + static_cast(source->m_cachedPaddedY - pad), static_cast(source->m_cachedPaddedW + pad * 2.0f), + static_cast(source->m_cachedPaddedH + pad * 2.0f)); - // Compute the source's dirty rect in scene space using its old position - const QPointF oldScene(oldGeometry.x(), oldGeometry.y()); - const QRectF oldDirtyRect(oldScene.x() - static_cast(pad), - oldScene.y() - static_cast(pad), - static_cast(oldGeometry.width() + pad * 2.0), - static_cast(oldGeometry.height() + pad * 2.0)); - - // Compute the source's dirty rect using its new position (fresh from polish) - const QRectF newDirtyRect(static_cast(source->m_cachedPaddedX - pad), - static_cast(source->m_cachedPaddedY - pad), - static_cast(source->m_cachedPaddedW + pad * 2.0), - static_cast(source->m_cachedPaddedH + pad * 2.0)); - - // Mark shapes near the old position as dirty (prevents ghost blobs after panel moves) for (auto* shape : std::as_const(m_shapes)) { if (shape == source) continue; - const QPointF shapeScene = shape->mapToScene(QPointF(0, 0)); - const QRectF shapeRect(shapeScene.x(), shapeScene.y(), - static_cast(shape->width()), static_cast(shape->height())); - if (oldDirtyRect.intersects(shapeRect)) { - shape->polish(); - shape->update(); - } - } - - // Mark shapes near the new position as dirty - for (auto* shape : std::as_const(m_shapes)) { - if (shape == source) - continue; - const QPointF shapeScene = shape->mapToScene(QPointF(0, 0)); - const QRectF shapeRect(shapeScene.x(), shapeScene.y(), - static_cast(shape->width()), static_cast(shape->height())); - if (newDirtyRect.intersects(shapeRect)) { + const QRectF otherRect(static_cast(shape->m_cachedPaddedX), static_cast(shape->m_cachedPaddedY), + static_cast(shape->m_cachedPaddedW), static_cast(shape->m_cachedPaddedH)); + if (srcRect.intersects(otherRect)) { shape->polish(); shape->update(); } diff --git a/Plugins/ZShell/Blobs/blobgroup.hpp b/Plugins/ZShell/Blobs/blobgroup.hpp index 44d5f87..ce5d933 100644 --- a/Plugins/ZShell/Blobs/blobgroup.hpp +++ b/Plugins/ZShell/Blobs/blobgroup.hpp @@ -45,7 +45,7 @@ BlobInvertedRect* invertedRect() const { } void markDirty(); -void markShapeDirty(BlobShape* source, const QRectF& oldGeometry); +void markShapeDirty(BlobShape* source); void ensurePhysicsUpdated(); signals: diff --git a/Plugins/ZShell/Blobs/blobshape.cpp b/Plugins/ZShell/Blobs/blobshape.cpp index 306a666..85bebf2 100644 --- a/Plugins/ZShell/Blobs/blobshape.cpp +++ b/Plugins/ZShell/Blobs/blobshape.cpp @@ -77,7 +77,7 @@ void BlobShape::geometryChange(const QRectF& newGeometry, const QRectF& oldGeome if (std::abs(m_pendingDx) > 0.5f || std::abs(m_pendingDy) > 0.5f || dw > 0.5 || dh > 0.5) { m_pendingDx = 0; m_pendingDy = 0; - m_group->markShapeDirty(this, oldGeometry); + m_group->markShapeDirty(this); } } }