From 116bfab449e090d707d6e1b60f98a2fea4aeb693 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Sat, 9 Mar 2019 17:31:31 +0100 Subject: [PATCH] icon_painter.h: customizable pixel transfer This patch makes the application of color/alpha from the icon's texture to the target surface customizable by replacing the formerly built-in '_transfer_pixel' function by calls to the new 'Pixel_rgba::transfer' interface. Issue #3221 --- repos/demo/include/scout_gfx/icon_painter.h | 22 ++++----------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/repos/demo/include/scout_gfx/icon_painter.h b/repos/demo/include/scout_gfx/icon_painter.h index d671b2339..a0481e5c3 100644 --- a/repos/demo/include/scout_gfx/icon_painter.h +++ b/repos/demo/include/scout_gfx/icon_painter.h @@ -38,20 +38,6 @@ class Icon_painter * vs ... vertical slice */ - - /** - * Copy pixel with alpha - */ - template - static inline void _transfer_pixel(TPT const &src, int src_a, int alpha, SPT *dst) - { - if (src_a) { - int register a = (src_a * alpha)>>8; - if (a) *dst = SPT::mix(*dst, src, a); - } - } - - /** * Draw corner slice */ @@ -67,7 +53,7 @@ class Icon_painter SPT *d = dst; for (int i = 0; i < w; i++, s++, sa++, d++) - _transfer_pixel(*s, *sa, alpha, d); + SPT::transfer(*s, *sa, alpha, *d); src += src_pitch, src_a += src_pitch, dst += dst_pitch; } @@ -89,7 +75,7 @@ class Icon_painter SPT *d = dst; for (int i = 0; i < w; i++, d++) - _transfer_pixel(s, sa, alpha, d); + SPT::transfer(s, sa, alpha, *d); src += src_pitch, src_a += src_pitch, dst += dst_pitch; } @@ -111,7 +97,7 @@ class Icon_painter SPT *d = dst; for (int j = 0; j < h; j++, d += dst_pitch) - _transfer_pixel(s, sa, alpha, d); + SPT::transfer(s, sa, alpha, *d); src += 1, src_a += 1, dst += 1; } @@ -134,7 +120,7 @@ class Icon_painter SPT *d = dst; for (int i = 0; i < w; i++, d++) - _transfer_pixel(s, sa, alpha, d); + SPT::transfer(s, sa, alpha, *d); } }