[gnome-shell] st: Rename and fix blur sampling calculation
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] st: Rename and fix blur sampling calculation
- Date: Thu, 17 Dec 2020 15:26:00 +0000 (UTC)
commit fe90da82b40da68e335cdb960a7b1d94400388be
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Dec 17 02:03:34 2020 -0300
st: Rename and fix blur sampling calculation
What the blur shader does is going n_steps in each direction (e.g. in case
we're in the horizontal pass that means left and right direction), sampling
the adjacent texels of the texel we're currently blurring. That means
n_steps actually is the amount of texels we're sampling in one direction,
not in both directions.
Make n_steps match what the blur shader does, and rename it to sampling_radius
to match what it really means. Do that for both st-theme-node-drawing.c and
st-private.c
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1542>
src/st/st-private.c | 19 +++++++++----------
src/st/st-theme-node-drawing.c | 2 +-
2 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/src/st/st-private.c b/src/st/st-private.c
index 4d8952f5eb..83c0cac765 100644
--- a/src/st/st-private.c
+++ b/src/st/st-private.c
@@ -390,11 +390,10 @@ _st_create_shadow_pipeline (StShadow *shadow_spec,
CoglFramebuffer *fb;
CoglPipeline *pipeline;
CoglTexture *texture;
- double sigma;
+ float sampling_radius;
+ float sigma;
int src_height, dst_height;
int src_width, dst_width;
- int n_values;
- int half;
static CoglPipeline *shadow_pipeline_template = NULL;
@@ -402,13 +401,12 @@ _st_create_shadow_pipeline (StShadow *shadow_spec,
g_return_val_if_fail (src_texture != NULL, NULL);
sigma = shadow_spec->blur / 2.f;
- n_values = ceil (3 * sigma);
- half = n_values / 2;
+ sampling_radius = ceilf (1.5 * sigma) * 2.0;
src_width = cogl_texture_get_width (src_texture);
src_height = cogl_texture_get_height (src_texture);
- dst_width = src_width + 2 * half;
- dst_height = src_height + 2 * half;
+ dst_width = src_width + 2 * sampling_radius;
+ dst_height = src_height + 2 * sampling_radius;
texture = cogl_texture_2d_new_with_size (ctx, dst_width, dst_height);
if (!texture)
@@ -442,9 +440,10 @@ _st_create_shadow_pipeline (StShadow *shadow_spec,
clutter_paint_node_add_child (blur_node, texture_node);
clutter_paint_node_add_rectangle (texture_node,
&(ClutterActorBox) {
- half, half,
- src_width + half,
- src_height + half,
+ .x1 = sampling_radius,
+ .y1 = sampling_radius,
+ .x2 = src_width + sampling_radius,
+ .y2 = src_height + sampling_radius,
});
paint_context =
diff --git a/src/st/st-theme-node-drawing.c b/src/st/st-theme-node-drawing.c
index 64f2d75184..6c52da839b 100644
--- a/src/st/st-theme-node-drawing.c
+++ b/src/st/st-theme-node-drawing.c
@@ -2035,7 +2035,7 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
if (box_shadow_spec->blur == 0)
shadow_blur_radius = 0;
else
- shadow_blur_radius = (5 * (box_shadow_spec->blur / 2.0)) / 2;
+ shadow_blur_radius = ceilf (1.5 * box_shadow_spec->blur / 2.0) * 2.0;
shadow_width = state->box_shadow_width + 2 * shadow_blur_radius;
shadow_height = state->box_shadow_height + 2 * shadow_blur_radius;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]