Quote:
Originally Posted by AGS
Why not? Here is my func. All you have to do is to check if the alpha value you read is $00, then skip the muls and divs! Not? You also can take an alpha value of $FF as a special case where you just copy a pixel.
Code:
calc_pixels ; apply ARGB data onto RGB data
moveq #0,d0 ; image
moveq #0,d1 ; screen
moveq #0,d2 ; alpha
move.w #255,d3
.loop move.b (a0)+,d2 ; get alpha value
move.b (a0)+,d0
move.b (a1),d1
sub.w d1,d0
muls.w d2,d0
divs.w d3,d0
add.w d1,d0
move.b d0,(a1)+
....
dbf d7,.loop
rts

Why not instead of dividing by 255 doing a multiplication with 257 and a simple swap of D0, which means dividing by 65536 ??
1 / 255 = 0,00392156
257 / 65536 = 0,00392150
And you can
calculate alpha * 257 just once and reuse it for all three RGB components.
So, you will need only one LSL #8,D2 plus ADD and three MULS.L plus SWAP instructions, but no DIVS.W.