From 959ef2e681ee46f6556e89f125b1d0652a065740 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 12 Jan 2019 16:56:55 +0100 Subject: [PATCH] Fix rect drawing to grok new Rect semantics. --- Widgets/Painter.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Widgets/Painter.cpp b/Widgets/Painter.cpp index 0ece88bc7d9..9be1d85326c 100644 --- a/Widgets/Painter.cpp +++ b/Widgets/Painter.cpp @@ -33,9 +33,9 @@ void Painter::fillRect(const Rect& rect, Color color) Rect r = rect; r.moveBy(m_translation); - for (int y = max(r.top(), m_clipRect.top()); y < min(r.bottom(), m_clipRect.bottom()); ++y) { + for (int y = max(r.top(), m_clipRect.top()); y <= min(r.bottom(), m_clipRect.bottom()); ++y) { auto* bits = m_target->scanline(y); - for (int x = max(r.left(), m_clipRect.left()); x < min(r.right(), m_clipRect.right()); ++x) { + for (int x = max(r.left(), m_clipRect.left()); x <= min(r.right(), m_clipRect.right()); ++x) { bits[x] = color.value(); } } @@ -46,17 +46,17 @@ void Painter::drawRect(const Rect& rect, Color color) Rect r = rect; r.moveBy(m_translation); - for (int y = max(r.top(), m_clipRect.top()); y < min(r.bottom(), m_clipRect.bottom()); ++y) { + for (int y = max(r.top(), m_clipRect.top()); y <= min(r.bottom(), m_clipRect.bottom()); ++y) { auto* bits = m_target->scanline(y); - if (y == r.top() || y == (r.bottom() - 1)) { - for (int x = max(r.left(), m_clipRect.left()); x < min(r.right(), m_clipRect.right()); ++x) { + if (y == r.top() || y == r.bottom()) { + for (int x = max(r.left(), m_clipRect.left()); x <= min(r.right(), m_clipRect.right()); ++x) { bits[x] = color.value(); } } else { if (r.left() >= m_clipRect.left() && r.left() < m_clipRect.right()) bits[r.left()] = color.value(); if (r.right() >= m_clipRect.left() && r.right() < m_clipRect.right()) - bits[r.right() - 1] = color.value(); + bits[r.right()] = color.value(); } } }