iconhelper: Compute surface size without icon helper

This is so we can do the next batch of changes
This commit is contained in:
Benjamin Otte 2017-11-04 07:04:08 +01:00
parent 197eeade74
commit a0ff63e162

View File

@ -200,8 +200,7 @@ get_icon_lookup_flags (GtkIconHelper *self,
} }
static void static void
get_surface_size (GtkIconHelper *self, get_surface_size (cairo_surface_t *surface,
cairo_surface_t *surface,
int *width, int *width,
int *height) int *height)
{ {
@ -221,7 +220,8 @@ get_surface_size (GtkIconHelper *self,
else else
{ {
g_warning ("infinite surface size not supported"); g_warning ("infinite surface size not supported");
ensure_icon_size (self, width, height); *width = 0;
*height = 0;
} }
cairo_destroy (cr); cairo_destroy (cr);
@ -487,8 +487,7 @@ _gtk_icon_helper_get_size (GtkIconHelper *self,
switch (gtk_image_definition_get_storage_type (self->def)) switch (gtk_image_definition_get_storage_type (self->def))
{ {
case GTK_IMAGE_SURFACE: case GTK_IMAGE_SURFACE:
get_surface_size (self, get_surface_size (gtk_image_definition_get_surface (self->def),
gtk_image_definition_get_surface (self->def),
&width, &width,
&height); &height);
break; break;
@ -512,7 +511,7 @@ _gtk_icon_helper_get_size (GtkIconHelper *self,
if (self->rendered_surface != NULL) if (self->rendered_surface != NULL)
{ {
get_surface_size (self, self->rendered_surface, &width, &height); get_surface_size (self->rendered_surface, &width, &height);
} }
else if (self->icon_size != GTK_ICON_SIZE_INVALID) else if (self->icon_size != GTK_ICON_SIZE_INVALID)
{ {