mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-17 22:58:26 +00:00
committed by
Christian Helmuth
parent
5e862b2cd3
commit
cfd013a01a
@ -17,18 +17,17 @@
|
||||
/**
|
||||
* Calculate quadratic bezier curve
|
||||
*
|
||||
* \param draw_line functor to be called to draw a line segment
|
||||
* \param levels number of sub divisions
|
||||
* \param draw_line_fn functor to be called to draw a line segment
|
||||
* \param levels number of sub divisions
|
||||
*
|
||||
* The coordinates are specified in clock-wise order with point 1 being
|
||||
* the start and point 3 the end of the curve.
|
||||
*/
|
||||
template <typename FUNC>
|
||||
static inline void bezier(long x1, long y1, long x2, long y2, long x3, long y3,
|
||||
FUNC const &draw_line, unsigned levels)
|
||||
auto const &draw_line_fn, unsigned levels)
|
||||
{
|
||||
if (levels-- == 0) {
|
||||
draw_line(x1, y1, x3, y3);
|
||||
draw_line_fn(x1, y1, x3, y3);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -36,8 +35,8 @@ static inline void bezier(long x1, long y1, long x2, long y2, long x3, long y3,
|
||||
x23 = (x2 + x3) / 2, y23 = (y2 + y3) / 2,
|
||||
x123 = (x12 + x23) / 2, y123 = (y12 + y23) / 2;
|
||||
|
||||
bezier(x1, y1, x12, y12, x123, y123, draw_line, levels);
|
||||
bezier(x123, y123, x23, y23, x3, y3, draw_line, levels);
|
||||
bezier(x1, y1, x12, y12, x123, y123, draw_line_fn, levels);
|
||||
bezier(x123, y123, x23, y23, x3, y3, draw_line_fn, levels);
|
||||
}
|
||||
|
||||
|
||||
@ -47,13 +46,12 @@ static inline void bezier(long x1, long y1, long x2, long y2, long x3, long y3,
|
||||
* The arguments correspond to those of the quadratic version but with point 4
|
||||
* being the end of the curve.
|
||||
*/
|
||||
template <typename FUNC>
|
||||
static inline void bezier(long x1, long y1, long x2, long y2,
|
||||
long x3, long y3, long x4, long y4,
|
||||
FUNC const &draw_line, unsigned levels)
|
||||
auto const &draw_line_fn, unsigned levels)
|
||||
{
|
||||
if (levels-- == 0) {
|
||||
draw_line(x1, y1, x4, y4);
|
||||
draw_line_fn(x1, y1, x4, y4);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -64,8 +62,8 @@ static inline void bezier(long x1, long y1, long x2, long y2,
|
||||
x234 = (x23 + x34) / 2, y234 = (y23 + y34) / 2,
|
||||
x1234 = (x123 + x234) / 2, y1234 = (y123 + y234) / 2;
|
||||
|
||||
bezier(x1, y1, x12, y12, x123, y123, x1234, y1234, draw_line, levels);
|
||||
bezier(x1234, y1234, x234, y234, x34, y34, x4, y4, draw_line, levels);
|
||||
bezier(x1, y1, x12, y12, x123, y123, x1234, y1234, draw_line_fn, levels);
|
||||
bezier(x1234, y1234, x234, y234, x34, y34, x4, y4, draw_line_fn, levels);
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__GEMS__BEZIER_H_ */
|
||||
|
@ -77,8 +77,7 @@ class Genode::Dirty_rect
|
||||
* The functor 'fn' takes a 'Rect const &' as argument.
|
||||
* This method resets the dirty rectangles.
|
||||
*/
|
||||
template <typename FN>
|
||||
void flush(FN const &fn)
|
||||
void flush(auto const &fn)
|
||||
{
|
||||
/*
|
||||
* Merge rectangles if their compound is smaller than sum of their
|
||||
|
@ -29,8 +29,7 @@ namespace Genode {
|
||||
/**
|
||||
* Return the number of characters needed when rendering 'args' as text
|
||||
*/
|
||||
template <typename... ARGS>
|
||||
static unsigned printed_length(ARGS &&... args)
|
||||
static unsigned printed_length(auto &&... args)
|
||||
{
|
||||
struct _Output : Output
|
||||
{
|
||||
|
Reference in New Issue
Block a user