gchar *filename;
gint pixel_size;
+ guint need_calc_size : 1;
};
#define GTK_IMAGE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_IMAGE, GtkImagePrivate))
{
GtkImage *image;
GtkMisc *misc;
+ GtkImagePrivate *priv;
GdkRectangle area, image_bound;
gfloat xalign;
gint x, y, mask_x, mask_y;
image = GTK_IMAGE (widget);
misc = GTK_MISC (widget);
+ priv = GTK_IMAGE_GET_PRIVATE (image);
area = event->area;
* and size_request() if something explicitely forces
* a redraw.
*/
- if (widget->requisition.width == 0 && widget->requisition.height == 0)
+ if (priv->need_calc_size)
gtk_image_calc_size (image);
if (!gdk_rectangle_intersect (&area, &widget->allocation, &area))
xalign = misc->xalign;
else
xalign = 1.0 - misc->xalign;
-
+
x = floor (widget->allocation.x + misc->xpad
+ ((widget->allocation.width - widget->requisition.width) * xalign));
y = floor (widget->allocation.y + misc->ypad
void
gtk_image_clear (GtkImage *image)
{
- gtk_image_reset (image);
+ GtkImagePrivate *priv;
+
+ priv = GTK_IMAGE_GET_PRIVATE (image);
+
+ priv->need_calc_size = 1;
+ gtk_image_reset (image);
gtk_image_update_size (image, 0, 0);
}
{
GtkWidget *widget = GTK_WIDGET (image);
GdkPixbuf *pixbuf = NULL;
-
+ GtkImagePrivate *priv;
+
+ priv = GTK_IMAGE_GET_PRIVATE (image);
+
+ priv->need_calc_size = 0;
+
/* We update stock/icon set on every size request, because
* the theme could have affected the size; for other kinds of
* image, we just update the requisition when the image data