From 0b77115683f1b8d339cdf07755e22d443caf310a Mon Sep 17 00:00:00 2001 From: leseb Date: Tue, 23 Apr 2002 21:24:05 +0000 Subject: Fix bug when drawing page with size inferior to view size --- (limited to 'noncore') diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp index b39a633..65b3dea 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.cpp +++ b/noncore/graphics/drawpad/drawpadcanvas.cpp @@ -539,6 +539,16 @@ void DrawPadCanvas::contentsMouseMoveEvent(QMouseEvent* e) void DrawPadCanvas::drawContents(QPainter* p, int cx, int cy, int cw, int ch) { QRect clipRect(cx, cy, cw, ch); + QRect pixmapRect(0, 0, m_pages.current()->width(), m_pages.current()->height()); + QRect drawRect = pixmapRect.intersect(clipRect); - p->drawPixmap(clipRect.topLeft(), *(m_pages.current()), clipRect); + p->drawPixmap(drawRect.topLeft(), *(m_pages.current()), drawRect); + + if (drawRect.right() < clipRect.right()) { + p->fillRect(drawRect.right() + 1, cy, cw - drawRect.width(), ch, colorGroup().dark()); + } + + if (drawRect.bottom() < clipRect.bottom()) { + p->fillRect(cx, drawRect.bottom() + 1, cw, ch - drawRect.height(), colorGroup().dark()); + } } -- cgit v0.9.0.2