3434using namespace Gfx ;
3535using Duck::Log, Duck::Config, Duck::ResultRet;
3636
37+ constexpr int BLUR_RADIUS = 4 ;
38+
3739Display* Display::_inst = nullptr ;
3840
3941Display::Display (): _dimensions({0 , 0 , 0 , 0 }) {
@@ -159,7 +161,7 @@ void Display::remove_window(Window* window) {
159161 }
160162}
161163
162- void Display::invalidate (const Gfx::Rect& rect) {
164+ void Display::invalidate (Gfx::Rect rect) {
163165 if (!rect.empty ())
164166 invalid_areas.push_back (rect);
165167}
@@ -183,9 +185,15 @@ void Display::repaint() {
183185
184186 auto & fb = _buffer_mode == BufferMode::Single ? _framebuffer : _root_window->framebuffer ();
185187
186- // Combine areas that overlap
188+ // Combine areas that overlap
187189 auto it = invalid_areas.begin ();
188190 while (it != invalid_areas.end ()) {
191+ // If the area collides with a window that blurs behind it, we need to redraw that entire window's area
192+ for (auto & window : _windows) {
193+ if (window->blurs_behind () && it->collides (window->absolute_shadow_rect ()))
194+ *it = it->combine (window->absolute_shadow_rect ());
195+ }
196+
189197 bool remove_area = false ;
190198 for (auto & other_area : invalid_areas) {
191199 if (&*it != &other_area && it->collides (other_area)) {
@@ -227,7 +235,7 @@ void Display::repaint() {
227235 auto transformed_overlap = overlap_abs.transform ({-window_abs.x , -window_abs.y });
228236 if (window->uses_alpha ()) {
229237 if (window->blurs_behind ())
230- fb.blur (overlap_abs);
238+ fb.blur (overlap_abs, BLUR_RADIUS );
231239 fb.copy_blitting (window->framebuffer (), transformed_overlap, overlap_abs.position ());
232240 } else {
233241 fb.copy (window->framebuffer (), transformed_overlap, overlap_abs.position ());
0 commit comments