[PATCH 1/3] dibdrv: Refactoring the gray text rendering intensities control code.

Huw Davies huw at codeweavers.com
Fri Oct 12 02:15:40 CDT 2018


On Thu, Oct 11, 2018 at 10:12:12PM +0900, Byeongsik Jeon wrote:
> r1 = ramp[aa]
> r2 = ramp[16 - aa]
> 
> min = text * r1 / 0xff
> max = r2 + ( 0xff - r2 ) * text / 0xff
> 
> dst < text:
>   diff  = text - dst
>   range = text - min
> 
>   dst   = text - diff * range / text
>         = text - ( text - dst ) * ( text - min ) / text
>         = text - ( text - dst ) * ( text - text * r1 / 0xff ) / text
>         = text - ( text - dst ) * ( 0xff - r1 ) / 0xff
>         = ( text * r1 + dst * ( 0xff - r1 )) / 0xff
>         = ( text * ramp[aa] + dst * ( 0xff - ramp[aa] )) / 0xff
> 
> dst > text:
>   diff  = dst - text
>   range = max - text
> 
>   dst   = text + diff * range / ( 0xff - text )
>         = text + ( dst - text ) * ( max - text ) / ( 0xff - text )
>         = text + ( dst - text ) * (( 0xff - text) * r2 / 0xff ) / ( 0xff - text )
>         = text + ( dst - text ) * r2 / 0xff
>         = ( dst * r2 + text * ( 0xff - r2 )) / 0xff
>         = ( dst * ramp[16 - aa] + text * ( 0xff - ramp[16 - aa] )) / 0xff
> 
> Signed-off-by: Byeongsik Jeon <bsjeon at hanmail.net>
> ---
> I focused on doing equal functions without adding new features.
> 
> It is a different formula from the usual gamma correction pattern,
> but it takes a roughly similar graph shape because it is classified
> as "dst > text".
> 
> 0.4315 to = 1/2.3:
> The gamma value is too large, so the rendering quality is bad. This
> value seems to be related to SPI_SETFONTSMOOTHINGENTRAST.
> 
> The dibdrv gray text format is limited to GGO_GRAY4_BITMAP, which lowers
> the quality of text rendering.
> 
> Is there a special reason?

The ramp values were deliberately kept out of primitive.c as these are
parameters rather than the implemention.  The numbers in the ramp
table come from comparing with the native values.

Huw.

PS, for dibdrv patches, please prefix the commit log with "gdi32:".




More information about the wine-devel mailing list