Changeset View
Changeset View
Standalone View
Standalone View
views/kpView_Paint.cpp
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | |||||
54 | QRect kpView::paintEventGetDocRect (const QRect &viewRect) const | 54 | QRect kpView::paintEventGetDocRect (const QRect &viewRect) const | ||
55 | { | 55 | { | ||
56 | qCDebug(kpLogViews) << "kpView::paintEventGetDocRect(" << viewRect << ")"; | 56 | qCDebug(kpLogViews) << "kpView::paintEventGetDocRect(" << viewRect << ")"; | ||
57 | 57 | | |||
58 | QRect docRect; | 58 | QRect docRect; | ||
59 | 59 | | |||
60 | // From the "we aren't sure whether to round up or round down" department: | 60 | // From the "we aren't sure whether to round up or round down" department: | ||
61 | 61 | | |||
62 | if (zoomLevelX () < 100 || zoomLevelY () < 100) | 62 | if (zoomLevelX () < 100 || zoomLevelY () < 100) { | ||
63 | docRect = transformViewToDoc (viewRect); | 63 | docRect = transformViewToDoc (viewRect); | ||
64 | } | ||||
64 | else | 65 | else | ||
65 | { | 66 | { | ||
66 | // think of a grid - you need to fully cover the zoomed-in pixels | 67 | // think of a grid - you need to fully cover the zoomed-in pixels | ||
67 | // when docRect is zoomed back to the view later | 68 | // when docRect is zoomed back to the view later | ||
68 | docRect = QRect (transformViewToDoc (viewRect.topLeft ()), // round down | 69 | docRect = QRect (transformViewToDoc (viewRect.topLeft ()), // round down | ||
69 | transformViewToDoc (viewRect.bottomRight ())); // round down | 70 | transformViewToDoc (viewRect.bottomRight ())); // round down | ||
70 | } | 71 | } | ||
71 | 72 | | |||
Show All 31 Lines | 102 | qCDebug(kpLogViews) << "kpView::drawTransparentBackground() patternOrigin=" | |||
103 | << " viewRect=" << viewRect | 104 | << " viewRect=" << viewRect | ||
104 | << " isPreview=" << isPreview; | 105 | << " isPreview=" << isPreview; | ||
105 | 106 | | |||
106 | const int cellSize = !isPreview ? 16 : 10; | 107 | const int cellSize = !isPreview ? 16 : 10; | ||
107 | 108 | | |||
108 | // TODO: % is unpredictable with negatives. | 109 | // TODO: % is unpredictable with negatives. | ||
109 | 110 | | |||
110 | int starty = viewRect.y (); | 111 | int starty = viewRect.y (); | ||
111 | if ((starty - patternOrigin.y ()) % cellSize) | 112 | if ((starty - patternOrigin.y ()) % cellSize) { | ||
112 | starty -= ((starty - patternOrigin.y ()) % cellSize); | 113 | starty -= ((starty - patternOrigin.y ()) % cellSize); | ||
114 | } | ||||
113 | 115 | | |||
114 | int startx = viewRect.x (); | 116 | int startx = viewRect.x (); | ||
115 | if ((startx - patternOrigin.x ()) % cellSize) | 117 | if ((startx - patternOrigin.x ()) % cellSize) { | ||
116 | startx -= ((startx - patternOrigin.x ()) % cellSize); | 118 | startx -= ((startx - patternOrigin.x ()) % cellSize); | ||
119 | } | ||||
117 | 120 | | |||
118 | qCDebug(kpLogViews) << "\tstartXY=" << QPoint (startx, starty); | 121 | qCDebug(kpLogViews) << "\tstartXY=" << QPoint (startx, starty); | ||
119 | 122 | | |||
120 | painter->save (); | 123 | painter->save (); | ||
121 | 124 | | |||
122 | // Clip to <viewRect> as we may draw outside it on all sides. | 125 | // Clip to <viewRect> as we may draw outside it on all sides. | ||
123 | painter->setClipRect (viewRect, Qt::IntersectClip/*honor existing clip*/); | 126 | painter->setClipRect (viewRect, Qt::IntersectClip/*honor existing clip*/); | ||
124 | 127 | | |||
125 | for (int y = starty; y <= viewRect.bottom (); y += cellSize) | 128 | for (int y = starty; y <= viewRect.bottom (); y += cellSize) | ||
126 | { | 129 | { | ||
127 | for (int x = startx; x <= viewRect.right (); x += cellSize) | 130 | for (int x = startx; x <= viewRect.right (); x += cellSize) | ||
128 | { | 131 | { | ||
129 | bool parity = ((x - patternOrigin.x ()) / cellSize + | 132 | bool parity = ((x - patternOrigin.x ()) / cellSize + | ||
130 | (y - patternOrigin.y ()) / cellSize) % 2; | 133 | (y - patternOrigin.y ()) / cellSize) % 2; | ||
131 | QColor col; | 134 | QColor col; | ||
132 | 135 | | |||
133 | if (parity) | 136 | if (parity) | ||
134 | { | 137 | { | ||
135 | if (!isPreview) | 138 | if (!isPreview) { | ||
136 | col = QColor (213, 213, 213); | 139 | col = QColor (213, 213, 213); | ||
137 | else | 140 | } | ||
141 | else { | ||||
138 | col = QColor (224, 224, 224); | 142 | col = QColor (224, 224, 224); | ||
139 | } | 143 | } | ||
140 | else | 144 | } | ||
145 | else { | ||||
141 | col = Qt::white; | 146 | col = Qt::white; | ||
147 | } | ||||
142 | 148 | | |||
143 | painter->fillRect (x, y, cellSize, cellSize, col); | 149 | painter->fillRect (x, y, cellSize, cellSize, col); | ||
144 | } | 150 | } | ||
145 | } | 151 | } | ||
146 | 152 | | |||
147 | painter->restore (); | 153 | painter->restore (); | ||
148 | } | 154 | } | ||
149 | 155 | | |||
150 | //--------------------------------------------------------------------- | 156 | //--------------------------------------------------------------------- | ||
151 | 157 | | |||
152 | // protected | 158 | // protected | ||
153 | void kpView::paintEventDrawCheckerBoard (QPainter *painter, const QRect &viewRect) | 159 | void kpView::paintEventDrawCheckerBoard (QPainter *painter, const QRect &viewRect) | ||
154 | { | 160 | { | ||
155 | qCDebug(kpLogViews) << "kpView(" << objectName () | 161 | qCDebug(kpLogViews) << "kpView(" << objectName () | ||
156 | << ")::paintEventDrawCheckerBoard(viewRect=" << viewRect | 162 | << ")::paintEventDrawCheckerBoard(viewRect=" << viewRect | ||
157 | << ") origin=" << origin () << endl; | 163 | << ") origin=" << origin (); | ||
158 | 164 | | |||
159 | kpDocument *doc = document (); | 165 | kpDocument *doc = document (); | ||
160 | if (!doc) | 166 | if (!doc) { | ||
161 | return; | 167 | return; | ||
168 | } | ||||
162 | 169 | | |||
163 | QPoint patternOrigin = origin (); | 170 | QPoint patternOrigin = origin (); | ||
164 | 171 | | |||
165 | if (scrollableContainer ()) | 172 | if (scrollableContainer ()) | ||
166 | { | 173 | { | ||
167 | qCDebug(kpLogViews) << "\tscrollableContainer: contents[XY]=" | 174 | qCDebug(kpLogViews) << "\tscrollableContainer: contents[XY]=" | ||
168 | << QPoint (scrollableContainer ()->horizontalScrollBar()->value (), | 175 | << QPoint (scrollableContainer ()->horizontalScrollBar()->value (), | ||
169 | scrollableContainer ()->verticalScrollBar()->value ()); | 176 | scrollableContainer ()->verticalScrollBar()->value ()); | ||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 196 | { | |||
212 | 219 | | |||
213 | 220 | | |||
214 | // | 221 | // | ||
215 | // Draw selection border | 222 | // Draw selection border | ||
216 | // | 223 | // | ||
217 | 224 | | |||
218 | kpViewManager *vm = viewManager (); | 225 | kpViewManager *vm = viewManager (); | ||
219 | qCDebug(kpLogViews) << "\tsel border visible=" | 226 | qCDebug(kpLogViews) << "\tsel border visible=" | ||
220 | << vm->selectionBorderVisible () | 227 | << vm->selectionBorderVisible (); | ||
221 | << endl; | | |||
222 | if (vm->selectionBorderVisible ()) | 228 | if (vm->selectionBorderVisible ()) | ||
223 | { | 229 | { | ||
224 | sel->paintBorder (destPixmap, docRect, vm->selectionBorderFinished ()); | 230 | sel->paintBorder (destPixmap, docRect, vm->selectionBorderFinished ()); | ||
225 | } | 231 | } | ||
226 | 232 | | |||
227 | 233 | | |||
228 | // | 234 | // | ||
229 | // Draw text cursor | 235 | // Draw text cursor | ||
230 | // | 236 | // | ||
231 | 237 | | |||
232 | // TODO: It would be nice to display the text cursor even if it's not | 238 | // TODO: It would be nice to display the text cursor even if it's not | ||
233 | // within the text box (this can happen if the text box is too | 239 | // within the text box (this can happen if the text box is too | ||
234 | // small for the text it contains). | 240 | // small for the text it contains). | ||
235 | // | 241 | // | ||
236 | // However, too much selection repaint code assumes that it | 242 | // However, too much selection repaint code assumes that it | ||
237 | // only paints inside its kpAbstractSelection::boundingRect(). | 243 | // only paints inside its kpAbstractSelection::boundingRect(). | ||
238 | kpTextSelection *textSel = dynamic_cast <kpTextSelection *> (sel); | 244 | auto *textSel = dynamic_cast <kpTextSelection *> (sel); | ||
239 | if (textSel && | 245 | if (textSel && | ||
240 | vm->textCursorEnabled () && | 246 | vm->textCursorEnabled () && | ||
241 | (vm->textCursorBlinkState () || | 247 | (vm->textCursorBlinkState () || | ||
242 | // For the current main window: | 248 | // For the current main window: | ||
243 | // As long as _any_ view has focus, blink _all_ views not just the | 249 | // As long as _any_ view has focus, blink _all_ views not just the | ||
244 | // one with focus. | 250 | // one with focus. | ||
245 | !vm->hasAViewWithFocus ())) // sync: call will break when vm is not held by 1 mainWindow | 251 | !vm->hasAViewWithFocus ())) // sync: call will break when vm is not held by 1 mainWindow | ||
246 | { | 252 | { | ||
Show All 10 Lines | |||||
257 | } | 263 | } | ||
258 | 264 | | |||
259 | //--------------------------------------------------------------------- | 265 | //--------------------------------------------------------------------- | ||
260 | 266 | | |||
261 | // protected | 267 | // protected | ||
262 | void kpView::paintEventDrawSelectionResizeHandles (const QRect &clipRect) | 268 | void kpView::paintEventDrawSelectionResizeHandles (const QRect &clipRect) | ||
263 | { | 269 | { | ||
264 | qCDebug(kpLogViews) << "kpView::paintEventDrawSelectionResizeHandles(" | 270 | qCDebug(kpLogViews) << "kpView::paintEventDrawSelectionResizeHandles(" | ||
265 | << clipRect << ")" << endl; | 271 | << clipRect << ")"; | ||
266 | 272 | | |||
267 | if (!selectionLargeEnoughToHaveResizeHandles ()) | 273 | if (!selectionLargeEnoughToHaveResizeHandles ()) | ||
268 | { | 274 | { | ||
269 | qCDebug(kpLogViews) << "\tsel not large enough to have resize handles"; | 275 | qCDebug(kpLogViews) << "\tsel not large enough to have resize handles"; | ||
270 | return; | 276 | return; | ||
271 | } | 277 | } | ||
272 | 278 | | |||
273 | kpViewManager *vm = viewManager (); | 279 | kpViewManager *vm = viewManager (); | ||
Show All 14 Lines | |||||
288 | QRegion selResizeHandlesRegion = selectionResizeHandlesViewRegion (true/*for renderer*/); | 294 | QRegion selResizeHandlesRegion = selectionResizeHandlesViewRegion (true/*for renderer*/); | ||
289 | qCDebug(kpLogViews) << "\tsel resize handles view region=" | 295 | qCDebug(kpLogViews) << "\tsel resize handles view region=" | ||
290 | << selResizeHandlesRegion; | 296 | << selResizeHandlesRegion; | ||
291 | 297 | | |||
292 | QPainter painter(this); | 298 | QPainter painter(this); | ||
293 | painter.setPen(Qt::black); | 299 | painter.setPen(Qt::black); | ||
294 | painter.setBrush(Qt::cyan); | 300 | painter.setBrush(Qt::cyan); | ||
295 | 301 | | |||
296 | foreach (const QRect &r, selResizeHandlesRegion.rects()) | 302 | for (const auto &r : selResizeHandlesRegion.rects()) { | ||
297 | painter.drawRect(r); | 303 | painter.drawRect(r); | ||
298 | } | 304 | } | ||
305 | } | ||||
299 | 306 | | |||
300 | //--------------------------------------------------------------------- | 307 | //--------------------------------------------------------------------- | ||
301 | 308 | | |||
302 | // protected | 309 | // protected | ||
303 | void kpView::paintEventDrawTempImage (QImage *destPixmap, const QRect &docRect) | 310 | void kpView::paintEventDrawTempImage (QImage *destPixmap, const QRect &docRect) | ||
304 | { | 311 | { | ||
305 | kpViewManager *vm = viewManager (); | 312 | kpViewManager *vm = viewManager (); | ||
306 | if (!vm) | 313 | if (!vm) { | ||
307 | return; | 314 | return; | ||
315 | } | ||||
308 | 316 | | |||
309 | const kpTempImage *tpi = vm->tempImage (); | 317 | const kpTempImage *tpi = vm->tempImage (); | ||
310 | qCDebug(kpLogViews) << "kpView::paintEventDrawTempImage() tempImage=" | 318 | qCDebug(kpLogViews) << "kpView::paintEventDrawTempImage() tempImage=" | ||
311 | << tpi | 319 | << tpi | ||
312 | << " isVisible=" | 320 | << " isVisible=" | ||
313 | << (tpi ? tpi->isVisible (vm) : false); | 321 | << (tpi ? tpi->isVisible (vm) : false); | ||
314 | 322 | | |||
315 | if (!tpi || !tpi->isVisible (vm)) | 323 | if (!tpi || !tpi->isVisible (vm)) { | ||
316 | return; | 324 | return; | ||
325 | } | ||||
317 | 326 | | |||
318 | tpi->paint (destPixmap, docRect); | 327 | tpi->paint (destPixmap, docRect); | ||
319 | } | 328 | } | ||
320 | 329 | | |||
321 | //--------------------------------------------------------------------- | 330 | //--------------------------------------------------------------------- | ||
322 | 331 | | |||
323 | // protected | 332 | // protected | ||
324 | void kpView::paintEventDrawGridLines (QPainter *painter, const QRect &viewRect) | 333 | void kpView::paintEventDrawGridLines (QPainter *painter, const QRect &viewRect) | ||
325 | { | 334 | { | ||
326 | int hzoomMultiple = zoomLevelX () / 100; | 335 | int hzoomMultiple = zoomLevelX () / 100; | ||
327 | int vzoomMultiple = zoomLevelY () / 100; | 336 | int vzoomMultiple = zoomLevelY () / 100; | ||
328 | 337 | | |||
329 | painter->setPen(Qt::gray); | 338 | painter->setPen(Qt::gray); | ||
330 | 339 | | |||
331 | // horizontal lines | 340 | // horizontal lines | ||
332 | int starty = viewRect.top(); | 341 | int starty = viewRect.top(); | ||
333 | if (starty % vzoomMultiple) | 342 | if (starty % vzoomMultiple) { | ||
334 | starty = (starty + vzoomMultiple) / vzoomMultiple * vzoomMultiple; | 343 | starty = (starty + vzoomMultiple) / vzoomMultiple * vzoomMultiple; | ||
344 | } | ||||
335 | 345 | | |||
336 | for (int y = starty; y <= viewRect.bottom(); y += vzoomMultiple) | 346 | for (int y = starty; y <= viewRect.bottom(); y += vzoomMultiple) { | ||
337 | painter->drawLine(viewRect.left(), y, viewRect.right(), y); | 347 | painter->drawLine(viewRect.left(), y, viewRect.right(), y); | ||
348 | } | ||||
338 | 349 | | |||
339 | // vertical lines | 350 | // vertical lines | ||
340 | int startx = viewRect.left(); | 351 | int startx = viewRect.left(); | ||
341 | if (startx % hzoomMultiple) | 352 | if (startx % hzoomMultiple) { | ||
342 | startx = (startx + hzoomMultiple) / hzoomMultiple * hzoomMultiple; | 353 | startx = (startx + hzoomMultiple) / hzoomMultiple * hzoomMultiple; | ||
354 | } | ||||
343 | 355 | | |||
344 | for (int x = startx; x <= viewRect.right(); x += hzoomMultiple) | 356 | for (int x = startx; x <= viewRect.right(); x += hzoomMultiple) { | ||
345 | painter->drawLine(x, viewRect.top (), x, viewRect.bottom()); | 357 | painter->drawLine(x, viewRect.top (), x, viewRect.bottom()); | ||
346 | } | 358 | } | ||
359 | } | ||||
347 | 360 | | |||
348 | //--------------------------------------------------------------------- | 361 | //--------------------------------------------------------------------- | ||
349 | 362 | | |||
350 | // This is called "_Unclipped" because it may draw outside of | 363 | // This is called "_Unclipped" because it may draw outside of | ||
351 | // <viewRect>. | 364 | // <viewRect>. | ||
352 | // | 365 | // | ||
353 | // There are 2 reasons for doing so: | 366 | // There are 2 reasons for doing so: | ||
354 | // | 367 | // | ||
Show All 28 Lines | 393 | { | |||
383 | qCDebug(kpLogViews) << "\tviewRect=" << viewRect; | 396 | qCDebug(kpLogViews) << "\tviewRect=" << viewRect; | ||
384 | 397 | | |||
385 | kpViewManager *vm = viewManager (); | 398 | kpViewManager *vm = viewManager (); | ||
386 | const kpDocument *doc = document (); | 399 | const kpDocument *doc = document (); | ||
387 | 400 | | |||
388 | Q_ASSERT (vm); | 401 | Q_ASSERT (vm); | ||
389 | Q_ASSERT (doc); | 402 | Q_ASSERT (doc); | ||
390 | 403 | | |||
391 | if (viewRect.isEmpty ()) | 404 | if (viewRect.isEmpty ()) { | ||
392 | return; | 405 | return; | ||
406 | } | ||||
393 | 407 | | |||
394 | QRect docRect = paintEventGetDocRect (viewRect); | 408 | QRect docRect = paintEventGetDocRect (viewRect); | ||
395 | 409 | | |||
396 | qCDebug(kpLogViews) << "\tdocRect=" << docRect; | 410 | qCDebug(kpLogViews) << "\tdocRect=" << docRect; | ||
397 | 411 | | |||
398 | QPainter painter (this); | 412 | QPainter painter (this); | ||
399 | //painter.setCompositionMode(QPainter::CompositionMode_Source); | 413 | //painter.setCompositionMode(QPainter::CompositionMode_Source); | ||
400 | 414 | | |||
401 | QImage docPixmap; | 415 | QImage docPixmap; | ||
402 | bool tempImageWillBeRendered = false; | 416 | bool tempImageWillBeRendered = false; | ||
403 | 417 | | |||
404 | // LOTODO: I think <docRect> being empty would be a bug. | 418 | // LOTODO: I think <docRect> being empty would be a bug. | ||
405 | if (!docRect.isEmpty ()) | 419 | if (!docRect.isEmpty ()) | ||
406 | { | 420 | { | ||
407 | docPixmap = doc->getImageAt (docRect); | 421 | docPixmap = doc->getImageAt (docRect); | ||
408 | 422 | | |||
409 | qCDebug(kpLogViews) << "\tdocPixmap.hasAlphaChannel()=" | 423 | qCDebug(kpLogViews) << "\tdocPixmap.hasAlphaChannel()=" | ||
410 | << docPixmap.hasAlphaChannel () << endl; | 424 | << docPixmap.hasAlphaChannel (); | ||
411 | 425 | | |||
412 | tempImageWillBeRendered = | 426 | tempImageWillBeRendered = | ||
413 | (!doc->selection () && | 427 | (!doc->selection () && | ||
414 | vm->tempImage () && | 428 | vm->tempImage () && | ||
415 | vm->tempImage ()->isVisible (vm) && | 429 | vm->tempImage ()->isVisible (vm) && | ||
416 | docRect.intersects (vm->tempImage ()->rect ())); | 430 | docRect.intersects (vm->tempImage ()->rect ())); | ||
417 | 431 | | |||
418 | qCDebug(kpLogViews) << "\ttempImageWillBeRendered=" << tempImageWillBeRendered | 432 | qCDebug(kpLogViews) << "\ttempImageWillBeRendered=" << tempImageWillBeRendered | ||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | 486 | { | |||
480 | kpViewManager *vm = viewManager (); | 494 | kpViewManager *vm = viewManager (); | ||
481 | 495 | | |||
482 | qCDebug(kpLogViews) << "kpView(" << objectName () << ")::paintEvent() vm=" << (bool) vm | 496 | qCDebug(kpLogViews) << "kpView(" << objectName () << ")::paintEvent() vm=" << (bool) vm | ||
483 | << " queueUpdates=" << (vm && vm->queueUpdates ()) | 497 | << " queueUpdates=" << (vm && vm->queueUpdates ()) | ||
484 | << " fastUpdates=" << (vm && vm->fastUpdates ()) | 498 | << " fastUpdates=" << (vm && vm->fastUpdates ()) | ||
485 | << " viewRect=" << e->rect () | 499 | << " viewRect=" << e->rect () | ||
486 | << " topLeft=" << QPoint (x (), y ()); | 500 | << " topLeft=" << QPoint (x (), y ()); | ||
487 | 501 | | |||
488 | if (!vm) | 502 | if (!vm) { | ||
489 | return; | 503 | return; | ||
504 | } | ||||
490 | 505 | | |||
491 | if (vm->queueUpdates ()) | 506 | if (vm->queueUpdates ()) | ||
492 | { | 507 | { | ||
493 | // OPT: if this update was due to the document, | 508 | // OPT: if this update was due to the document, | ||
494 | // use document coordinates (in case of a zoom change in | 509 | // use document coordinates (in case of a zoom change in | ||
495 | // which view coordinates become out of date) | 510 | // which view coordinates become out of date) | ||
496 | addToQueuedArea (e->region ()); | 511 | addToQueuedArea (e->region ()); | ||
497 | return; | 512 | return; | ||
498 | } | 513 | } | ||
499 | 514 | | |||
500 | kpDocument *doc = document (); | 515 | kpDocument *doc = document (); | ||
501 | if (!doc) | 516 | if (!doc) { | ||
502 | return; | 517 | return; | ||
518 | } | ||||
503 | 519 | | |||
504 | 520 | | |||
505 | // It seems that e->region() is already clipped by Qt to the visible | 521 | // It seems that e->region() is already clipped by Qt to the visible | ||
506 | // part of the view (which could be quite small inside a scrollview). | 522 | // part of the view (which could be quite small inside a scrollview). | ||
507 | QRegion viewRegion = e->region (); | 523 | const auto& viewRegion = e->region (); | ||
508 | QVector <QRect> rects = viewRegion.rects (); | 524 | QVector <QRect> rects = viewRegion.rects (); | ||
509 | qCDebug(kpLogViews) << "\t#rects = " << rects.count (); | 525 | qCDebug(kpLogViews) << "\t#rects = " << rects.count (); | ||
510 | 526 | | |||
511 | // Draw all of the requested regions of the document _before_ drawing | 527 | // Draw all of the requested regions of the document _before_ drawing | ||
512 | // the grid lines, buddy rectangle and selection resize handles. | 528 | // the grid lines, buddy rectangle and selection resize handles. | ||
513 | // This ordering is important since paintEventDrawDoc_Unclipped() | 529 | // This ordering is important since paintEventDrawDoc_Unclipped() | ||
514 | // may draw outside of the view rectangle passed to it. | 530 | // may draw outside of the view rectangle passed to it. | ||
515 | // | 531 | // | ||
516 | // To illustrate this, suppose we changed each iteration of the loop | 532 | // To illustrate this, suppose we changed each iteration of the loop | ||
517 | // to call paintEventDrawDoc_Unclipped() _and_ then, | 533 | // to call paintEventDrawDoc_Unclipped() _and_ then, | ||
518 | // paintEventDrawGridLines(). If there are 2 or more iterations of this | 534 | // paintEventDrawGridLines(). If there are 2 or more iterations of this | ||
519 | // loop, paintEventDrawDoc_Unclipped() in one iteration may draw over | 535 | // loop, paintEventDrawDoc_Unclipped() in one iteration may draw over | ||
520 | // parts of nearby grid lines (which were drawn in a previous iteration) | 536 | // parts of nearby grid lines (which were drawn in a previous iteration) | ||
521 | // with document pixels. Those grid line parts are probably not going to | 537 | // with document pixels. Those grid line parts are probably not going to | ||
522 | // be redrawn, so will appear to be missing. | 538 | // be redrawn, so will appear to be missing. | ||
523 | foreach (const QRect &r, rects) | 539 | for (const auto &r : rects) | ||
524 | { | 540 | { | ||
525 | paintEventDrawDoc_Unclipped (r); | 541 | paintEventDrawDoc_Unclipped (r); | ||
526 | } | 542 | } | ||
527 | 543 | | |||
528 | // | 544 | // | ||
529 | // Draw Grid Lines | 545 | // Draw Grid Lines | ||
530 | // | 546 | // | ||
531 | 547 | | |||
532 | if ( isGridShown() ) | 548 | if ( isGridShown() ) | ||
533 | { | 549 | { | ||
534 | QPainter painter(this); | 550 | QPainter painter(this); | ||
535 | foreach (const QRect &r, rects) | 551 | for (const auto &r : rects) | ||
536 | paintEventDrawGridLines(&painter, r); | 552 | paintEventDrawGridLines(&painter, r); | ||
537 | } | 553 | } | ||
538 | 554 | | |||
539 | const QRect r = buddyViewScrollableContainerRectangle(); | 555 | const QRect r = buddyViewScrollableContainerRectangle(); | ||
540 | if ( !r.isEmpty() ) | 556 | if ( !r.isEmpty() ) | ||
541 | { | 557 | { | ||
542 | QPainter painter(this); | 558 | QPainter painter(this); | ||
543 | 559 | | |||
Show All 15 Lines |