summaryrefslogtreecommitdiff
authorleseb <leseb>2002-04-23 21:24:05 (UTC)
committer leseb <leseb>2002-04-23 21:24:05 (UTC)
commit0b77115683f1b8d339cdf07755e22d443caf310a (patch) (side-by-side diff)
treea37ef63fea1b3dbf9f396f7a79030e4d04629952
parent7200c56e4ccc6aa83d1a3ef86ddda9470492ab52 (diff)
downloadopie-0b77115683f1b8d339cdf07755e22d443caf310a.zip
opie-0b77115683f1b8d339cdf07755e22d443caf310a.tar.gz
opie-0b77115683f1b8d339cdf07755e22d443caf310a.tar.bz2
Fix bug when drawing page with size inferior to view size
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.cpp12
1 files changed, 11 insertions, 1 deletions
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
@@ -446,99 +446,109 @@ bool DrawPadCanvas::goPreviousPageEnabled()
return (m_pages.current() != m_pages.getFirst());
}
bool DrawPadCanvas::goNextPageEnabled()
{
return (m_pages.current() != m_pages.getLast());
}
void DrawPadCanvas::undo()
{
*(m_pages.current()) = *(m_pageBackups.prev());
viewport()->update();
emit pageBackupsChanged();
}
void DrawPadCanvas::redo()
{
*(m_pages.current()) = *(m_pageBackups.next());
viewport()->update();
emit pageBackupsChanged();
}
void DrawPadCanvas::goFirstPage()
{
m_pages.first();
m_pageBackups.clear();
m_pageBackups.append(new QPixmap(*(m_pages.current())));
resizeContents(m_pages.current()->width(), m_pages.current()->height());
viewport()->update();
emit pagesChanged();
emit pageBackupsChanged();
}
void DrawPadCanvas::goPreviousPage()
{
m_pages.prev();
m_pageBackups.clear();
m_pageBackups.append(new QPixmap(*(m_pages.current())));
resizeContents(m_pages.current()->width(), m_pages.current()->height());
viewport()->update();
emit pagesChanged();
emit pageBackupsChanged();
}
void DrawPadCanvas::goNextPage()
{
m_pages.next();
m_pageBackups.clear();
m_pageBackups.append(new QPixmap(*(m_pages.current())));
resizeContents(m_pages.current()->width(), m_pages.current()->height());
viewport()->update();
emit pagesChanged();
emit pageBackupsChanged();
}
void DrawPadCanvas::goLastPage()
{
m_pages.last();
m_pageBackups.clear();
m_pageBackups.append(new QPixmap(*(m_pages.current())));
resizeContents(m_pages.current()->width(), m_pages.current()->height());
viewport()->update();
emit pagesChanged();
emit pageBackupsChanged();
}
void DrawPadCanvas::contentsMousePressEvent(QMouseEvent* e)
{
m_pDrawPad->tool()->mousePressEvent(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)
{
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());
+ }
}