classic-lite

Minimalist rewrite of Łukasz Zalewski's "classic" pebble watchface
git clone https://git.instinctive.eu/classic-lite.git
Log | Files | Refs | README | LICENSE

commit 596bdb297d526c4d4534d9c948f88e20dd35cd68
parent 31dfee29fefc36a2c19f888cd476f37ad38d868f
Author: Natasha Kerensikova <natacha@instinctive.eu>
Date:   Sun, 13 Dec 2015 18:32:12 +0000

Use lines rather than arcs for minute marks in round display

For a few pixels it doesn't make much of a visual difference, while
being more than 30 times faster do draw.
Diffstat:
Msrc/classic-lite.c | 19+++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/classic-lite.c b/src/classic-lite.c @@ -349,6 +349,20 @@ background_layer_draw(Layer *layer, GContext *ctx) { } } #else +static GPoint +point_at_angle(GRect bounds, int32_t angle) { + GPoint ret; + uint32_t width = bounds.size.w; + uint32_t height = bounds.size.h; + ret.x = bounds.origin.x + + (TRIG_MAX_RATIO * (width + 1) + width * sin_lookup(angle)) + / (2 * TRIG_MAX_RATIO); + ret.y = bounds.origin.y + + (TRIG_MAX_RATIO * (height + 1) - height * cos_lookup(angle)) + / (2 * TRIG_MAX_RATIO); + return ret; +} + static void background_layer_draw(Layer *layer, GContext *ctx) { const GRect bounds = layer_get_bounds(layer); @@ -367,8 +381,9 @@ background_layer_draw(Layer *layer, GContext *ctx) { INSET_RECT(rect, bounds, 5); for (i = 0; i < 60; i += 1) { angle = TRIG_MAX_ANGLE * i / 60; - graphics_draw_arc(ctx, rect, GOvalScaleModeFillCircle, - angle - angle_delta, angle + angle_delta); + graphics_draw_line(ctx, + point_at_angle(rect, angle - angle_delta), + point_at_angle(rect, angle + angle_delta)); } }