Skip to content

Commit

Permalink
minor optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
dk committed Jul 22, 2024
1 parent 0b28113 commit b1b714b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions img/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,11 @@ void
img_multiply_alpha( Byte * src, Byte * alpha, int alpha_step, Byte * dst, int bytes)
{
if ( alpha_step == 0 ) {
while (bytes--)
*(dst++) = *(src++) * *(alpha ) / 255.0 + .5;
if ( *alpha < 255 ) {
while (bytes--)
*(dst++) = *(src++) * *(alpha ) / 255.0 + .5;
} else if ( src != dst )
memcpy( dst, src, bytes);
} else {
while (bytes--)
*(dst++) = *(src++) * *(alpha++) / 255.0 + .5;
Expand Down

0 comments on commit b1b714b

Please sign in to comment.