diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-10-13 21:09:49 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2021-10-23 11:11:00 +0200 |
commit | 8ade2f5b0495ee41868e52d48816d02249e2364d (patch) | |
tree | f308f3f937979a539e0bc8e79a6c891a87f495fd /src/nvim/marktree.h | |
parent | d0f10a7addc17149d7e63ff20705762c357eb469 (diff) | |
download | rneovim-8ade2f5b0495ee41868e52d48816d02249e2364d.tar.gz rneovim-8ade2f5b0495ee41868e52d48816d02249e2364d.tar.bz2 rneovim-8ade2f5b0495ee41868e52d48816d02249e2364d.zip |
refactor(decorations): mark decorations directly on the marktree
This allows to more quickly skip though regions which has non-decorative
marks when redrawing. This might seem like a gratuitous
micro-optimization in isolation.
But!
Soon decorations are gonna crop into other hot inner-loop paths,
including the plines.c code for calculating the horizontal and
vertical space of text. Then we want to quickly skip over regions with
"only" overlaying decorations (which do not affect text size)
Diffstat (limited to 'src/nvim/marktree.h')
-rw-r--r-- | src/nvim/marktree.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/marktree.h b/src/nvim/marktree.h index 02f73b8052..aec5def879 100644 --- a/src/nvim/marktree.h +++ b/src/nvim/marktree.h @@ -75,4 +75,11 @@ typedef struct { #define MARKTREE_PAIRED_FLAG (((uint64_t)1) << 1) #define MARKTREE_END_FLAG (((uint64_t)1) << 0) +#define DECOR_LEVELS 4 +#define DECOR_OFFSET 61 +#define DECOR_MASK (((uint64_t)(DECOR_LEVELS-1)) << DECOR_OFFSET) +static inline uint8_t mt_decor_level(uint64_t id) { + return (uint8_t)((id&DECOR_MASK) >> DECOR_OFFSET); +} + #endif // NVIM_MARKTREE_H |