st-label: Paint shadow using resource-scaled texture
https://bugzilla.gnome.org/show_bug.cgi?id=765011
This commit is contained in:
parent
0bcf76970a
commit
15f69bdc3b
@ -197,34 +197,52 @@ st_label_paint (ClutterActor *actor)
|
|||||||
|
|
||||||
if (shadow_spec)
|
if (shadow_spec)
|
||||||
{
|
{
|
||||||
ClutterActorBox allocation;
|
float resource_scale;
|
||||||
float width, height;
|
|
||||||
|
|
||||||
clutter_actor_get_allocation_box (priv->label, &allocation);
|
if (clutter_actor_get_resource_scale (priv->label, &resource_scale))
|
||||||
clutter_actor_box_get_size (&allocation, &width, &height);
|
|
||||||
|
|
||||||
if (priv->text_shadow_pipeline == NULL ||
|
|
||||||
width != priv->shadow_width ||
|
|
||||||
height != priv->shadow_height)
|
|
||||||
{
|
{
|
||||||
g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref);
|
ClutterActorBox allocation;
|
||||||
|
float width, height;
|
||||||
|
|
||||||
priv->shadow_width = width;
|
clutter_actor_get_allocation_box (priv->label, &allocation);
|
||||||
priv->shadow_height = height;
|
clutter_actor_box_get_size (&allocation, &width, &height);
|
||||||
priv->text_shadow_pipeline = _st_create_shadow_pipeline_from_actor (shadow_spec, priv->label);
|
|
||||||
|
width *= resource_scale;
|
||||||
|
height *= resource_scale;
|
||||||
|
|
||||||
|
if (priv->text_shadow_pipeline == NULL ||
|
||||||
|
width != priv->shadow_width ||
|
||||||
|
height != priv->shadow_height)
|
||||||
|
{
|
||||||
|
g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref);
|
||||||
|
|
||||||
|
priv->shadow_width = width;
|
||||||
|
priv->shadow_height = height;
|
||||||
|
priv->text_shadow_pipeline =
|
||||||
|
_st_create_shadow_pipeline_from_actor (shadow_spec,
|
||||||
|
priv->label);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priv->text_shadow_pipeline != NULL)
|
||||||
|
_st_paint_shadow_with_opacity (shadow_spec,
|
||||||
|
cogl_get_draw_framebuffer (),
|
||||||
|
priv->text_shadow_pipeline,
|
||||||
|
&allocation,
|
||||||
|
clutter_actor_get_paint_opacity (priv->label));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->text_shadow_pipeline != NULL)
|
|
||||||
_st_paint_shadow_with_opacity (shadow_spec,
|
|
||||||
cogl_get_draw_framebuffer (),
|
|
||||||
priv->text_shadow_pipeline,
|
|
||||||
&allocation,
|
|
||||||
clutter_actor_get_paint_opacity (priv->label));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clutter_actor_paint (priv->label);
|
clutter_actor_paint (priv->label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
st_label_resource_scale_changed (StWidget *widget)
|
||||||
|
{
|
||||||
|
StLabelPrivate *priv = ST_LABEL (widget)->priv;
|
||||||
|
|
||||||
|
g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
st_label_class_init (StLabelClass *klass)
|
st_label_class_init (StLabelClass *klass)
|
||||||
{
|
{
|
||||||
@ -243,6 +261,7 @@ st_label_class_init (StLabelClass *klass)
|
|||||||
actor_class->get_preferred_height = st_label_get_preferred_height;
|
actor_class->get_preferred_height = st_label_get_preferred_height;
|
||||||
|
|
||||||
widget_class->style_changed = st_label_style_changed;
|
widget_class->style_changed = st_label_style_changed;
|
||||||
|
widget_class->resource_scale_changed = st_label_resource_scale_changed;
|
||||||
widget_class->get_accessible_type = st_label_accessible_get_type;
|
widget_class->get_accessible_type = st_label_accessible_get_type;
|
||||||
|
|
||||||
pspec = g_param_spec_object ("clutter-text",
|
pspec = g_param_spec_object ("clutter-text",
|
||||||
|
Loading…
Reference in New Issue
Block a user