[gnome-software: 4/10] gs-picture: Fix get_preferred_width() vfunc
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 4/10] gs-picture: Fix get_preferred_width() vfunc
- Date: Fri, 20 Aug 2021 15:36:42 +0000 (UTC)
commit 02f7b96e50c8e60c4968d12788892e34d6b58846
Author: Philip Withnall <pwithnall endlessos org>
Date: Fri Aug 20 12:20:57 2021 +0100
gs-picture: Fix get_preferred_width() vfunc
When `get_preferred_width()` was called (not
`get_preferred_width_for_*()`), `for_size` was set to `-1` by the
caller, and then multiplied in to the sum, resulting in a negative
natural width being returned.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
src/gs-picture.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-picture.c b/src/gs-picture.c
index 4fe2b0630..75ac34729 100644
--- a/src/gs-picture.c
+++ b/src/gs-picture.c
@@ -155,7 +155,10 @@ gs_picture_measure (GtkWidget *widget,
gdouble width = gdk_pixbuf_get_width (picture->pixbuf);
gdouble height = gdk_pixbuf_get_height (picture->pixbuf);
- *natural = height <= 0 ? 0 : (width * for_size) / height;
+ if (for_size < 0)
+ *natural = width;
+ else
+ *natural = height <= 0 ? 0 : (width * for_size) / height;
} else {
*natural = gdk_pixbuf_get_height (picture->pixbuf);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]