Branch: refs/heads/Cog Home: https://github.com/OpenSmalltalk/opensmalltalk-vm Commit: f77943115bbb8e55fc1adeaf54f483ecc6024bc6 https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/f77943115bbb8e55fc1... Author: Eliot Miranda eliot.miranda@gmail.com Date: 2022-02-24 (Thu, 24 Feb 2022)
Changed paths: M src/plugins/BitBltPlugin/BitBltPlugin.c
Log Message: ----------- CogVM source as per VMMaker.oscog-nice.3170/eem.3171
BitBltPlugin:
Revise the 3 new BitBlt rules again (see https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/505)
- use a proper division by 255 (factor alpha/255) in alphaScale:with: instead of approximate factor alpha/256 previously - use a proper rounding (by adding 16r80 before the division by 255) in alphaScale:with: - split the unscale ops in 3 separate r/g/b channels, otherwise, when grouping rb, the division by alpha will leak red bits not only on green components but also on blue - fixup the carry used for saturating the rbg components in case of 16rFF overflow in alphaUnscale:with:
Note: division by 255 can be checked thru this snippet (should answer 0):
(0 to: 16rFF squared) inject: 0 into: [:max :num | | rat | rat := num + 16r80. "+ 16r80 for rounding" rat := rat + (rat - 1 >> 8 bitAnd: 16rFF) >> 8 bitAnd: 16rFF. "divide by 255" ((num/255) rounded - rat) abs max: max].
Fix alphaBlendUnscaled; some bits were leaking in the neighbour color.
Use the FastCPrimitiveFlag on primitivePixelValueAt for a 38% speedup.
vm-dev@lists.squeakfoundation.org