Files
Upsilon/apps/shared/round_cursor_view.h
Ruben Dashyan 8337e36f46 [apps/shared/*_cursor_view] CursorView inherits from TransparentView
so that CursorView tells its superview to redrawn in the background,
except the RoundCursorView.
2020-03-10 11:11:57 +01:00

42 lines
1.0 KiB
C++

#ifndef SHARED_ROUND_CURSOR_VIEW_H
#define SHARED_ROUND_CURSOR_VIEW_H
#include "cursor_view.h"
#include "dots.h"
namespace Shared {
#define GRAPH_CURSOR_SPEEDUP
class RoundCursorView : public CursorView {
public:
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);
void setCursorFrame(KDRect frame, bool force) override;
#ifdef GRAPH_CURSOR_SPEEDUP
void resetMemoization() const { m_underneathPixelBufferLoaded = false; }
#endif
private:
void markRectAsDirty(KDRect rect) override;
#ifdef GRAPH_CURSOR_SPEEDUP
bool eraseCursorIfPossible();
#endif
constexpr static int k_cursorSize = Dots::LargeDotDiameter;
KDColor m_color;
#ifdef GRAPH_CURSOR_SPEEDUP
mutable KDColor m_underneathPixelBuffer[k_cursorSize*k_cursorSize];
mutable bool m_underneathPixelBufferLoaded;
#endif
};
}
#endif