diff options
author | James Magahern <james@magahern.com> | 2019-02-09 14:54:37 -0800 |
---|---|---|
committer | James Magahern <james@magahern.com> | 2019-02-09 14:54:37 -0800 |
commit | 80eb12b7c165945b366491987c4c83ff426930bc (patch) | |
tree | 92789fccb12eb102d5c2c5d28d09ba932e17a73f /src/render.h | |
parent | Multi-monitor support (diff) |
Some potentially unnecessary performance optimizations
Keep track of which "layers" are dirty using a bitfield, and only redraw the ones that
are dirty.
Diffstat (limited to 'src/render.h')
-rw-r--r-- | src/render.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/render.h b/src/render.h index d0de544..e80250f 100644 --- a/src/render.h +++ b/src/render.h @@ -22,6 +22,13 @@ typedef unsigned animation_key_t; #define ANIM_KEY_NOEXIST (kMaxAnimations + 1) +typedef enum { + LAYER_BACKGROUND = 1 << 0, + LAYER_PROMPT = 1 << 1, + LAYER_LOGO = 1 << 2, + LAYER_PASSWORD = 1 << 3, +} layer_type_t; + typedef struct { cairo_t *ctx; cairo_surface_t *surface; @@ -56,6 +63,8 @@ typedef struct { animation_t animations[kMaxAnimations]; unsigned num_animations; + layer_type_t dirty_layers; + struct auth_handle_t *auth_handle; } saver_state_t; @@ -75,7 +84,7 @@ animation_t* get_animation_for_key(saver_state_t *state, animation_key_t anim_ke void update_animations(saver_state_t *state); // Background -void draw_background(saver_state_t *state); +void draw_background(saver_state_t *state, double x, double y, double width, double height); // The purple sidebar void draw_logo(saver_state_t *state); @@ -83,4 +92,8 @@ void draw_logo(saver_state_t *state); // The status string and paassword field void draw_password_field(saver_state_t *state); +// Convenience function for getting layer dirty state +bool layer_needs_draw(saver_state_t *state, const layer_type_t type); +// Convenience function for setting layer dirty state +void set_layer_needs_draw(saver_state_t *state, const layer_type_t type, bool needs_draw); |