Catch invalid borders, and warn.

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.
This commit is contained in:
Owen Taylor 2002-01-19 07:52:52 +00:00 committed by Owen Taylor
parent 4661db56ae
commit 029b235234
2 changed files with 18 additions and 0 deletions

View 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.

View File

@ -374,6 +374,19 @@ theme_pixbuf_compute_hints (ThemePixbuf *theme_pb)
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++)
{
gint y0, y1;