[apps/shared] RoundCursorView: fix potential black trail when redrawing

cursor (issue #1458 on GitHub)
This commit is contained in:
Émilie Feral
2020-05-22 14:31:26 +02:00
parent 9a3e2c960f
commit 80015ca6aa

View File

@@ -68,37 +68,9 @@ bool RoundCursorView::eraseCursorIfPossible() {
// Erase the cursor
KDColor cursorWorkingBuffer[k_cursorSize * k_cursorSize];
KDContext * ctx = KDIonContext::sharedContext();
ctx->setOrigin(currentFrame.origin());
ctx->setOrigin(absoluteOrigin());
ctx->setClippingRect(currentFrame);
KDSize cursorSize = KDSize(k_cursorSize, k_cursorSize);
/* We assert that the visible frame is not cropped (indeed a cursor is always
* fully inside the window, thanks to panToMakeCursorVisible). Otherwise, we
* would need to change this algorithm.
*
* +---+
* | |<- frame m_underneathPixelBuffer: +---+
* +----+---+--------+ |000|
* | |xxx| |<- parentVisibleFrame |xxx|
* | +---+ | +---+
* | |
* +-----------------+
*
* +---+
* |xxx|: absoluteVisibleFrame
* +---+
*
* What we would draw with the current algorithm:
* +---+
* | |<- frame
* +----+---+--------+
* | |000| |<- parentVisibleFrame
* | +---+ |
* | |
* +-----------------+
*
* */
assert(currentFrame.size() == cursorSize);
ctx->fillRectWithPixels(KDRect(0, 0, cursorSize), m_underneathPixelBuffer, cursorWorkingBuffer);
// TODO Restore the context to previous values?
return true;