[gtk/glyphy2: 1/4] glyphy: remove glyphy debug code




commit d96e6848219a9ca46afd3339cdc4ae6e1cee2f2b
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Apr 4 01:14:45 2022 -0400

    glyphy: remove glyphy debug code
    
    We don't have a knob to turn this on, and it is
    not really useful outside of glyphy itself, so
    remove it.

 gsk/gl/gskglprograms.defs       |  1 -
 gsk/gl/resources/glyphy.fs.glsl | 47 ++++++++++-------------------------------
 2 files changed, 11 insertions(+), 37 deletions(-)
---
diff --git a/gsk/gl/gskglprograms.defs b/gsk/gl/gskglprograms.defs
index a0a1cc26d9..f82fa910a0 100644
--- a/gsk/gl/gskglprograms.defs
+++ b/gsk/gl/gskglprograms.defs
@@ -99,5 +99,4 @@ GSK_GL_DEFINE_PROGRAM (glyphy,
                        GSK_GL_ADD_UNIFORM (2, GLYPHY_OUTLINE_THICKNESS, u_outline_thickness)
                        GSK_GL_ADD_UNIFORM (3, GLYPHY_OUTLINE, u_outline)
                        GSK_GL_ADD_UNIFORM (4, GLYPHY_BOLDNESS, u_boldness)
-                       GSK_GL_ADD_UNIFORM (5, GLYPHY_DEBUG, u_debug)
                        GSK_GL_ADD_UNIFORM (6, GLYPHY_ATLAS_INFO, u_atlas_info))
diff --git a/gsk/gl/resources/glyphy.fs.glsl b/gsk/gl/resources/glyphy.fs.glsl
index 4e41b67bef..48f26f6302 100644
--- a/gsk/gl/resources/glyphy.fs.glsl
+++ b/gsk/gl/resources/glyphy.fs.glsl
@@ -6,13 +6,12 @@ uniform float u_gamma_adjust;
 uniform float u_outline_thickness;
 uniform bool  u_outline;
 uniform float u_boldness;
-uniform bool  u_debug;
 
 _IN_ vec4 v_glyph;
 _IN_ vec4 final_color;
 
-#define SQRT2_2 0.70710678118654757 /* 1 / sqrt(2.) */
-#define SQRT2   1.4142135623730951
+#define SQRT2     1.4142135623730951
+#define SQRT2_INV 0.70710678118654757 /* 1 / sqrt(2.) */
 
 struct glyph_info_t {
   ivec2 nominal_size;
@@ -44,44 +43,20 @@ main()
   /* isotropic antialiasing */
   vec2 dpdx = dFdx (p);
   vec2 dpdy = dFdy (p);
-  float m = length (vec2 (length (dpdx), length (dpdy))) * SQRT2_2;
+  float m = length (vec2 (length (dpdx), length (dpdy))) * SQRT2_INV;
 
   float gsdist = glyphy_sdf (p, gi.nominal_size GLYPHY_DEMO_EXTRA_ARGS);
   float sdist = gsdist / m * u_contrast;
 
-  if (!u_debug) {
-    sdist -= u_boldness * 10.;
-    if (u_outline)
-      sdist = abs (sdist) - u_outline_thickness * .5;
-    if (sdist > 1.)
-      discard;
-    float alpha = antialias (-sdist);
-    if (u_gamma_adjust != 1.)
-      alpha = pow (alpha, 1./u_gamma_adjust);
+  if (u_outline)
+    sdist = abs (sdist) - u_outline_thickness * .5;
 
-    gskSetOutputColor(final_color * alpha);
-  } else {
-    vec4 color = vec4 (0,0,0,0);
+  if (sdist > 1.)
+    discard;
 
-    // Color the inside of the glyph a light red
-    color += vec4 (.5,0,0,.5) * smoothstep (1., -1., sdist);
+  float alpha = antialias (-sdist);
+  if (u_gamma_adjust != 1.)
+    alpha = pow (alpha, 1./u_gamma_adjust);
 
-    float udist = abs (sdist);
-    float gudist = abs (gsdist);
-    // Color the outline red
-    color += vec4 (1,0,0,1) * smoothstep (2., 1., udist);
-    // Color the distance field in green
-    if (!glyphy_isinf (udist))
-      color += vec4(0,.4,0,.4 - (abs(gsdist) / max(float(gi.nominal_size.x), float(gi.nominal_size.y))) * 
4.);
-
-    float pdist = glyphy_point_dist (p, gi.nominal_size GLYPHY_DEMO_EXTRA_ARGS);
-    // Color points green
-    color = mix (vec4 (0,1,0,.5), color, smoothstep (.05, .06, pdist));
-
-    glyphy_arc_list_t arc_list = glyphy_arc_list (p, gi.nominal_size GLYPHY_DEMO_EXTRA_ARGS);
-    // Color the number of endpoints per cell blue
-    color += vec4 (0,0,1,.1) * float(arc_list.num_endpoints) * 32./255.;
-
-    gskSetOutputColor(color);
-  }
+  gskSetOutputColor(final_color * alpha);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]