Files
Upsilon/apps/shared/round_cursor_view.h
Léa Saviot 2dee8f2b1f [apps/regression] Fix cursor redrawing when changing cursor type
Scenario:
double x[numberOfPoints] = {0.0, 0.975, 1.97, 2.945, 3.971, 4.887, 5.924, 6.964, 7.979, 8.974, 9.998};
double y[numberOfPoints] = {-23.784, -23.322, -28.322, -18.422, -4.813206, 7.146241, 16.631, 16.632, 9.209189, -6.050863, -19.659};
Quadratic regression, navigate on the points then go on the
regressioncurve -> there is a drawing glitch
2019-09-30 17:05:17 +02:00

33 lines
880 B
C++

#ifndef SHARED_ROUND_CURSOR_VIEW_H
#define SHARED_ROUND_CURSOR_VIEW_H
#include "cursor_view.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) 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 = 10;
mutable KDColor m_underneathPixelBuffer[k_cursorSize*k_cursorSize];
KDColor m_color;
mutable bool m_underneathPixelBufferLoaded;
};
}
#endif