forked from minhngoc25a/freetype2
[base] Clean up bitmap conversion.
* src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): Use appropriate FT_DivFix and remove superfluous upscaling.
This commit is contained in:
parent
2f52df4a0d
commit
35576bf067
|
@ -1,3 +1,10 @@
|
|||
2014-07-11 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||
|
||||
[base] Clean up bitmap conversion.
|
||||
|
||||
* src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): Use
|
||||
appropriate FT_DivFix and remove superfluous upscaling.
|
||||
|
||||
2014-07-04 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||
|
||||
[base] Small optimization of the ancient code.
|
||||
|
|
|
@ -401,10 +401,9 @@
|
|||
*/
|
||||
|
||||
/* Undo premultification, get the number in a 16.16 form. */
|
||||
b = FT_MulDiv( b, 65536, a );
|
||||
g = FT_MulDiv( g, 65536, a );
|
||||
r = FT_MulDiv( r, 65536, a );
|
||||
a = a * 256;
|
||||
b = FT_DivFix( b, a );
|
||||
g = FT_DivFix( g, a );
|
||||
r = FT_DivFix( r, a );
|
||||
|
||||
/* Apply gamma of 2.0 instead of 2.2. */
|
||||
b = FT_MulFix( b, b );
|
||||
|
@ -425,10 +424,10 @@
|
|||
* - If alpha is zero and luminosity is zero, we want 255.
|
||||
* - If alpha is zero and luminosity is one, we want 0.
|
||||
*
|
||||
* So the formula is a * (1 - l).
|
||||
* So the formula is a * (1 - l) = a - l * a.
|
||||
*/
|
||||
|
||||
return (FT_Byte)( FT_MulFix( 65535 - l, a ) >> 8 );
|
||||
return a - (FT_Byte)FT_MulFix( l, a );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue