[maemo-commits] [maemo-commits] r17077 - in projects/haf/trunk/sapwood: . engine

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Jan 9 15:46:36 EET 2009
Author: herzi
Date: 2009-01-09 15:46:32 +0200 (Fri, 09 Jan 2009)
New Revision: 17077

Modified:
   projects/haf/trunk/sapwood/ChangeLog
   projects/haf/trunk/sapwood/engine/sapwood-pixmap.c
   projects/haf/trunk/sapwood/engine/sapwood-pixmap.h
   projects/haf/trunk/sapwood/engine/sapwood-style.c
   projects/haf/trunk/sapwood/engine/theme-pixbuf.c
   projects/haf/trunk/sapwood/engine/theme-pixbuf.h
Log:
2009-01-08  Sven Herzberg  <sven at imendio.com>

	Properly forward the depth information.

	* engine/sapwood-pixmap.c,
	* engine/sapwood-pixmap.h,
	* engine/sapwood-style.c,
	* engine/theme-pixbuf.c,
	* engine/theme-pixbuf.h: properly forward the depth information into
	the sapwood server


Modified: projects/haf/trunk/sapwood/ChangeLog
===================================================================
--- projects/haf/trunk/sapwood/ChangeLog	2009-01-09 13:46:25 UTC (rev 17076)
+++ projects/haf/trunk/sapwood/ChangeLog	2009-01-09 13:46:32 UTC (rev 17077)
@@ -1,5 +1,16 @@
 2009-01-08  Sven Herzberg  <sven at imendio.com>
 
+	Properly forward the depth information.
+
+	* engine/sapwood-pixmap.c,
+	* engine/sapwood-pixmap.h,
+	* engine/sapwood-style.c,
+	* engine/theme-pixbuf.c,
+	* engine/theme-pixbuf.h: properly forward the depth information into
+	the sapwood server
+
+2009-01-08  Sven Herzberg  <sven at imendio.com>
+
 	Added a depth field to the PixbufOpenRequest
 
 	To be able to support both 24-bit and 32-bit windows with proper

Modified: projects/haf/trunk/sapwood/engine/sapwood-pixmap.c
===================================================================
--- projects/haf/trunk/sapwood/engine/sapwood-pixmap.c	2009-01-09 13:46:25 UTC (rev 17076)
+++ projects/haf/trunk/sapwood/engine/sapwood-pixmap.c	2009-01-09 13:46:32 UTC (rev 17077)
@@ -88,6 +88,7 @@
                              int         border_right,
                              int         border_top,
                              int         border_bottom,
+                             int         depth,
                              GError    **err)
 {
   SapwoodPixmap     *self;
@@ -108,7 +109,7 @@
 
   req->base.op       = PIXBUF_OP_OPEN;
   req->base.length   = sizeof(*req) + flen + 1;
-  req->depth         = 24;
+  req->depth         = depth;
   req->border_left   = border_left;
   req->border_right  = border_right;
   req->border_top    = border_top;

Modified: projects/haf/trunk/sapwood/engine/sapwood-pixmap.h
===================================================================
--- projects/haf/trunk/sapwood/engine/sapwood-pixmap.h	2009-01-09 13:46:25 UTC (rev 17076)
+++ projects/haf/trunk/sapwood/engine/sapwood-pixmap.h	2009-01-09 13:46:32 UTC (rev 17077)
@@ -37,11 +37,12 @@
 } SapwoodRect;
 
 SapwoodPixmap *sapwood_pixmap_get_for_file (const char *filename,
-					  int border_left,
-					  int border_right,
-					  int border_top,
-					  int border_bottom,
-					  GError **err) G_GNUC_INTERNAL;
+					    int border_left,
+					    int border_right,
+					    int border_top,
+					    int border_bottom,
+                                            int depth,
+					    GError **err) G_GNUC_INTERNAL;
 
 void      sapwood_pixmap_free         (SapwoodPixmap *self) G_GNUC_INTERNAL;
 

Modified: projects/haf/trunk/sapwood/engine/sapwood-style.c
===================================================================
--- projects/haf/trunk/sapwood/engine/sapwood-style.c	2009-01-09 13:46:25 UTC (rev 17076)
+++ projects/haf/trunk/sapwood/engine/sapwood-style.c	2009-01-09 13:46:32 UTC (rev 17077)
@@ -386,7 +386,7 @@
       if (!draw_center)
 	components |= COMPONENT_CENTER;
 
-      if (!theme_pixbuf_get_geometry (image->gap_start, &xthickness, &ythickness))
+      if (!theme_pixbuf_get_geometry (image->gap_start, gdk_drawable_get_depth (window), &xthickness, &ythickness))
 	{
 	  xthickness = style->xthickness;
 	  ythickness = style->ythickness;

Modified: projects/haf/trunk/sapwood/engine/theme-pixbuf.c
===================================================================
--- projects/haf/trunk/sapwood/engine/theme-pixbuf.c	2009-01-09 13:46:25 UTC (rev 17076)
+++ projects/haf/trunk/sapwood/engine/theme-pixbuf.c	2009-01-09 13:46:32 UTC (rev 17077)
@@ -42,6 +42,7 @@
 ThemePixbuf *
 theme_pixbuf_new (void)
 {
+  /* FIXME: use g_slice_new0 */
   ThemePixbuf *result = g_new0 (ThemePixbuf, 1);
   result->refcnt = 1;
   result->stretch = TRUE;
@@ -60,8 +61,8 @@
   if (theme_pb->shared)
     {
       g_hash_table_remove (pixbuf_hash, theme_pb);
-      if (theme_pb->pixmap)
-	sapwood_pixmap_free (theme_pb->pixmap);
+      if (theme_pb->pixmap24)
+	sapwood_pixmap_free (theme_pb->pixmap24);
     }
   if (theme_pb->basename)
     g_free (theme_pb->basename);
@@ -113,7 +114,7 @@
 {
   ThemePixbuf *canon;
 
-  g_assert (theme_pb->pixmap == NULL);
+  g_assert (theme_pb->pixmap24 == NULL);
 
   *warn = FALSE;
 
@@ -172,7 +173,7 @@
 theme_pixbuf_set_filename (ThemePixbuf *theme_pb,
 			   const char  *filename)
 {
-  g_assert (theme_pb->pixmap == NULL);
+  g_assert (theme_pb->pixmap24 == NULL);
 
   if (theme_pb->basename)
     g_free (theme_pb->basename);
@@ -211,7 +212,7 @@
 			 gint         top,
 			 gint         bottom)
 {
-  g_return_if_fail (theme_pb->pixmap == NULL);
+  g_return_if_fail (theme_pb->pixmap24 == NULL);
 
   theme_pb->border_left = left;
   theme_pb->border_right = right;
@@ -225,27 +226,29 @@
 theme_pixbuf_set_stretch (ThemePixbuf *theme_pb,
 			  gboolean     stretch)
 {
-  g_return_if_fail (theme_pb->pixmap == NULL);
+  g_return_if_fail (theme_pb->pixmap24 == NULL);
 
   theme_pb->stretch = stretch;
 }
 
 static SapwoodPixmap *
-theme_pixbuf_get_pixmap (ThemePixbuf *theme_pb)
+theme_pixbuf_get_pixmap (ThemePixbuf *theme_pb,
+                         int          depth)
 {
-  if (!theme_pb->pixmap)
+  if (!theme_pb->pixmap24)
     {
       char   *filename;
       GError *err = NULL;
 
       filename = g_build_filename (theme_pb->dirname, theme_pb->basename, NULL);
-      theme_pb->pixmap = sapwood_pixmap_get_for_file (filename,
-						      theme_pb->border_left,
-						      theme_pb->border_right,
-						      theme_pb->border_top,
-						      theme_pb->border_bottom,
-						      &err);
-      if (!theme_pb->pixmap)
+      theme_pb->pixmap24 = sapwood_pixmap_get_for_file (filename,
+                                                        theme_pb->border_left,
+                                                        theme_pb->border_right,
+                                                        theme_pb->border_top,
+                                                        theme_pb->border_bottom,
+                                                        depth,
+                                                        &err);
+      if (!theme_pb->pixmap24)
 	{
 	  g_warning ("sapwood-theme: Failed to load pixmap file %s: %s\n",
 		     filename, err->message);
@@ -254,19 +257,20 @@
 
       g_free (filename);
     }
-  return theme_pb->pixmap;
+  return theme_pb->pixmap24;
 }
 
 gboolean
 theme_pixbuf_get_geometry (ThemePixbuf *theme_pb,
+                           int          depth,
 			   gint        *width,
 			   gint        *height)
 {
   if (!theme_pb)
     return FALSE;
 
-  return sapwood_pixmap_get_geometry (theme_pixbuf_get_pixmap (theme_pb), 
-				     width, height);
+  return sapwood_pixmap_get_geometry (theme_pixbuf_get_pixmap (theme_pb, depth),
+                                      width, height);
 }
 
 /* Scale the rectangle (src_x, src_y, src_width, src_height)
@@ -301,10 +305,10 @@
   if (width <= 0 || height <= 0)
     return FALSE;
 
-  if (!theme_pixbuf_get_geometry (theme_pb, &pixbuf_width, &pixbuf_height))
+  if (!theme_pixbuf_get_geometry (theme_pb, gdk_drawable_get_depth (window), &pixbuf_width, &pixbuf_height))
     return FALSE;
 
-  pixmap = theme_pixbuf_get_pixmap (theme_pb);
+  pixmap = theme_pixbuf_get_pixmap (theme_pb, gdk_drawable_get_depth (window));
 
   if (theme_pb->stretch)
     {

Modified: projects/haf/trunk/sapwood/engine/theme-pixbuf.h
===================================================================
--- projects/haf/trunk/sapwood/engine/theme-pixbuf.h	2009-01-09 13:46:25 UTC (rev 17076)
+++ projects/haf/trunk/sapwood/engine/theme-pixbuf.h	2009-01-09 13:46:32 UTC (rev 17077)
@@ -138,7 +138,7 @@
   const char *dirname;
   gchar      *basename;
 
-  SapwoodPixmap *pixmap;
+  SapwoodPixmap *pixmap24;
 
   guint16     border_left;
   guint16     border_right;
@@ -185,8 +185,9 @@
 void         theme_pixbuf_set_filename (ThemePixbuf  *theme_pb,
 					const char   *filename) G_GNUC_INTERNAL;
 gboolean     theme_pixbuf_get_geometry (ThemePixbuf  *theme_pb,
-					gint         *width,
-					gint         *height) G_GNUC_INTERNAL;
+                                        int           depth,
+                                        gint         *width,
+                                        gint         *height) G_GNUC_INTERNAL;
 void         theme_pixbuf_set_border   (ThemePixbuf  *theme_pb,
 					gint          left,
 					gint          right,


More information about the maemo-commits mailing list