summaryrefslogtreecommitdiff
path: root/gtk/gtkcssimage.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2014-07-23 18:40:55 +0200
committerBenjamin Otte <otte@redhat.com>2014-07-23 18:51:26 +0200
commit27b9efbea2e6befc1071ce07658604172bbdca99 (patch)
tree7abc90a5f62772016dcb22d4835ceaa53855e1fe /gtk/gtkcssimage.c
parent0d1d17107f69d4377a7d18be466ae3fa2816335b (diff)
downloadgtk+-27b9efbea2e6befc1071ce07658604172bbdca99.tar.gz
cssimage: Fix size computation for -gtk-icontheme()
For images without a concrete size but with an aspect ratio, we took the wrong code path. (I even copied the documentation that said "Otherwise" but didn't put an else clause there, go me!)
Diffstat (limited to 'gtk/gtkcssimage.c')
-rw-r--r--gtk/gtkcssimage.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/gtk/gtkcssimage.c b/gtk/gtkcssimage.c
index c5a336a0a4..049d49e689 100644
--- a/gtk/gtkcssimage.c
+++ b/gtk/gtkcssimage.c
@@ -320,30 +320,32 @@ _gtk_css_image_get_concrete_size (GtkCssImage *image,
*concrete_height = default_width / image_aspect;
}
}
-
- /* Otherwise, the width and height of the concrete object
- * size is the same as the object's intrinsic width and
- * intrinsic height, if they exist.
- * If the concrete object size is still missing a width or
- * height, and the object has an intrinsic aspect ratio,
- * the missing dimension is calculated from the present
- * dimension and the intrinsic aspect ratio.
- * Otherwise, the missing dimension is taken from the default
- * object size.
- */
- if (image_width)
- *concrete_width = image_width;
- else if (image_aspect)
- *concrete_width = image_height * image_aspect;
else
- *concrete_width = default_width;
+ {
+ /* Otherwise, the width and height of the concrete object
+ * size is the same as the object's intrinsic width and
+ * intrinsic height, if they exist.
+ * If the concrete object size is still missing a width or
+ * height, and the object has an intrinsic aspect ratio,
+ * the missing dimension is calculated from the present
+ * dimension and the intrinsic aspect ratio.
+ * Otherwise, the missing dimension is taken from the default
+ * object size.
+ */
+ if (image_width)
+ *concrete_width = image_width;
+ else if (image_aspect)
+ *concrete_width = image_height * image_aspect;
+ else
+ *concrete_width = default_width;
- if (image_height)
- *concrete_height = image_height;
- else if (image_aspect)
- *concrete_height = image_width / image_aspect;
- else
- *concrete_height = default_height;
+ if (image_height)
+ *concrete_height = image_height;
+ else if (image_aspect)
+ *concrete_height = image_width / image_aspect;
+ else
+ *concrete_height = default_height;
+ }
return;
}