From 61c081b7462f902100abf0fe975512b9d315149d Mon Sep 17 00:00:00 2001 From: Mike Bell Date: Sat, 16 Nov 2024 23:47:09 +0000 Subject: [PATCH 1/2] Avoid clipping bottom right antialised edges --- pretty-poly.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pretty-poly.h b/pretty-poly.h index 5252d29..e7a4062 100644 --- a/pretty-poly.h +++ b/pretty-poly.h @@ -570,15 +570,15 @@ pp_rect_t render_nodes(pp_rect_t *tb) { // either 1 (at x4) or 3 (at x16) we change that to a "ceil" instead ensuring // the full tile bounds are returned if(_pp_antialias) { - rb.w += (_pp_antialias | 0b1); - rb.h += (_pp_antialias | 0b1); - } - - rb.x >>= _pp_antialias; - rb.y >>= _pp_antialias; - rb.w >>= _pp_antialias; - rb.h >>= _pp_antialias; + int maxx = rb.x + rb.w + (_pp_antialias | 0b1); + int maxy = rb.y + rb.h + (_pp_antialias | 0b1); + rb.x >>= _pp_antialias; + rb.y >>= _pp_antialias; + rb.w = (maxx >> _pp_antialias) - rb.x; + rb.h = (maxy >> _pp_antialias) - rb.y; + } + uint8_t *p_alpha_map = _pp_alpha_map_none; if(_pp_antialias == 1) p_alpha_map = _pp_alpha_map_x4; if(_pp_antialias == 2) p_alpha_map = _pp_alpha_map_x16; From ba9203adf616c81913a49de83b5cda0257615a87 Mon Sep 17 00:00:00 2001 From: Mike Bell Date: Sat, 16 Nov 2024 23:56:02 +0000 Subject: [PATCH 2/2] Fix warning --- examples/c/helpers.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/c/helpers.h b/examples/c/helpers.h index a523f3c..08b539b 100644 --- a/examples/c/helpers.h +++ b/examples/c/helpers.h @@ -14,11 +14,11 @@ typedef union { uint32_t c; } colour; -__attribute__((always_inline)) uint32_t alpha(uint32_t sa, uint32_t da) { +__attribute__((always_inline)) inline uint32_t alpha(uint32_t sa, uint32_t da) { return ((sa + 1) * (da)) >> 8; } -__attribute__((always_inline)) uint8_t blend_channel(uint8_t s, uint8_t d, uint8_t a) { +__attribute__((always_inline)) inline uint8_t blend_channel(uint8_t s, uint8_t d, uint8_t a) { return d + ((a * (s - d) + 127) >> 8); }