Alexandre Julliard : gdi32: Don't bother computing the gamma ramp when not used.

Alexandre Julliard julliard at winehq.org
Mon May 3 16:37:04 CDT 2021


Module: wine
Branch: master
Commit: f2068ec4387fcdd77c1d51b6ece46885fcf607c7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f2068ec4387fcdd77c1d51b6ece46885fcf607c7

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon May  3 09:48:00 2021 +0200

gdi32: Don't bother computing the gamma ramp when not used.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/font.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 067d76ba9fd..43c743bd281 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -4009,10 +4009,13 @@ static void init_font_options(void)
        This looks roughly similar to Windows Native with the same registry value.
        MS GDI seems to be rasterizing the outline at a different rate than FreeType. */
     gamma = 1000 * gamma / 1400;
-    for (i = 0; i < 256; i++)
+    if (gamma != 1000)
     {
-        font_gamma_ramp.encode[i] = pow( i / 255., 1000. / gamma ) * 255. + .5;
-        font_gamma_ramp.decode[i] = pow( i / 255., gamma / 1000. ) * 255. + .5;
+        for (i = 0; i < 256; i++)
+        {
+            font_gamma_ramp.encode[i] = pow( i / 255., 1000. / gamma ) * 255. + .5;
+            font_gamma_ramp.decode[i] = pow( i / 255., gamma / 1000. ) * 255. + .5;
+        }
     }
     font_gamma_ramp.gamma = gamma;
     TRACE("gamma %d\n", font_gamma_ramp.gamma);




More information about the wine-cvs mailing list