[cairo-commit] gtkcairo/gtkcairo gdkcairo.c, 1.9, 1.10 gdkcairo.h, 1.9, 1.10 gtkcairo.c, 1.17, 1.18 gtkcairo.h, 1.10, 1.11

Oeyvind Kolaas commit at pdx.freedesktop.org
Sat Dec 11 08:04:44 PST 2004


Committed by: pippin

Update of /cvs/cairo/gtkcairo/gtkcairo
In directory gabe:/tmp/cvs-serv29885/gtkcairo

Modified Files:
	gdkcairo.c gdkcairo.h gtkcairo.c gtkcairo.h 
Log Message:
Changed coding style to GNU coding style

Index: gdkcairo.c
===================================================================
RCS file: /cvs/cairo/gtkcairo/gtkcairo/gdkcairo.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- gdkcairo.c	14 Nov 2004 11:33:36 -0000	1.9
+++ gdkcairo.c	11 Dec 2004 16:04:42 -0000	1.10
@@ -22,333 +22,358 @@
 #include "gdkcairo.h"
 
 static void
-gdkcairo_init (gdkcairo_t *self, GtkWidget *widget)
+gdkcairo_init (gdkcairo_t *self,
+               GtkWidget  *widget)
 {
-    self->widget = widget;
-    self->cr     = cairo_create ();
+  self->widget = widget;
+  self->cr = cairo_create ();
 
 
-    self->backend = GDKCAIRO_BACKEND_IMAGE;
-    #ifdef CAIRO_HAS_XLIB_SURFACE
-    self->backend = GDKCAIRO_BACKEND_XLIB;
-    #endif
-    #ifdef USE_GL
-    {
-        char *GTKCAIRO_GL=getenv ("GTKCAIRO_GL");
-        if (GTKCAIRO_GL && atoi (GTKCAIRO_GL))
+  self->backend = GDKCAIRO_BACKEND_IMAGE;
+#ifdef CAIRO_HAS_XLIB_SURFACE
+  self->backend = GDKCAIRO_BACKEND_XLIB;
+#endif
+#ifdef USE_GL
+  {
+    char     *GTKCAIRO_GL = getenv ("GTKCAIRO_GL");
+    if (GTKCAIRO_GL && atoi (GTKCAIRO_GL))
+      self->backend = GDKCAIRO_BACKEND_GL;
+  }
+#endif
+  {
+    char     *GDKCAIRO_BACKEND = getenv ("GTKCAIRO_BACKEND");
+    if (GDKCAIRO_BACKEND)
+      {
+        if (!strcmp (GDKCAIRO_BACKEND, "image"))
+          {
+            self->backend = GDKCAIRO_BACKEND_IMAGE;
+          }
+#ifdef CAIRO_HAS_XLIB_SURFACE
+        else if (!strcmp (GDKCAIRO_BACKEND, "xlib"))
+          {
+            self->backend = GDKCAIRO_BACKEND_XLIB;
+          }
+#endif
+#ifdef USE_GL
+        else if (!strcmp (GDKCAIRO_BACKEND, "gl"))
+          {
             self->backend = GDKCAIRO_BACKEND_GL;
-    }
-    #endif
-    {
-        char *GDKCAIRO_BACKEND = getenv ("GTKCAIRO_BACKEND");
-        if (GDKCAIRO_BACKEND) {
-            if (!strcmp (GDKCAIRO_BACKEND, "image")) {
-                self->backend = GDKCAIRO_BACKEND_IMAGE;
-            }
-            #ifdef CAIRO_HAS_XLIB_SURFACE
-            else if (!strcmp (GDKCAIRO_BACKEND, "xlib")) {
-                self->backend = GDKCAIRO_BACKEND_XLIB;
-            }
-            #endif
-            #ifdef USE_GL
-            else if (!strcmp (GDKCAIRO_BACKEND, "gl")) {
-                self->backend = GDKCAIRO_BACKEND_GL;
-            }
-            #endif
-            else {
-                self->backend = GDKCAIRO_BACKEND_IMAGE;
-                #ifdef CAIRO_HAS_XLIB_SURFACE
-                self->backend = GDKCAIRO_BACKEND_XLIB;
-                #endif
-                fprintf (stderr, "unknown GTKCAIRO_BACKEND '%s' falling back\n", GDKCAIRO_BACKEND);
-            }
-        }
-    }
+          }
+#endif
+        else
+          {
+            self->backend = GDKCAIRO_BACKEND_IMAGE;
+#ifdef CAIRO_HAS_XLIB_SURFACE
+            self->backend = GDKCAIRO_BACKEND_XLIB;
+#endif
+            fprintf (stderr, "unknown GTKCAIRO_BACKEND '%s' falling back\n",
+                     GDKCAIRO_BACKEND);
+          }
+      }
+  }
 
-    switch (self->backend) {
-        case GDKCAIRO_BACKEND_IMAGE:
-            break;
-        #ifdef CAIRO_HAS_XLIB_SURFACE
-        case GDKCAIRO_BACKEND_XLIB:
-            break;
-        #endif
-        #ifdef USE_GL
-        case GDKCAIRO_BACKEND_GL:
-            self->glitz_surface = NULL;
-            break;
-        #endif
-        default:
-            g_assert (0);
-            break;
+  switch (self->backend)
+    {
+    case GDKCAIRO_BACKEND_IMAGE:
+      break;
+#ifdef CAIRO_HAS_XLIB_SURFACE
+    case GDKCAIRO_BACKEND_XLIB:
+      break;
+#endif
+#ifdef USE_GL
+    case GDKCAIRO_BACKEND_GL:
+      self->glitz_surface = NULL;
+      break;
+#endif
+    default:
+      g_assert (0);
+      break;
     }
 }
 
 gdkcairo_t *
-gdkcairo_new (GtkWidget *widget)
+gdkcairo_new (GtkWidget   *widget)
 {
-    gdkcairo_t *self = malloc (sizeof (gdkcairo_t));
-    gdkcairo_init (self, widget);
-    return self;
+  gdkcairo_t *self = malloc (sizeof (gdkcairo_t));
+  gdkcairo_init (self, widget);
+  return self;
 }
 
 void
 gdkcairo_destroy (gdkcairo_t *self)
 {
-	if (self->cr) {
-		cairo_destroy (self->cr);
-        self->cr = NULL;
-	}
+  if (self->cr)
+    {
+      cairo_destroy (self->cr);
+      self->cr = NULL;
+    }
 }
 
 void
 gdkcairo_realize (gdkcairo_t *self)
 {
-	GtkWidget *widget=self->widget;
-	GdkWindowAttr attributes;
-	gint attributes_mask;
+  GtkWidget *widget = self->widget;
+  GdkWindowAttr attributes;
+  gint      attributes_mask;
 
-	g_return_if_fail (widget != NULL);
+  g_return_if_fail (widget != NULL);
 
-	GTK_WIDGET_SET_FLAGS (self->widget, GTK_REALIZED);
+  GTK_WIDGET_SET_FLAGS (self->widget, GTK_REALIZED);
 
-	attributes.x = widget->allocation.x;
-	attributes.y = widget->allocation.y;
-	attributes.width = widget->allocation.width;
-	attributes.height = widget->allocation.height;
-	attributes.wclass = GDK_INPUT_OUTPUT;
-	attributes.window_type = GDK_WINDOW_CHILD;
-	attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
-	attributes.visual = gtk_widget_get_visual (widget);
+  attributes.x = widget->allocation.x;
+  attributes.y = widget->allocation.y;
+  attributes.width = widget->allocation.width;
+  attributes.height = widget->allocation.height;
+  attributes.wclass = GDK_INPUT_OUTPUT;
+  attributes.window_type = GDK_WINDOW_CHILD;
+  attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
+  attributes.visual = gtk_widget_get_visual (widget);
 
 retry:
-    switch (self->backend) {
-        case GDKCAIRO_BACKEND_IMAGE:
-            break;
-        #ifdef CAIRO_HAS_XLIB_SURFACE
-        case GDKCAIRO_BACKEND_XLIB:
-	      attributes.colormap = gtk_widget_get_colormap (widget);
+  switch (self->backend)
+    {
+    case GDKCAIRO_BACKEND_IMAGE:
+      break;
+#ifdef CAIRO_HAS_XLIB_SURFACE
+    case GDKCAIRO_BACKEND_XLIB:
+      attributes.colormap = gtk_widget_get_colormap (widget);
 
-	      attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-	      widget->window = gdk_window_new (widget->parent->window,
-			    &attributes, attributes_mask);
+      attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+      widget->window = gdk_window_new (widget->parent->window,
+                                       &attributes, attributes_mask);
 
-            break;
-        #endif
-        #ifdef USE_GL
-        case GDKCAIRO_BACKEND_GL: {
-	    Display *dpy = gdk_x11_get_default_xdisplay ();
-	    int screen = gdk_x11_get_default_screen ();
-            XVisualInfo *vinfo;
-	    glitz_drawable_format_t *dformat;
-	    glitz_drawable_format_t templ;
-	    unsigned long mask;
-	    char *GTKCAIRO_GL_DOUBLEBUFFER;
-	    char *GTKCAIRO_GL_SAMPLES;
+      break;
+#endif
+#ifdef USE_GL
+    case GDKCAIRO_BACKEND_GL:
+      {
+        Display  *dpy = gdk_x11_get_default_xdisplay ();
+        int       screen = gdk_x11_get_default_screen ();
+        XVisualInfo *vinfo;
+        glitz_drawable_format_t *dformat;
+        glitz_drawable_format_t templ;
+        unsigned long mask;
+        char     *GTKCAIRO_GL_DOUBLEBUFFER;
+        char     *GTKCAIRO_GL_SAMPLES;
 
-	    GTKCAIRO_GL_DOUBLEBUFFER = getenv ("GTKCAIRO_GL_DOUBLEBUFFER");
-	    GTKCAIRO_GL_SAMPLES = getenv ("GTKCAIRO_GL_SAMPLES");
+        GTKCAIRO_GL_DOUBLEBUFFER = getenv ("GTKCAIRO_GL_DOUBLEBUFFER");
+        GTKCAIRO_GL_SAMPLES = getenv ("GTKCAIRO_GL_SAMPLES");
 
-	    templ.types.window = 1;
-	    mask = GLITZ_FORMAT_WINDOW_MASK;
+        templ.types.window = 1;
+        mask = GLITZ_FORMAT_WINDOW_MASK;
 
-	    if (GTKCAIRO_GL_DOUBLEBUFFER) {
-		if (atoi (GTKCAIRO_GL_DOUBLEBUFFER))
-		    templ.doublebuffer = 1;
-		else
-		    templ.doublebuffer = 0;
-		    
-		mask |= GLITZ_FORMAT_DOUBLEBUFFER_MASK;
-	    }
+        if (GTKCAIRO_GL_DOUBLEBUFFER)
+          {
+            if (atoi (GTKCAIRO_GL_DOUBLEBUFFER))
+              templ.doublebuffer = 1;
+            else
+              templ.doublebuffer = 0;
 
-	    if (GTKCAIRO_GL_SAMPLES) {
-		templ.samples = atoi (GTKCAIRO_GL_SAMPLES);
+            mask |= GLITZ_FORMAT_DOUBLEBUFFER_MASK;
+          }
 
-		/* less than 1 sample is not possible */
-		if (templ.samples < 1)
-		    templ.samples = 1;
-		    
-		mask |= GLITZ_FORMAT_SAMPLES_MASK;
-	    }
-	    
-	    dformat =
-		glitz_glx_find_drawable_format (dpy, screen, mask, &templ, 0);
-	    
-	    if (dformat) {
-		glitz_drawable_t *drawable;
-		glitz_format_t *format;
-		XID xid;
-		
-		vinfo = glitz_glx_get_visual_info_from_format (dpy, screen,
-							       dformat);
-		gtk_widget_set_double_buffered (widget, FALSE);
-		attributes.visual = gdkx_visual_get (vinfo->visualid);
-		attributes.colormap =
-		    gdk_colormap_new (attributes.visual, TRUE);
-		
-		attributes_mask =
-		    GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-		
-		widget->window =
-		    gdk_window_new (gtk_widget_get_parent_window (widget),
-				    &attributes, attributes_mask);
+        if (GTKCAIRO_GL_SAMPLES)
+          {
+            templ.samples = atoi (GTKCAIRO_GL_SAMPLES);
 
-		xid = gdk_x11_drawable_get_xid (widget->window);
+            /* less than 1 sample is not possible */
+            if (templ.samples < 1)
+              templ.samples = 1;
 
-		drawable =
-		    glitz_glx_create_drawable_for_window (dpy, screen,
-							  dformat, xid,
-							  attributes.width,
-							  attributes.height);
-		format = glitz_find_standard_format (drawable,
-						     GLITZ_STANDARD_ARGB32);
-		self->glitz_surface =
-		    glitz_surface_create (drawable,
-					  format,
-					  attributes.width,
-					  attributes.height);
+            mask |= GLITZ_FORMAT_SAMPLES_MASK;
+          }
 
-		glitz_surface_attach (self->glitz_surface,
-				      drawable,
-				      (dformat->doublebuffer) ?
-				      GLITZ_DRAWABLE_BUFFER_BACK_COLOR:
-				      GLITZ_DRAWABLE_BUFFER_FRONT_COLOR,
-				      0, 0);
+        dformat =
+          glitz_glx_find_drawable_format (dpy, screen, mask, &templ, 0);
 
-		glitz_drawable_destroy (drawable);
-					  
-		cairo_set_target_glitz (self->cr, self->glitz_surface);
-            } else {
-		g_warning ("could not find a usable GL visual\n");
-		self->backend = GDKCAIRO_BACKEND_XLIB;
-		goto retry;
-	    }
-            }
-            break;
-        #endif
-        default:
-            break;
+        if (dformat)
+          {
+            glitz_drawable_t *drawable;
+            glitz_format_t *format;
+            XID       xid;
+
+            vinfo = glitz_glx_get_visual_info_from_format (dpy, screen,
+                                                           dformat);
+            gtk_widget_set_double_buffered (widget, FALSE);
+            attributes.visual = gdkx_visual_get (vinfo->visualid);
+            attributes.colormap = gdk_colormap_new (attributes.visual, TRUE);
+
+            attributes_mask =
+              GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+
+            widget->window =
+              gdk_window_new (gtk_widget_get_parent_window (widget),
+                              &attributes, attributes_mask);
+
+            xid = gdk_x11_drawable_get_xid (widget->window);
+
+            drawable =
+              glitz_glx_create_drawable_for_window (dpy, screen,
+                                                    dformat, xid,
+                                                    attributes.width,
+                                                    attributes.height);
+            format = glitz_find_standard_format (drawable,
+                                                 GLITZ_STANDARD_ARGB32);
+            self->glitz_surface =
+              glitz_surface_create (drawable,
+                                    format,
+                                    attributes.width, attributes.height);
+
+            glitz_surface_attach (self->glitz_surface,
+                                  drawable,
+                                  (dformat->doublebuffer) ?
+                                  GLITZ_DRAWABLE_BUFFER_BACK_COLOR :
+                                  GLITZ_DRAWABLE_BUFFER_FRONT_COLOR, 0, 0);
+
+            glitz_drawable_destroy (drawable);
+
+            cairo_set_target_glitz (self->cr, self->glitz_surface);
+          }
+        else
+          {
+            g_warning ("could not find a usable GL visual\n");
+            self->backend = GDKCAIRO_BACKEND_XLIB;
+            goto retry;
+          }
+      }
+      break;
+#endif
+    default:
+      break;
     }
 
-    gtk_style_attach (widget->style, widget->window);
-	gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-	gdk_window_set_user_data (widget->window, widget);
+  gtk_style_attach (widget->style, widget->window);
+  gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+  gdk_window_set_user_data (widget->window, widget);
 }
 
 void
 gdkcairo_size_allocate (gdkcairo_t *self,
-                        int x,
-                        int y,
-                        int width,
-                        int height)
+                        gint        x,
+                        gint        y,
+                        gint        width,
+                        gint        height)
 {
-	if (GTK_WIDGET_REALIZED (self->widget)) {
-       gdk_window_move_resize (self->widget->window, x, y, width, height);
+  if (GTK_WIDGET_REALIZED (self->widget))
+    {
+      gdk_window_move_resize (self->widget->window, x, y, width, height);
 
-       switch (self->backend) {
-         #ifdef CAIRO_HAS_XLIB_SURFACE
-           case GDKCAIRO_BACKEND_XLIB:
-               break;
-         #endif
-         #ifdef USE_GL
-           case GDKCAIRO_BACKEND_GL:
-            if (self->glitz_surface) {
-		glitz_format_t *format;
-		glitz_drawable_t *drawable;
-		glitz_drawable_format_t *dformat;
+      switch (self->backend)
+        {
+#ifdef CAIRO_HAS_XLIB_SURFACE
+        case GDKCAIRO_BACKEND_XLIB:
+          break;
+#endif
+#ifdef USE_GL
+        case GDKCAIRO_BACKEND_GL:
+          if (self->glitz_surface)
+            {
+              glitz_format_t *format;
+              glitz_drawable_t *drawable;
+              glitz_drawable_format_t *dformat;
 
-		format = glitz_surface_get_format (self->glitz_surface);
-		drawable = glitz_surface_get_drawable (self->glitz_surface);
-		dformat = glitz_drawable_get_format (drawable);
-		
-		glitz_surface_destroy (self->glitz_surface);
+              format = glitz_surface_get_format (self->glitz_surface);
+              drawable = glitz_surface_get_drawable (self->glitz_surface);
+              dformat = glitz_drawable_get_format (drawable);
 
-		glitz_drawable_update_size (drawable, width, height);
+              glitz_surface_destroy (self->glitz_surface);
 
-		self->glitz_surface =
-		    glitz_surface_create (drawable, format, width, height);
+              glitz_drawable_update_size (drawable, width, height);
 
-		glitz_surface_attach (self->glitz_surface,
-				      drawable,
-				      (dformat->doublebuffer) ?
-				      GLITZ_DRAWABLE_BUFFER_BACK_COLOR:
-				      GLITZ_DRAWABLE_BUFFER_FRONT_COLOR,
-				      0, 0);
-		
-		cairo_set_target_glitz (self->cr, self->glitz_surface);
+              self->glitz_surface =
+                glitz_surface_create (drawable, format, width, height);
+
+              glitz_surface_attach (self->glitz_surface,
+                                    drawable,
+                                    (dformat->doublebuffer) ?
+                                    GLITZ_DRAWABLE_BUFFER_BACK_COLOR :
+                                    GLITZ_DRAWABLE_BUFFER_FRONT_COLOR, 0, 0);
+
+              cairo_set_target_glitz (self->cr, self->glitz_surface);
             }
-	    
-            break;
-         #endif
-           default:
-              g_assert (0);
-              break;
-       }
+
+          break;
+#endif
+        default:
+          g_assert (0);
+          break;
+        }
     }
 }
 
 gint
-gdkcairo_expose (gdkcairo_t *self,
+gdkcairo_expose (gdkcairo_t     *self,
                  GdkEventExpose *event)
 {
-    GtkWidget *widget = self->widget;
+  GtkWidget *widget = self->widget;
 
-	g_return_val_if_fail (widget != NULL, FALSE);
-	g_return_val_if_fail (event != NULL, FALSE);
+  g_return_val_if_fail (widget != NULL, FALSE);
+  g_return_val_if_fail (event != NULL, FALSE);
 
-    switch (self->backend) {
-        #ifdef USE_GL
-        case GDKCAIRO_BACKEND_GL:{
-	    glitz_drawable_t *drawable;
-	    glitz_drawable_format_t *dformat;
+  switch (self->backend)
+    {
+#ifdef USE_GL
+    case GDKCAIRO_BACKEND_GL:
+      {
+        glitz_drawable_t *drawable;
+        glitz_drawable_format_t *dformat;
 
-            cairo_rectangle (self->cr, 0, 0, widget->allocation.width, widget->allocation.height);
-            cairo_set_rgb_color (self->cr, 0.7, 0.7, 0.7);  /* FIXME: use color from style */
-            gtk_cairo_set_gdk_color (self->cr,
-              &(self->widget->style->bg[GTK_STATE_NORMAL]) );
-            cairo_fill      (self->cr);
+        cairo_rectangle (self->cr, 0, 0, widget->allocation.width,
+                         widget->allocation.height);
+        cairo_set_rgb_color (self->cr, 0.7, 0.7, 0.7);  /* FIXME: use color from style */
+        gtk_cairo_set_gdk_color (self->cr,
+                                 &(self->widget->style->
+                                   bg[GTK_STATE_NORMAL]));
+        cairo_fill (self->cr);
 
-	    g_signal_emit_by_name (self->widget, "paint", self->cr);
+        g_signal_emit_by_name (self->widget, "paint", self->cr);
 
-	    drawable = glitz_surface_get_drawable (self->glitz_surface);
-	    dformat = glitz_drawable_get_format (drawable);
+        drawable = glitz_surface_get_drawable (self->glitz_surface);
+        dformat = glitz_drawable_get_format (drawable);
 
-	    glitz_surface_flush (self->glitz_surface);
-	    
-	    if (dformat->doublebuffer)
-		glitz_drawable_swap_buffers (drawable);
-	    else
-		glitz_drawable_flush (drawable);
-        }break;
-        #endif
-        #ifdef CAIRO_HAS_XLIB_SURFACE
-        case GDKCAIRO_BACKEND_XLIB: {
-            GdkDrawable *gdkdrawable;
-            gint x_off, y_off;
+        glitz_surface_flush (self->glitz_surface);
 
-	        gdk_window_get_internal_paint_info (widget->window,
-			                                &gdkdrawable, &x_off, &y_off);
+        if (dformat->doublebuffer)
+          glitz_drawable_swap_buffers (drawable);
+        else
+          glitz_drawable_flush (drawable);
+      }
+      break;
+#endif
+#ifdef CAIRO_HAS_XLIB_SURFACE
+    case GDKCAIRO_BACKEND_XLIB:
+      {
+        GdkDrawable *gdkdrawable;
+        gint      x_off, y_off;
 
-	        cairo_set_target_drawable (self->cr,
-			                       gdk_x11_drawable_get_xdisplay (gdkdrawable),
-			                       gdk_x11_drawable_get_xid (gdkdrawable));
+        gdk_window_get_internal_paint_info (widget->window,
+                                            &gdkdrawable, &x_off, &y_off);
 
-	        /* counter offset of expose */
-	        if (x_off || y_off) {
-		        cairo_save (self->cr);
-		        cairo_translate (self->cr, -x_off, -y_off);
-	        }
+        cairo_set_target_drawable (self->cr,
+                                   gdk_x11_drawable_get_xdisplay
+                                   (gdkdrawable),
+                                   gdk_x11_drawable_get_xid (gdkdrawable));
 
-	        g_signal_emit_by_name (self->widget, "paint", self->cr);
+        /* counter offset of expose */
+        if (x_off || y_off)
+          {
+            cairo_save (self->cr);
+            cairo_translate (self->cr, -x_off, -y_off);
+          }
 
-	        if (x_off || y_off) {
-		        cairo_restore (self->cr);
-            }
-	    }break;
-        #endif
-        default:
-            g_assert(0);
+        g_signal_emit_by_name (self->widget, "paint", self->cr);
+
+        if (x_off || y_off)
+          {
+            cairo_restore (self->cr);
+          }
+      }
+      break;
+#endif
+    default:
+      g_assert (0);
     }
-	return FALSE;
+  return FALSE;
 }
 
 /* vim: set ts=4 sw=4 et : */

Index: gdkcairo.h
===================================================================
RCS file: /cvs/cairo/gtkcairo/gtkcairo/gdkcairo.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- gdkcairo.h	11 Nov 2004 09:05:23 -0000	1.9
+++ gdkcairo.h	11 Dec 2004 16:04:42 -0000	1.10
@@ -25,50 +25,47 @@
 #include <cairo.h>
 
 #ifdef USE_GL
-    #ifndef CAIRO_HAS_GLITZ_SURFACE
-        #undef USE_GL
-    #endif
+#ifndef CAIRO_HAS_GLITZ_SURFACE
+#undef USE_GL
+#endif
 #endif
 
 #ifdef USE_GL
-    #include <glitz-glx.h>
+#include <glitz-glx.h>
 #endif
 
-typedef enum {
-    GDKCAIRO_BACKEND_IMAGE,
-    GDKCAIRO_BACKEND_XLIB,
-    GDKCAIRO_BACKEND_GL,
-    GDKCAIRO_BACKEND_NONE
-} gdkcairo_backend;
+typedef enum
+{
+  GDKCAIRO_BACKEND_IMAGE,
+  GDKCAIRO_BACKEND_XLIB,
+  GDKCAIRO_BACKEND_GL,
+  GDKCAIRO_BACKEND_NONE
+}
+gdkcairo_backend;
 
-typedef struct
-gdkcairo_t {
-    GtkWidget *widget;
-	cairo_t *cr;
-    gdkcairo_backend backend;
+typedef struct gdkcairo_t
+{
+  GtkWidget *widget;
+  cairo_t  *cr;
+  gdkcairo_backend backend;
 
-    #ifdef USE_GL
-	glitz_surface_t *glitz_surface;
-    #endif
+#ifdef USE_GL
+  glitz_surface_t *glitz_surface;
+#endif
 } gdkcairo_t;
 
-gdkcairo_t *
-gdkcairo_new (GtkWidget *widget);
+gdkcairo_t *gdkcairo_new (GtkWidget *widget);
 
-void
-gdkcairo_destroy (gdkcairo_t *self);
+void        gdkcairo_destroy (gdkcairo_t *self);
 
-void
-gdkcairo_realize (gdkcairo_t *self);
+void        gdkcairo_realize (gdkcairo_t *self);
 
-void
-gdkcairo_size_allocate (gdkcairo_t *self,
-                        int x,
-                        int y,
-                        int width,
-                        int height);
-gint
-gdkcairo_expose (gdkcairo_t *self,
-                 GdkEventExpose *event);
+void        gdkcairo_size_allocate (gdkcairo_t *self,
+                                    gint        x,
+                                    gint        y,
+                                    gint        width,
+                                    gint        height);
+gint        gdkcairo_expose (gdkcairo_t     *self,
+                             GdkEventExpose *event);
 
 #endif /* GDKCAIRO_H */

Index: gtkcairo.c
===================================================================
RCS file: /cvs/cairo/gtkcairo/gtkcairo/gtkcairo.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- gtkcairo.c	9 Aug 2004 16:32:40 -0000	1.17
+++ gtkcairo.c	11 Dec 2004 16:04:42 -0000	1.18
@@ -25,29 +25,23 @@
 #include "gdkcairo.h"
 #include "gtkcairo.h"
 
-enum {
-	PAINT,
-	LAST_SIGNAL
+enum
+{
+  PAINT,
+  LAST_SIGNAL
 };
 
-static void
-gtk_cairo_class_init            (GtkCairoClass *klass);
+static void gtk_cairo_class_init (GtkCairoClass * klass);
 
-static void
-gtk_cairo_init                  (GtkCairo *gtkcairo);
+static void gtk_cairo_init (GtkCairo *gtkcairo);
 
-static void
-gtk_cairo_destroy               (GtkObject *object);
+static void gtk_cairo_destroy (GtkObject *object);
 
-static void
-gtk_cairo_realize               (GtkWidget *widget);
+static void gtk_cairo_realize (GtkWidget *widget);
 
 static void
-gtk_cairo_size_allocate         (GtkWidget     *widget,
-                                 GtkAllocation *allocation);
-static gint
-gtk_cairo_expose                (GtkWidget      *widget,
-                                 GdkEventExpose *event);
+gtk_cairo_size_allocate (GtkWidget *widget, GtkAllocation * allocation);
+static gint gtk_cairo_expose (GtkWidget *widget, GdkEventExpose *event);
 
 static GtkWidgetClass *parent_class = NULL;
 static guint signals[LAST_SIGNAL] = { 0 };
@@ -57,163 +51,165 @@
 GType
 gtk_cairo_get_type (void)
 {
-	static GType gtk_cairo_type = 0;
+  static GType gtk_cairo_type = 0;
 
-	if (!gtk_cairo_type) {
-		static const GTypeInfo gtk_cairo_info = {
-			sizeof (GtkCairoClass),
-			NULL,
-			NULL,
-			(GClassInitFunc) gtk_cairo_class_init,
-			NULL,
-			NULL,
-			sizeof (GtkCairo),
-			0,
-			(GInstanceInitFunc) gtk_cairo_init,
-		};
+  if (!gtk_cairo_type)
+    {
+      static const GTypeInfo gtk_cairo_info = {
+        sizeof (GtkCairoClass),
+        NULL,
+        NULL,
+        (GClassInitFunc) gtk_cairo_class_init,
+        NULL,
+        NULL,
+        sizeof (GtkCairo),
+        0,
+        (GInstanceInitFunc) gtk_cairo_init,
+      };
 
-		gtk_cairo_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkCairo",
-				                                 &gtk_cairo_info, 0);
-	}
+      gtk_cairo_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkCairo",
+                                               &gtk_cairo_info, 0);
+    }
 
-	return gtk_cairo_type;
+  return gtk_cairo_type;
 }
 
 static void
-gtk_cairo_class_init (GtkCairoClass *class)
+gtk_cairo_class_init (GtkCairoClass * class)
 {
-	GtkObjectClass *object_class;
-	GtkWidgetClass *widget_class;
+  GtkObjectClass *object_class;
+  GtkWidgetClass *widget_class;
 
-	object_class = (GtkObjectClass*) class;
-	widget_class = (GtkWidgetClass*) class;
+  object_class = (GtkObjectClass *) class;
+  widget_class = (GtkWidgetClass *) class;
 
-	parent_class = gtk_type_class(GTK_TYPE_WIDGET);
+  parent_class = gtk_type_class (GTK_TYPE_WIDGET);
 
-	object_class->destroy = gtk_cairo_destroy;
+  object_class->destroy = gtk_cairo_destroy;
 
-	widget_class->realize = gtk_cairo_realize;
-	widget_class->expose_event = gtk_cairo_expose;
-	widget_class->size_allocate = gtk_cairo_size_allocate;
+  widget_class->realize = gtk_cairo_realize;
+  widget_class->expose_event = gtk_cairo_expose;
+  widget_class->size_allocate = gtk_cairo_size_allocate;
 
-	signals[PAINT] = g_signal_new ("paint",
-			GTK_TYPE_CAIRO,
-			G_SIGNAL_RUN_LAST,
-			G_STRUCT_OFFSET (GtkCairoClass, paint),
-			NULL, NULL,
-			g_cclosure_marshal_VOID__POINTER,
-			G_TYPE_NONE, 1, G_TYPE_POINTER);
+  signals[PAINT] = g_signal_new ("paint",
+                                 GTK_TYPE_CAIRO,
+                                 G_SIGNAL_RUN_LAST,
+                                 G_STRUCT_OFFSET (GtkCairoClass, paint),
+                                 NULL, NULL,
+                                 g_cclosure_marshal_VOID__POINTER,
+                                 G_TYPE_NONE, 1, G_TYPE_POINTER);
 }
 
 static void
 gtk_cairo_init (GtkCairo *gtkcairo)
 {
-	gtkcairo->gdkcairo = gdkcairo_new (GTK_WIDGET (gtkcairo));
+  gtkcairo->gdkcairo = gdkcairo_new (GTK_WIDGET (gtkcairo));
 }
 
 GtkWidget *
 gtk_cairo_new (void)
 {
-	GtkWidget *gtkcairo;
-	gtkcairo = GTK_WIDGET (g_object_new (GTK_TYPE_CAIRO, NULL));
+  GtkWidget *gtkcairo;
+  gtkcairo = GTK_WIDGET (g_object_new (GTK_TYPE_CAIRO, NULL));
 
-	gtk_widget_queue_draw (GTK_WIDGET (gtkcairo));
+  gtk_widget_queue_draw (GTK_WIDGET (gtkcairo));
 
-	return gtkcairo;
+  return gtkcairo;
 }
 
 static void
 gtk_cairo_destroy (GtkObject *object)
 {
-	GtkCairo *gtkcairo;
+  GtkCairo *gtkcairo;
 
-	g_return_if_fail (object != NULL);
-	g_return_if_fail (GTK_IS_CAIRO (object));
+  g_return_if_fail (object != NULL);
+  g_return_if_fail (GTK_IS_CAIRO (object));
 
-	gtkcairo = GTK_CAIRO (object);
+  gtkcairo = GTK_CAIRO (object);
 
-	gdkcairo_destroy (gtkcairo->gdkcairo);
+  gdkcairo_destroy (gtkcairo->gdkcairo);
 
-	if (GTK_OBJECT_CLASS (parent_class)->destroy)
-		(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+  if (GTK_OBJECT_CLASS (parent_class)->destroy)
+    (*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
 }
 
 static void
 gtk_cairo_realize (GtkWidget *widget)
 {
-	GtkCairo *gtkcairo;
+  GtkCairo *gtkcairo;
 
-	g_return_if_fail (widget != NULL);
-	g_return_if_fail (GTK_IS_CAIRO (widget));
+  g_return_if_fail (widget != NULL);
+  g_return_if_fail (GTK_IS_CAIRO (widget));
 
-	GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-	gtkcairo = GTK_CAIRO (widget);
+  GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+  gtkcairo = GTK_CAIRO (widget);
 
-	gdkcairo_realize (gtkcairo->gdkcairo);
+  gdkcairo_realize (gtkcairo->gdkcairo);
 }
 
 static void
 gtk_cairo_size_allocate (GtkWidget     *widget,
                          GtkAllocation *allocation)
 {
-    GtkCairo *gtkcairo;
-	g_return_if_fail (widget != NULL);
-	g_return_if_fail (GTK_IS_CAIRO (widget));
-	g_return_if_fail (allocation != NULL);
+  GtkCairo *gtkcairo;
+  g_return_if_fail (widget != NULL);
+  g_return_if_fail (GTK_IS_CAIRO (widget));
+  g_return_if_fail (allocation != NULL);
 
-	gtkcairo = GTK_CAIRO (widget);
+  gtkcairo = GTK_CAIRO (widget);
 
-	widget->allocation = *allocation;
+  widget->allocation = *allocation;
 
-	gdkcairo_size_allocate (gtkcairo->gdkcairo,
-			allocation->x, allocation->y,
-			allocation->width, allocation->height);
+  gdkcairo_size_allocate (gtkcairo->gdkcairo,
+                          allocation->x, allocation->y,
+                          allocation->width, allocation->height);
 }
 
 static gint
 gtk_cairo_expose (GtkWidget      *widget,
                   GdkEventExpose *event)
 {
-	GtkCairo *gtkcairo;
+  GtkCairo *gtkcairo;
 
-	g_return_val_if_fail (widget != NULL, FALSE);
-	g_return_val_if_fail (GTK_IS_CAIRO (widget), FALSE);
-	g_return_val_if_fail (event != NULL, FALSE);
+  g_return_val_if_fail (widget != NULL, FALSE);
+  g_return_val_if_fail (GTK_IS_CAIRO (widget), FALSE);
+  g_return_val_if_fail (event != NULL, FALSE);
 
-	gtkcairo = GTK_CAIRO (widget);
+  gtkcairo = GTK_CAIRO (widget);
 
-	cairo_save (gtk_cairo_get_cairo (gtkcairo));
-	gdkcairo_expose (gtkcairo->gdkcairo, event);
-	cairo_restore (gtk_cairo_get_cairo (gtkcairo));
-	return FALSE;
+  cairo_save (gtk_cairo_get_cairo (gtkcairo));
+  gdkcairo_expose (gtkcairo->gdkcairo, event);
+  cairo_restore (gtk_cairo_get_cairo (gtkcairo));
+  return FALSE;
 }
 
-cairo_t *
-gtk_cairo_get_cairo (GtkCairo *gtkcairo) {
-	g_return_val_if_fail (gtkcairo != NULL, NULL);
-	g_return_val_if_fail (GTK_IS_CAIRO (gtkcairo), NULL);
-	return ((gdkcairo_t*) gtkcairo->gdkcairo)->cr;
+cairo_t  *
+gtk_cairo_get_cairo (GtkCairo *gtkcairo)
+{
+  g_return_val_if_fail (gtkcairo != NULL, NULL);
+  g_return_val_if_fail (GTK_IS_CAIRO (gtkcairo), NULL);
+  return ((gdkcairo_t *) gtkcairo->gdkcairo)->cr;
 }
 
 void
-gtk_cairo_set_gdk_color (cairo_t *cr,
+gtk_cairo_set_gdk_color (cairo_t  *cr,
                          GdkColor *color)
 {
-    double red, green, blue;
+  double    red, green, blue;
 
-    red   = color->red   / 65535.0;
-    green = color->green / 65535.0;
-    blue  = color->blue  / 65535.0;
+  red = color->red / 65535.0;
+  green = color->green / 65535.0;
+  blue = color->blue / 65535.0;
 
-    cairo_set_rgb_color (cr, red, green, blue);
+  cairo_set_rgb_color (cr, red, green, blue);
 }
 
 int
 gtk_cairo_backend_is_gl (GtkCairo *gtkcairo)
 {
-	if (((gdkcairo_t*)gtkcairo->gdkcairo)->backend == GDKCAIRO_BACKEND_GL)
-		return 1;
-	return 0;
+  if (((gdkcairo_t *) gtkcairo->gdkcairo)->backend == GDKCAIRO_BACKEND_GL)
+    return 1;
+  return 0;
 }
 
 #if 0
@@ -221,26 +217,25 @@
  */
 
 cairo_surface_t *
-gtk_cairo_surface_create_for_gdk_pixbuf (const GdkPixbuf *pixbuf)
+gtk_cairo_surface_create_for_gdk_pixbuf (const GdkPixbuf * pixbuf)
 {
-	cairo_surface_t *self;
-	char            *data;
-	cairo_format_t   format;
-	int              width;
-	int              height;
-	int              stride;
+  cairo_surface_t *self;
+  char     *data;
+  cairo_format_t format;
+  int       width;
+  int       height;
+  int       stride;
 
-	if (!pixbuf)
-		return NULL;
-	data   = gdk_pixbuf_get_pixels (pixbuf);
-	width  = gdk_pixbuf_get_width  (pixbuf);
-	height = gdk_pixbuf_get_height (pixbuf);
-	format = CAIRO_FORMAT_ARGB32;
-	stride = gdk_pixbuf_get_rowstride (pixbuf);
+  if (!pixbuf)
+    return NULL;
+  data = gdk_pixbuf_get_pixels (pixbuf);
+  width = gdk_pixbuf_get_width (pixbuf);
+  height = gdk_pixbuf_get_height (pixbuf);
+  format = CAIRO_FORMAT_ARGB32;
+  stride = gdk_pixbuf_get_rowstride (pixbuf);
 
-	self   = cairo_surface_create_for_image (
-			    data, format, width, height, stride);
-	return self;
+  self = cairo_surface_create_for_image (data, format, width, height, stride);
+  return self;
 }
 #endif
 

Index: gtkcairo.h
===================================================================
RCS file: /cvs/cairo/gtkcairo/gtkcairo/gtkcairo.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- gtkcairo.h	9 Aug 2004 16:32:40 -0000	1.10
+++ gtkcairo.h	11 Dec 2004 16:04:42 -0000	1.11
@@ -25,52 +25,49 @@
 #include <cairo.h>
 
 #ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern    "C"
+{
+#endif                          /* __cplusplus */
 
 #define GTK_TYPE_CAIRO	(gtk_cairo_get_type())
 #define GTK_CAIRO(obj)	GTK_CHECK_CAST (obj, GTK_TYPE_CAIRO, GtkCairo)
 #define GTK_CAIRO_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, GTK_TYPE_CAIRO, GtkCairoClass)
 #define GTK_IS_CAIRO(obj)	GTK_CHECK_TYPE (obj, GTK_TYPE_CAIRO)
 
-typedef struct _GtkCairo        GtkCairo;
-typedef struct _GtkCairoClass   GtkCairoClass;
+  typedef struct _GtkCairo GtkCairo;
+  typedef struct _GtkCairoClass GtkCairoClass;
 
 #define gdkcairo_t void
 
-struct _GtkCairo
-{
-	GtkWidget widget;
+  struct _GtkCairo
+  {
+    GtkWidget widget;
     gdkcairo_t *gdkcairo;
-};
+  };
 
 #undef gdkcairo_t
 
-struct _GtkCairoClass
-{
-	GtkWidgetClass parent_class;
-	void (*paint)(GtkCairo *, cairo_t *c);
-};
+  struct _GtkCairoClass
+  {
+    GtkWidgetClass parent_class;
+    void      (*paint) (GtkCairo *, cairo_t *c);
+  };
 
-GType
-gtk_cairo_get_type              (void);
+  GType     gtk_cairo_get_type (void);
 
-GtkWidget*
-gtk_cairo_new                   (void);
+  GtkWidget *gtk_cairo_new (void);
 
-cairo_t*
-gtk_cairo_get_cairo             (GtkCairo *gtkcairo);
+  cairo_t  *gtk_cairo_get_cairo (GtkCairo *gtkcairo);
 
 
 /* convenience function to set the current cairo color
  * from a GdkColor
  */
-void
-gtk_cairo_set_gdk_color (cairo_t *cr,
-                         GdkColor *color);
+  void      gtk_cairo_set_gdk_color (cairo_t  *cr,
+                                     GdkColor *color);
 
 #ifdef __cplusplus
 }
-#endif /* __cplusplus */
+#endif                          /* __cplusplus */
 
-#endif /* GTK_CAIRO_H */
+#endif                          /* GTK_CAIRO_H */




More information about the cairo-commit mailing list