Hi David,

>> 1) new pixels = (old pixels & mask1) | (new pixels & mask2)
>>
>> Where mask1 and mask2 are the negated forms of each other.

That one only works for boolean masks, but it works on 386.

>> This even works for alpha masks:
>>
>> 2) new pixels = (old pixels "*" mask1) "+" (new pixels "*" mask2)

That one needs a CPU and compiler which supports at least MMX
or some newer vector unit, so you are right that there is no
effective way to do this on 386 with real alpha masking.

You are right that you could first check your mask for areas
which can be done the 1) boolean way and then only do the more
costly computations with multiplications for those pixels where
the mask is neither 0.0 nor 1.0, but whether that really helps
will depend on which fraction of your pixels has 0.0 or 1.0
(or 0 and 100 percent, if you prefer) alpha masks and which
fraction has more complicated values...

Regards, Eric

PS: As http://locklessinc.com/articles/sat_arithmetic/ shows,
even saturated addition is tricky to do without having actual
hardware support for it (MMX has saturated operations, too).

Also notable: http://locklessinc.com/articles/booleans/
(testing for 0, 1 or -1)



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to