[cairo-commit] cairo-gtk-engine/src Makefile.am, 1.10, 1.11 caligula-draw.c, 1.5, NONE caligula-draw.h, 1.1, NONE caligula-style.c, 1.1, 1.2

Owen Taylor commit at pdx.freedesktop.org
Thu Feb 10 12:23:20 PST 2005


Committed by: otaylor

Update of /cvs/cairo/cairo-gtk-engine/src
In directory gabe:/tmp/cvs-serv29986/src

Modified Files:
	Makefile.am caligula-style.c 
Removed Files:
	caligula-draw.c caligula-draw.h 
Log Message:
2005-02-10  Owen Taylor  <otaylor at redhat.com>

        * src/caligula-style.c (caligula_begin_paint): Merge
        caligula-draw.[ch] into here. caligula-draw was just method
        implementations for CaligulaStyle.


Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/cairo-gtk-engine/src/Makefile.am,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Makefile.am	10 Feb 2005 16:54:53 -0000	1.10
+++ Makefile.am	10 Feb 2005 20:23:18 -0000	1.11
@@ -18,8 +18,6 @@
 
 libcaligula_la_SOURCES = 	 \
 	caligula.c 		 \
-	caligula-draw.c 	 \
-	caligula-draw.h		 \
 	caligula-draw-shadowed.c \
 	caligula-draw-shadowed.h \
 	caligula-draw-sketchy.c  \

--- caligula-draw.c DELETED ---

--- caligula-draw.h DELETED ---

Index: caligula-style.c
===================================================================
RCS file: /cvs/cairo/cairo-gtk-engine/src/caligula-style.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- caligula-style.c	10 Feb 2005 16:54:53 -0000	1.1
+++ caligula-style.c	10 Feb 2005 20:23:18 -0000	1.2
@@ -19,14 +19,97 @@
  * USA
  */
 
+#include <stdlib.h>
+
+#include <cairo.h>
+#include <cairo-xlib.h>
+#include <gdk/gdkx.h>
+
+#include "caligula-rand.h"
 #include "caligula-style.h"
-#include "caligula-draw.h"
+#include "caligula-draw-sketchy.h"
+#include "caligula-draw-swirly.h"
+#include "caligula-draw-grassy.h"
+#include "caligula-draw-shadowed.h"
+
+static cairo_t *
+caligula_begin_paint (GdkDrawable *window, gint *x_offset, gint *y_offset)
+{
+    Display *dpy;
+    Drawable xid;
+    GdkDrawable *drawable;
+    cairo_t *cr;
+  
+    if (GDK_IS_WINDOW (window))
+	gdk_window_get_internal_paint_info (window, &drawable,
+					    x_offset, y_offset);
+    else
+	drawable = window;
+
+    dpy = gdk_x11_drawable_get_xdisplay (drawable);
+    xid = gdk_x11_drawable_get_xid (drawable);
+
+    cr = cairo_create ();
+    cairo_set_target_drawable (cr, dpy, xid);
+
+    if (GDK_IS_WINDOW (window))
+	cairo_translate (cr, -*x_offset, -*y_offset);
+
+    return cr;
+}
 
 static void
-caligula_style_init (CaligulaStyle *style);
+caligula_end_paint (cairo_t *cr)
+{
+    cairo_destroy (cr);
+}
 
 static void
-caligula_style_class_init (CaligulaStyleClass *klass);
+caligula_draw_box (GtkStyle * style,
+		   GdkWindow * window,
+		   GtkStateType state_type,
+		   GtkShadowType shadow_type,
+		   GdkRectangle * area,
+		   GtkWidget * widget,
+		   const gchar * detail,
+		   gint x, gint y, gint width, gint height)
+{ 
+    cairo_t *cr;
+    gint x_offset, y_offset;
+    gint box;
+
+    caligula_srand ((unsigned)widget);
+
+    cr = caligula_begin_paint (window, &x_offset, &y_offset);
+
+    box = caligula_rand_within (0, 3);
+    switch (box) {
+    case 0:
+	caligula_draw_sketchy_box (cr, x, y, width, height);
+	break;
+    case 1:
+	caligula_draw_swirly_box (cr, x, y, width, height);
+	break;
+    default:
+	caligula_draw_grassy_box (cr, x, y, width, height);
+	break;
+    }
+
+    caligula_end_paint (cr);
+}
+
+static void
+caligula_style_init (CaligulaStyle *style)
+{
+}
+
+static void
+caligula_style_class_init (CaligulaStyleClass *klass)
+{
+    GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
+
+    style_class->draw_box = caligula_draw_box;
+}
 
 GType caligula_type_style = 0;
 
@@ -50,16 +133,3 @@
 						     "CaligulaStyle",
 						     &object_info, 0);
 }
-
-static void
-caligula_style_init (CaligulaStyle *style)
-{
-}
-
-static void
-caligula_style_class_init (CaligulaStyleClass *klass)
-{
-    GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
-
-    style_class->draw_box = caligula_draw_box;
-}




More information about the cairo-commit mailing list