forked from AuroraMiddleware/gtk
Remove icon extents API
This commit is contained in:
parent
480a2c2770
commit
04eb7eef29
@ -229,45 +229,6 @@ gtk_css_style_render_icon_surface (GtkCssStyle *style,
|
|||||||
cairo_set_matrix (cr, &saved_matrix);
|
cairo_set_matrix (cr, &saved_matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
gtk_css_style_render_icon_get_extents (GtkCssStyle *style,
|
|
||||||
GdkRectangle *extents,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
gint width,
|
|
||||||
gint height)
|
|
||||||
{
|
|
||||||
graphene_matrix_t transform_matrix, translate_matrix, matrix;
|
|
||||||
graphene_rect_t bounds;
|
|
||||||
GtkBorder border;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CSS_STYLE (style));
|
|
||||||
g_return_if_fail (extents != NULL);
|
|
||||||
|
|
||||||
extents->x = x;
|
|
||||||
extents->y = y;
|
|
||||||
extents->width = width;
|
|
||||||
extents->height = height;
|
|
||||||
|
|
||||||
if (!gtk_css_transform_value_get_matrix (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_TRANSFORM), &transform_matrix))
|
|
||||||
return;
|
|
||||||
|
|
||||||
graphene_matrix_init_translate (&translate_matrix, &GRAPHENE_POINT3D_INIT(x + width / 2.0, y + height / 2.0, 0));
|
|
||||||
graphene_matrix_multiply (&transform_matrix, &translate_matrix, &matrix);
|
|
||||||
graphene_rect_init (&bounds,
|
|
||||||
- width / 2.0, - height / 2.0,
|
|
||||||
width, height);
|
|
||||||
/* need to round to full pixels */
|
|
||||||
graphene_matrix_transform_bounds (&matrix, &bounds, &bounds);
|
|
||||||
|
|
||||||
_gtk_css_shadows_value_get_extents (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SHADOW), &border);
|
|
||||||
|
|
||||||
extents->x = floorf (bounds.origin.x) - border.left;
|
|
||||||
extents->y = floorf (bounds.origin.y) - border.top;
|
|
||||||
extents->width = ceilf (bounds.origin.x + bounds.size.width) - extents->x + border.right;
|
|
||||||
extents->height = ceilf (bounds.origin.y + bounds.size.height) - extents->y + border.bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style,
|
gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style,
|
||||||
GtkSnapshot *snapshot,
|
GtkSnapshot *snapshot,
|
||||||
|
@ -1950,28 +1950,6 @@ gtk_style_context_get_change (GtkStyleContext *context)
|
|||||||
return priv->invalidating_context;
|
return priv->invalidating_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
_gtk_style_context_get_icon_extents (GtkStyleContext *context,
|
|
||||||
GdkRectangle *extents,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
gint width,
|
|
||||||
gint height)
|
|
||||||
{
|
|
||||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
|
||||||
g_return_if_fail (extents != NULL);
|
|
||||||
|
|
||||||
if (_gtk_css_image_value_get_image (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_SOURCE)) == NULL)
|
|
||||||
{
|
|
||||||
extents->x = extents->y = extents->width = extents->height = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_css_style_render_icon_get_extents (gtk_style_context_lookup_style (context),
|
|
||||||
extents,
|
|
||||||
x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
PangoAttrList *
|
PangoAttrList *
|
||||||
_gtk_style_context_get_pango_attributes (GtkStyleContext *context)
|
_gtk_style_context_get_pango_attributes (GtkStyleContext *context)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user