mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/shared/round_cursor_view] Fix GRAPH_CURSOR_SPEEDUP macro usage
This commit is contained in:
committed by
Léa Saviot
parent
9d1a5ea0a8
commit
503a9ed128
@@ -6,8 +6,10 @@ static KDColor s_cursorWorkingBuffer[Dots::LargeDotDiameter*Dots::LargeDotDiamet
|
||||
|
||||
void RoundCursorView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDRect r = bounds();
|
||||
#ifdef GRAPH_CURSOR_SPEEDUP
|
||||
ctx->getPixels(r, m_underneathPixelBuffer);
|
||||
m_underneathPixelBufferLoaded = true;
|
||||
#endif
|
||||
ctx->blendRectWithMask(r, m_color, (const uint8_t *)Dots::LargeDotMask, s_cursorWorkingBuffer);
|
||||
}
|
||||
|
||||
@@ -17,12 +19,14 @@ KDSize RoundCursorView::minimalSizeForOptimalDisplay() const {
|
||||
|
||||
void RoundCursorView::setColor(KDColor color) {
|
||||
m_color = color;
|
||||
#ifdef GRAPH_CURSOR_SPEEDUP
|
||||
eraseCursorIfPossible();
|
||||
#endif
|
||||
markRectAsDirty(bounds());
|
||||
}
|
||||
|
||||
void RoundCursorView::setCursorFrame(KDRect f, bool force) {
|
||||
#if GRAPH_CURSOR_SPEEDUP
|
||||
#ifdef GRAPH_CURSOR_SPEEDUP
|
||||
/* TODO This is quite dirty (we are out of the dirty tracking and we assume
|
||||
* the cursor is the upmost view) but it works well. */
|
||||
if (m_frame == f && !force) {
|
||||
|
||||
@@ -6,11 +6,16 @@
|
||||
|
||||
namespace Shared {
|
||||
|
||||
#define GRAPH_CURSOR_SPEEDUP 1
|
||||
#define GRAPH_CURSOR_SPEEDUP
|
||||
|
||||
class RoundCursorView : public CursorView {
|
||||
public:
|
||||
RoundCursorView(KDColor color = KDColorBlack) : m_color(color), m_underneathPixelBufferLoaded(false) {}
|
||||
RoundCursorView(KDColor color = KDColorBlack) :
|
||||
m_color(color)
|
||||
#ifdef GRAPH_CURSOR_SPEEDUP
|
||||
, m_underneathPixelBufferLoaded(false)
|
||||
#endif
|
||||
{}
|
||||
void drawRect(KDContext * ctx, KDRect rect) const override;
|
||||
KDSize minimalSizeForOptimalDisplay() const override;
|
||||
void setColor(KDColor color);
|
||||
@@ -23,9 +28,11 @@ private:
|
||||
bool eraseCursorIfPossible();
|
||||
#endif
|
||||
constexpr static int k_cursorSize = Dots::LargeDotDiameter;
|
||||
mutable KDColor m_underneathPixelBuffer[k_cursorSize*k_cursorSize];
|
||||
KDColor m_color;
|
||||
#ifdef GRAPH_CURSOR_SPEEDUP
|
||||
mutable KDColor m_underneathPixelBuffer[k_cursorSize*k_cursorSize];
|
||||
mutable bool m_underneathPixelBufferLoaded;
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user