Files
Upsilon/apps/shared/round_cursor_view.h
Émilie Feral d61336936e [apps/shared] Create a class Dots to share dots masks between CurveView
and RoundCursorView. Use the same dot for illustrations of additional
results in Calculation app and Function app
2020-02-12 15:13:21 +01:00

34 lines
930 B
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 1
class RoundCursorView : public CursorView {
public:
RoundCursorView(KDColor color = KDColorBlack) : m_color(color), m_underneathPixelBufferLoaded(false) {}
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:
#ifdef GRAPH_CURSOR_SPEEDUP
bool eraseCursorIfPossible();
#endif
constexpr static int k_cursorSize = Dots::LargeDotDiameter;
mutable KDColor m_underneathPixelBuffer[k_cursorSize*k_cursorSize];
KDColor m_color;
mutable bool m_underneathPixelBufferLoaded;
};
}
#endif