mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[apps/round_cursor_view] Add comment about flaw in algorithm
This commit is contained in:
committed by
EmilieNumworks
parent
a0c5a1fe1c
commit
e7988b9fa2
@@ -66,11 +66,40 @@ bool RoundCursorView::eraseCursorIfPossible() {
|
||||
return false;
|
||||
}
|
||||
// Erase the cursor
|
||||
KDColor cursorWorkingBuffer[Dots::LargeDotDiameter*Dots::LargeDotDiameter];
|
||||
KDColor cursorWorkingBuffer[k_cursorSize * k_cursorSize];
|
||||
KDContext * ctx = KDIonContext::sharedContext();
|
||||
ctx->setOrigin(currentFrame.origin());
|
||||
ctx->setClippingRect(currentFrame);
|
||||
ctx->fillRectWithPixels(KDRect(0,0,k_cursorSize, k_cursorSize), m_underneathPixelBuffer, cursorWorkingBuffer);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ public:
|
||||
m_width(width), m_height(height) {}
|
||||
constexpr KDCoordinate width() const { return m_width; }
|
||||
constexpr KDCoordinate height() const { return m_height; }
|
||||
bool operator==(const KDSize &other) const {
|
||||
return m_width == other.width() && m_height == other.height();
|
||||
}
|
||||
private:
|
||||
KDCoordinate m_width;
|
||||
KDCoordinate m_height;
|
||||
|
||||
Reference in New Issue
Block a user