Skip to content

Commit

Permalink
nitpicker_gfx: use Blit::blend_xrgb_a
Browse files Browse the repository at this point in the history
  • Loading branch information
nfeske authored and cnuke committed Jan 28, 2025
1 parent bce093e commit 450ce70
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions repos/os/include/nitpicker_gfx/texture_painter.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ struct Texture_painter
};


using Point = Genode::Surface_base::Point;
using Rect = Genode::Surface_base::Rect;
using Point = Genode::Surface_base::Point;
using Rect = Genode::Surface_base::Rect;
using uint32_t = Genode::uint32_t;
using uint8_t = Genode::uint8_t;


template <typename PT>
Expand Down Expand Up @@ -77,7 +79,6 @@ struct Texture_painter
int i, j;
PT const *s;
PT *d;
unsigned char const *a;

switch (mode) {

Expand All @@ -98,11 +99,8 @@ struct Texture_painter
* Copy texture with alpha blending
*/
for (j = clipped.h(); j--; src += src_w, alpha += src_w, dst += dst_w)
for (i = clipped.w(), s = src, a = alpha, d = dst; i--; s++, d++, a++) {
unsigned char const alpha_value = *a;
if (__builtin_expect(alpha_value != 0, true))
*d = PT::mix(*d, *s, alpha_value + 1);
}
Blit::blend_xrgb_a((uint32_t *)dst, clipped.w(),
(uint32_t const *)src, (uint8_t const *)alpha);
break;

case MIXED:
Expand Down

0 comments on commit 450ce70

Please sign in to comment.