| 1636 | |
| 1637 | if ((m_focused_window->full_x() < 0 && dir_x < 0) || (m_focused_window->full_x() + m_focused_window->full_width() >= m_framebuffer.width && dir_x > 0)) |
| 1638 | dir_x = -dir_x; |
| 1639 | if ((m_focused_window->full_y() < 0 && dir_y < 0) || (m_focused_window->full_y() + m_focused_window->full_height() >= m_framebuffer.height && dir_y > 0)) |
| 1640 | dir_y = -dir_y; |
| 1641 | } |
| 1642 | |
| 1643 | if (!m_enable_debug) |
| 1644 | for (size_t i = 0; i < m_damaged_area_count; i++) |
| 1645 | invalidate(m_damaged_areas[i]); |
| 1646 | else |
| 1647 | { |
| 1648 | for (size_t i = 0; i < m_debug_area_count; i++) |
| 1649 | invalidate(m_debug_areas[i]); |
| 1650 | |
| 1651 | for (size_t i = 0; i < m_damaged_area_count; i++) |
| 1652 | for (int32_t y = m_damaged_areas[i].min_y; y < m_damaged_areas[i].max_y; y++) |
| 1653 | for (int32_t x = m_damaged_areas[i].min_x; x < m_damaged_areas[i].max_x; x++) |
| 1654 | m_framebuffer.mmap[y * m_framebuffer.width + x] = 0xFF00FF; |
| 1655 | |
| 1656 | const auto temp_areas = m_debug_areas; |
| 1657 | const auto temp_count = m_debug_area_count; |
| 1658 | |
| 1659 | m_debug_areas = m_damaged_areas; |
| 1660 | m_debug_area_count = m_damaged_area_count; |
| 1661 | |
| 1662 | for (size_t i = 0; i < temp_count; i++) |
| 1663 | add_damaged_area(temp_areas[i]); |
| 1664 | } |
| 1665 | |
| 1666 | for (size_t i = 0; i < m_damaged_area_count; i++) |
| 1667 | { |
| 1668 | const fb_msync_region region { |
| 1669 | .min_x = static_cast<uint32_t>(m_damaged_areas[i].min_x), |
| 1670 | .min_y = static_cast<uint32_t>(m_damaged_areas[i].min_y), |
| 1671 | .max_x = static_cast<uint32_t>(m_damaged_areas[i].max_x), |
| 1672 | .max_y = static_cast<uint32_t>(m_damaged_areas[i].max_y), |
| 1673 | }; |
| 1674 | ioctl(m_framebuffer.fd, FB_MSYNC_RECTANGLE, ®ion); |
| 1675 | } |
| 1676 | |
| 1677 | m_damaged_area_count = 0; |
| 1678 | } |
| 1679 | |
| 1680 | Rectangle WindowServer::cursor_area() const |
no test coverage detected