[gnome-shell] st: Create shadow pipeline taking resource scale in account
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] st: Create shadow pipeline taking resource scale in account
- Date: Fri, 1 Mar 2019 18:07:20 +0000 (UTC)
commit 37f53a42da12ece4b0024b2227a5d6dcd82b3cb9
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date: Mon Feb 25 15:42:51 2019 +0100
st: Create shadow pipeline taking resource scale in account
The shadow pipeline is created doing software blurring of the texture so the
shadow spec blur parameter should be scaled accordingly with the texture scaling
otherwise we won't take enough pixels in account creating stronger shadows.
https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
src/st/st-private.c | 11 +++++++----
src/st/st-private.h | 3 ++-
src/st/st-theme-node-drawing.c | 14 +++++++++-----
3 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/src/st/st-private.c b/src/st/st-private.c
index a74368709..895e33b1e 100644
--- a/src/st/st-private.c
+++ b/src/st/st-private.c
@@ -359,7 +359,8 @@ blur_pixels (guchar *pixels_in,
CoglPipeline *
_st_create_shadow_pipeline (StShadow *shadow_spec,
- CoglTexture *src_texture)
+ CoglTexture *src_texture,
+ float resource_scale)
{
ClutterBackend *backend = clutter_get_default_backend ();
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
@@ -386,7 +387,7 @@ _st_create_shadow_pipeline (StShadow *shadow_spec,
rowstride_in, pixels_in);
pixels_out = blur_pixels (pixels_in, width_in, height_in, rowstride_in,
- shadow_spec->blur,
+ shadow_spec->blur * resource_scale,
&width_out, &height_out, &rowstride_out);
g_free (pixels_in);
@@ -456,7 +457,8 @@ _st_create_shadow_pipeline_from_actor (StShadow *shadow_spec,
if (texture &&
cogl_texture_get_width (texture) == width &&
cogl_texture_get_height (texture) == height)
- shadow_pipeline = _st_create_shadow_pipeline (shadow_spec, texture);
+ shadow_pipeline = _st_create_shadow_pipeline (shadow_spec, texture,
+ resource_scale);
}
if (shadow_pipeline == NULL)
@@ -510,7 +512,8 @@ _st_create_shadow_pipeline_from_actor (StShadow *shadow_spec,
cogl_object_unref (fb);
- shadow_pipeline = _st_create_shadow_pipeline (shadow_spec, buffer);
+ shadow_pipeline = _st_create_shadow_pipeline (shadow_spec, buffer,
+ resource_scale);
cogl_object_unref (buffer);
}
diff --git a/src/st/st-private.h b/src/st/st-private.h
index f88f93009..0f3cb2f2c 100644
--- a/src/st/st-private.h
+++ b/src/st/st-private.h
@@ -63,7 +63,8 @@ CoglPipeline * _st_create_texture_pipeline (CoglTexture *src_texture);
/* Helper for widgets which need to draw additional shadows */
CoglPipeline * _st_create_shadow_pipeline (StShadow *shadow_spec,
- CoglTexture *src_texture);
+ CoglTexture *src_texture,
+ float resource_scale);
CoglPipeline * _st_create_shadow_pipeline_from_actor (StShadow *shadow_spec,
ClutterActor *actor);
cairo_pattern_t *_st_create_shadow_cairo_pattern (StShadow *shadow_spec,
diff --git a/src/st/st-theme-node-drawing.c b/src/st/st-theme-node-drawing.c
index 7db928a0d..3aaba3424 100644
--- a/src/st/st-theme-node-drawing.c
+++ b/src/st/st-theme-node-drawing.c
@@ -1422,7 +1422,8 @@ st_theme_node_load_background_image (StThemeNode *node)
if (background_image_shadow_spec)
{
node->background_shadow_pipeline = _st_create_shadow_pipeline (background_image_shadow_spec,
- node->background_texture);
+ node->background_texture,
+ resource_scale);
}
}
@@ -1561,10 +1562,12 @@ st_theme_node_render_resources (StThemeNodePaintState *state,
{
if (st_theme_node_load_border_image (node))
state->box_shadow_pipeline = _st_create_shadow_pipeline (box_shadow_spec,
- node->border_slices_texture);
+ node->border_slices_texture,
+ state->resource_scale);
else if (state->prerendered_texture != NULL)
state->box_shadow_pipeline = _st_create_shadow_pipeline (box_shadow_spec,
- state->prerendered_texture);
+ state->prerendered_texture,
+ state->resource_scale);
else if (node->background_color.alpha > 0 || has_border)
st_theme_node_prerender_shadow (state);
}
@@ -1636,7 +1639,8 @@ st_theme_node_update_resources (StThemeNodePaintState *state,
if (had_box_shadow)
state->box_shadow_pipeline = _st_create_shadow_pipeline (box_shadow_spec,
- state->prerendered_texture);
+ state->prerendered_texture,
+ state->resource_scale);
}
static void
@@ -2330,7 +2334,7 @@ st_theme_node_prerender_shadow (StThemeNodePaintState *state)
st_theme_node_paint_borders (state, offscreen, &box, 0xFF);
state->box_shadow_pipeline = _st_create_shadow_pipeline (st_theme_node_get_box_shadow (node),
- buffer);
+ buffer, state->resource_scale);
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]