[maemo-commits] [maemo-commits] r8531 - in projects/haf/trunk/hildon-theme-tools: . src
From: www-data at stage.maemo.org www-data at stage.maemo.orgDate: Fri Dec 1 14:51:28 EET 2006
- Previous message: [maemo-commits] r8530 - in projects/haf/trunk/hildon-theme-layout-3: . data
- Next message: [maemo-commits] r8532 - in projects/haf/trunk/osso-af-startup: debian top-scripts
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: mdk Date: 2006-12-01 14:51:27 +0200 (Fri, 01 Dec 2006) New Revision: 8531 Modified: projects/haf/trunk/hildon-theme-tools/ChangeLog projects/haf/trunk/hildon-theme-tools/src/common.c projects/haf/trunk/hildon-theme-tools/src/common.h projects/haf/trunk/hildon-theme-tools/src/slicer.c Log: Adding correct parsing for forced-alpha elements. Modified: projects/haf/trunk/hildon-theme-tools/ChangeLog =================================================================== --- projects/haf/trunk/hildon-theme-tools/ChangeLog 2006-12-01 12:25:56 UTC (rev 8530) +++ projects/haf/trunk/hildon-theme-tools/ChangeLog 2006-12-01 12:51:27 UTC (rev 8531) @@ -1,5 +1,11 @@ 2006-12-01 Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> + * src/common.c: + * src/common.h: + * src/slicer.c: Adding correct parsing for forced-alpha elements. + +2006-12-01 Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> + * scripts/Makefile.am: * src/Makefile.am: * src/hildon-theme-mk-bundle: Modified: projects/haf/trunk/hildon-theme-tools/src/common.c =================================================================== --- projects/haf/trunk/hildon-theme-tools/src/common.c 2006-12-01 12:25:56 UTC (rev 8530) +++ projects/haf/trunk/hildon-theme-tools/src/common.c 2006-12-01 12:51:27 UTC (rev 8531) @@ -161,7 +161,7 @@ { Element *element = NULL; guint size = 0; - gint *vals = NULL; + gchar **vals = NULL; g_return_val_if_fail (key_file != NULL, NULL); @@ -172,21 +172,26 @@ goto Done; size = 0; - vals = g_key_file_get_integer_list (key_file, "Elements", name, &size, NULL); + vals = g_key_file_get_string_list (key_file, "Elements", name, &size, NULL); - if (size != 4 || vals == NULL) + if (size < 4 || vals == NULL) goto Done; element = g_new0 (Element, 1); - element->X = vals [0]; - element->Y = vals [1]; - element->Width = vals [2]; - element->Height = vals [3]; + element->X = atoi (vals [0]); + element->Y = atoi (vals [1]); + element->Width = atoi (vals [2]); + element->Height = atoi (vals [3]); element->Name = g_strdup (name); + if (size >= 5 && strcmp (vals [4], "alpha") == 0) { + element->ForcedAlpha = TRUE; + } else + element->ForcedAlpha = FALSE; + Done: if (vals != NULL) - g_free (vals); + g_strfreev (vals); return element; } Modified: projects/haf/trunk/hildon-theme-tools/src/common.h =================================================================== --- projects/haf/trunk/hildon-theme-tools/src/common.h 2006-12-01 12:25:56 UTC (rev 8530) +++ projects/haf/trunk/hildon-theme-tools/src/common.h 2006-12-01 12:51:27 UTC (rev 8531) @@ -20,6 +20,8 @@ */ #include <glib.h> +#include <math.h> +#include <string.h> struct _Template { @@ -36,6 +38,7 @@ gint Y; gint Width; gint Height; + gboolean ForcedAlpha; } typedef Element; struct _Color Modified: projects/haf/trunk/hildon-theme-tools/src/slicer.c =================================================================== --- projects/haf/trunk/hildon-theme-tools/src/slicer.c 2006-12-01 12:25:56 UTC (rev 8530) +++ projects/haf/trunk/hildon-theme-tools/src/slicer.c 2006-12-01 12:51:27 UTC (rev 8531) @@ -134,8 +134,13 @@ g_warning ("Failed to process '%s'!", element->Name); else { gchar *fname = g_build_filename (directory, element->Name, NULL); - - if (gdk_pixbuf_get_n_channels (sub) == 4 && check_if_pixbuf_needs_alpha (sub) == FALSE) { + + // FIXME This only covers one case (nnot stripping alpha when + // forced alpha == TRUE). We should also support a case when + // alpha needs to be added. + if (gdk_pixbuf_get_n_channels (sub) == 4 && + check_if_pixbuf_needs_alpha (sub) == FALSE && + element->ForcedAlpha == FALSE) { GdkPixbuf *oldy = sub; sub = strip_alpha_from_pixbuf (oldy); gdk_pixbuf_unref (oldy);
- Previous message: [maemo-commits] r8530 - in projects/haf/trunk/hildon-theme-layout-3: . data
- Next message: [maemo-commits] r8532 - in projects/haf/trunk/osso-af-startup: debian top-scripts
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]