]> Pileus Git - ~andy/gtk/commitdiff
Catch invalid borders, and warn.
authorOwen Taylor <otaylor@redhat.com>
Sat, 19 Jan 2002 07:52:52 +0000 (07:52 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Sat, 19 Jan 2002 07:52:52 +0000 (07:52 +0000)
Sat Jan 19 02:45:17 2002  Owen Taylor  <otaylor@redhat.com>

        * src/pixbuf-render.c (theme_pixbuf_compute_hints): Catch
        invalid borders, and warn.

modules/engines/pixbuf/ChangeLog
modules/engines/pixbuf/pixbuf-render.c

index 72c1bba1dadc40458d0af15e469e56e34e46ea86..e33e9cc81a57b4de10dd84f77a6ba3a27ee989b8 100644 (file)
@@ -1,3 +1,8 @@
+Sat Jan 19 02:45:17 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * src/pixbuf-render.c (theme_pixbuf_compute_hints): Catch
+       invalid borders, and warn.
+
 Sat Jan 19 00:32:14 2002  Owen Taylor  <otaylor@redhat.com>
 
        * examples/*: Add an extrodinarily ugly example.
index d50d4c210dc7e5cb6e946a44b4395016e6bac24c..08201f330f88c5f40e66e65235b87e9d4481511a 100644 (file)
@@ -373,6 +373,19 @@ theme_pixbuf_compute_hints (ThemePixbuf *theme_pb)
   int i, j;
   gint width = gdk_pixbuf_get_width (theme_pb->pixbuf);
   gint height = gdk_pixbuf_get_height (theme_pb->pixbuf);
+
+  if (theme_pb->border_left + theme_pb->border_right >= width ||
+      theme_pb->border_top + theme_pb->border_bottom >= height)
+    {
+      g_warning ("Invalid borders specified for theme pixmap:\n"
+                "        %s,\n"
+                "there must be at least one pixel not in the border both horizontally\n"
+                "and vertically", theme_pb->filename);
+      if (theme_pb->border_left + theme_pb->border_right >= width)
+       theme_pb->border_left = theme_pb->border_right = width / 2 + 1 - (width % 2);
+      if (theme_pb->border_bottom + theme_pb->border_top >= height)
+       theme_pb->border_bottom = theme_pb->border_top = height / 2 + 1 - (height % 2);
+    }
   
   for (i = 0; i < 3; i++)
     {