[maemo-commits] [maemo-commits] r13820 - in projects/haf/trunk/sapwood: . src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Fri Sep 14 16:10:12 EEST 2007
- Previous message: [maemo-commits] r13819 - in projects/haf/trunk/hildon-theme-layout-4: . rc
- Next message: [maemo-commits] r13821 - in projects/haf/trunk/hildon-desktop: . src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: tko Date: 2007-09-14 16:10:09 +0300 (Fri, 14 Sep 2007) New Revision: 13820 Modified: projects/haf/trunk/sapwood/ChangeLog projects/haf/trunk/sapwood/src/sapwood-render.c Log: Add debugging helper to check image borders validity 2007-09-14 Tommi Komulainen <tommi.komulainen at nokia.com> * src/sapwood-render.c (theme_pixbuf_check_borders, theme_pixbuf_set_filename, theme_pixbuf_set_border): Add debugging helper to check image borders validity while parsing rather than postponing it to loading. Due to performance hit of loading every image one needs to build with -DENABLE_DEBUG Modified: projects/haf/trunk/sapwood/ChangeLog =================================================================== --- projects/haf/trunk/sapwood/ChangeLog 2007-09-14 12:31:04 UTC (rev 13819) +++ projects/haf/trunk/sapwood/ChangeLog 2007-09-14 13:10:09 UTC (rev 13820) @@ -1,3 +1,11 @@ +2007-09-14 Tommi Komulainen <tommi.komulainen at nokia.com> + + * src/sapwood-render.c (theme_pixbuf_check_borders, + theme_pixbuf_set_filename, theme_pixbuf_set_border): Add debugging + helper to check image borders validity while parsing rather than + postponing it to loading. Due to performance hit of loading every + image one needs to build with -DENABLE_DEBUG + 2007-09-11 Tommi Komulainen <tommi.komulainen at nokia.com> * === Release 2.91.10 === Modified: projects/haf/trunk/sapwood/src/sapwood-render.c =================================================================== --- projects/haf/trunk/sapwood/src/sapwood-render.c 2007-09-14 12:31:04 UTC (rev 13819) +++ projects/haf/trunk/sapwood/src/sapwood-render.c 2007-09-14 13:10:09 UTC (rev 13820) @@ -141,7 +141,32 @@ return canon; } -void +#ifdef ENABLE_DEBUG +static void +theme_pixbuf_check_borders (ThemePixbuf *theme_pb) +{ + gchar *filename; + gint width, height; + + if (!theme_pb->basename) + return; + + filename = g_build_filename (theme_pb->dirname, theme_pb->basename, NULL); + + if (gdk_pixbuf_get_file_info (filename, &width, &height) != NULL) + { + if (theme_pb->border_left + theme_pb->border_right >= width || + theme_pb->border_top + theme_pb->border_bottom >= height) + g_warning ("%s: border values too big for the image", theme_pb->basename); + } + + g_free (filename); +} +#else +#define theme_pixbuf_check_borders(x) (void)0 +#endif + +void theme_pixbuf_set_filename (ThemePixbuf *theme_pb, const char *filename) { @@ -169,6 +194,8 @@ theme_pb->basename = basename; g_free (dirname); + + theme_pixbuf_check_borders (theme_pb); } else g_warning ("%s: %s", filename, g_strerror (errno)); @@ -188,6 +215,8 @@ theme_pb->border_right = right; theme_pb->border_top = top; theme_pb->border_bottom = bottom; + + theme_pixbuf_check_borders (theme_pb); } void
- Previous message: [maemo-commits] r13819 - in projects/haf/trunk/hildon-theme-layout-4: . rc
- Next message: [maemo-commits] r13821 - in projects/haf/trunk/hildon-desktop: . src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]