Skip to content

Commit a0d7a8a

Browse files
author
saniv
committed
update
1 parent c01df4a commit a0d7a8a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

ffi/gfx/src/gfx.c

+8-7
Original file line numberDiff line numberDiff line change
@@ -667,13 +667,14 @@ static int ready;
667667
} while(0)
668668

669669

670-
//NOTE: X>>8 is a division by 256, while max alpha is 0xFF
671-
// this leads to some loss of precision
672-
/*sm = 0xFF - sa;
673-
sr = (sr*sm + dr*sa)>>8;
674-
sg = (sg*sm + dg*sa)>>8;
675-
sb = (sb*sm + db*sa)>>8;
676-
c = R8G8B8(sr,sg,sb);*/
670+
//NOTE: X>>8 is a division by 256, while max alpha is 0xFF
671+
// this leads to some loss of precision
672+
#define ALPHA_BLEND3 \
673+
sm = 0xFF - sa; \
674+
sr = (sr*sm + dr*sa)>>8; \
675+
sg = (sg*sm + dg*sa)>>8; \
676+
sb = (sb*sm + db*sa)>>8; \
677+
c = R8G8B8(sr,sg,sb);
677678

678679
#define ALPHA_BLEND \
679680
if (DC&0xFF000000) { \

0 commit comments

Comments
 (0)