Diffstat (limited to 'noncore/graphics/drawpad/drawpadcanvas.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp index 423ef26..5d0c6e4 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.cpp +++ b/noncore/graphics/drawpad/drawpadcanvas.cpp @@ -507,26 +507,28 @@ void DrawPadCanvas::contentsMousePressEvent(QMouseEvent* e) void DrawPadCanvas::contentsMouseReleaseEvent(QMouseEvent* e) { m_pDrawPad->tool()->mouseReleaseEvent(e); } void DrawPadCanvas::contentsMouseMoveEvent(QMouseEvent* e) { m_pDrawPad->tool()->mouseMoveEvent(e); } void DrawPadCanvas::drawContents(QPainter* p, int cx, int cy, int cw, int ch) { + Page* currentPage = m_pages.current(); + if ( !currentPage ) return; // no page yet --> initialization not finished (Mickeyl) QRect clipRect(cx, cy, cw, ch); - QRect pixmapRect(0, 0, m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); + QRect pixmapRect(0, 0, currentPage->pixmap()->width(), m_pages.current()->pixmap()->height()); QRect drawRect = pixmapRect.intersect(clipRect); - p->drawPixmap(drawRect.topLeft(), *(m_pages.current()->pixmap()), drawRect); + p->drawPixmap(drawRect.topLeft(), *(currentPage->pixmap()), 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()); } } |