[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [ksudoku] src/gui: Avoid using a negative index for printing from the cell-labels string.
From: Ian Wadham <iandw.au () gmail ! com>
Date: 2012-10-26 22:58:30
Message-ID: 20121026225830.5D57AA6078 () git ! kde ! org
[Download RAW message or body]
Git commit 233d2c78e33c1187f4cdb8270c958822419402fe by Ian Wadham.
Committed on 27/10/2012 at 00:53.
Pushed by ianw into branch 'master'.
Avoid using a negative index for printing from the cell-labels string.
M +7 -9 src/gui/ksudoku.cpp
http://commits.kde.org/ksudoku/233d2c78e33c1187f4cdb8270c958822419402fe
diff --git a/src/gui/ksudoku.cpp b/src/gui/ksudoku.cpp
index 3365864..8d33b41 100644
--- a/src/gui/ksudoku.cpp
+++ b/src/gui/ksudoku.cpp
@@ -778,14 +778,12 @@ void KSudoku::sendToPrinter (const Puzzle * puzzle)
if (edge & (1<<Right)) m_p->drawLine (x+sCell, y, x+sCell, y+sCell);
if (edge & (1<<Above)) m_p->drawLine (x, y, x+sCell, y);
if (edge & (1<<Below)) m_p->drawLine (x, y+sCell, x+sCell, y+sCell);
- if (puzzle->value (n) > 0) { // Draw original puzzle values dark.
- m_p->drawText (rect, Qt::AlignCenter,
- labels.mid (puzzle->value (n) - 1, 1));
- }
- else if (puzzle->value (n) == 0) {
- m_p->setPen (light); // Draw filled-in/solution values light.
- m_p->drawText (rect, Qt::AlignCenter,
- labels.mid (currentGame().value (n) - 1, 1));
+
+ // Draw original puzzle values heavy: filled-in/solution values light.
+ int v = currentGame().value (n) - 1;
+ if (v >= 0) { // Skip empty cells.
+ m_p->setPen ((puzzle->value (n) > 0) ? heavy : light);
+ m_p->drawText (rect, Qt::AlignCenter, labels.mid (v, 1));
}
}
if ((! manyUp) || (m_quadrant >= (across * down))) {
@@ -806,7 +804,7 @@ void KSudoku::endPrint()
// The current print output goes to the printer when the painter ends.
m_p->end();
delete m_p;
- m_p = 0;
+ m_p = 0;
m_quadrant = 0;
KMessageBox::information (this,
i18n ("KSudoku has sent output to your printer."));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic