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
This commit is contained in:
parent
5617ffc79c
commit
37f53a42da
@ -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);
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user