[cairo-commit] gtkcairo/gtkcairo gdkcairo.c, 1.6, 1.7 gdkcairo.h,
1.8, 1.9
OEyvind Kolaas
commit at pdx.freedesktop.org
Thu Nov 11 01:05:25 PST 2004
Committed by: pippin
Update of /cvs/cairo/gtkcairo/gtkcairo
In directory gabe:/tmp/cvs-serv27604
Modified Files:
gdkcairo.c gdkcairo.h
Log Message:
oops not meant to be commited
Index: gdkcairo.c
===================================================================
RCS file: /cvs/cairo/gtkcairo/gtkcairo/gdkcairo.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- gdkcairo.c 11 Nov 2004 08:48:10 -0000 1.6
+++ gdkcairo.c 11 Nov 2004 09:05:22 -0000 1.7
@@ -74,7 +74,7 @@
#endif
#ifdef USE_GL
case GDKCAIRO_BACKEND_GL:
- self->glitz_drawable = NULL;
+ self->glitz_surface = NULL;
break;
#endif
default:
@@ -94,31 +94,31 @@
void
gdkcairo_destroy (gdkcairo_t *self)
{
- if (self->cr) {
- cairo_destroy (self->cr);
+ 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) {
@@ -126,62 +126,61 @@
break;
#ifdef CAIRO_HAS_XLIB_SURFACE
case GDKCAIRO_BACKEND_XLIB:
- attributes.colormap = gtk_widget_get_colormap (widget);
+ 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 ();
+ Display *dpy = gdk_x11_get_default_xdisplay ();
+ int screen = gdk_x11_get_default_screen ();
XVisualInfo *vinfo;
- glitz_drawable_format_t *onscreen_format;
- glitz_drawable_format_t templ;
- unsigned long mask;
-
- templ.doublebuffer = 1;
- mask = GLITZ_FORMAT_DOUBLEBUFFER_MASK;
+ glitz_format_t *onscreen_format;
+ glitz_format_t templ;
+ unsigned long mask;
- //templ.draw.onscreen = 1;
- //mask |= GLITZ_FORMAT_DRAW_ONSCREEN_MASK;
+ templ.doublebuffer = 1;
+ mask = GLITZ_FORMAT_DOUBLEBUFFER_MASK;
- templ.samples = 4;
- mask |= GLITZ_FORMAT_SAMPLES_MASK;
+ templ.draw.onscreen = 1;
+ mask |= GLITZ_FORMAT_DRAW_ONSCREEN_MASK;
- onscreen_format =
- glitz_glx_find_drawable_format (dpy, screen, mask, &templ, 0);
+ templ.multisample.samples = 4;
+ mask |= GLITZ_FORMAT_MULTISAMPLE_SAMPLES_MASK;
- if (!onscreen_format) {
- mask &= ~GLITZ_FORMAT_SAMPLES_MASK;
-
- onscreen_format =
- glitz_glx_find_drawable_format (dpy, screen, mask, &templ, 0);
- }
-
- /* XSetWindowAttributes xswa;*/
+ onscreen_format =
+ glitz_glx_find_format (dpy, screen, mask, &templ, 0);
+ if (!onscreen_format) {
+ mask &= ~GLITZ_FORMAT_MULTISAMPLE_SAMPLES_MASK;
+
+ onscreen_format =
+ glitz_glx_find_format (dpy, screen, mask, &templ, 0);
+ }
+
+ /* XSetWindowAttributes xswa;*/
- if (onscreen_format) {
+ if (onscreen_format) {
vinfo = glitz_glx_get_visual_info_from_format (dpy, screen, onscreen_format);
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;
+ 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);
- self->glitz_drawable =
- glitz_glx_create_drawable_for_window (dpy, screen,
- onscreen_format,
- gdk_x11_drawable_get_xid (widget->window),
- attributes.width,
- attributes.height);
+ widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
+ &attributes, attributes_mask);
+ self->glitz_surface =
+ glitz_glx_surface_create_for_window (dpy, screen,
+ onscreen_format,
+ gdk_x11_drawable_get_xid (widget->window),
+ attributes.width,
+ attributes.height);
- cairo_set_target_glitz (self->cr, self->glitz_drawable);
+ cairo_set_target_glitz (self->cr, self->glitz_surface);
} else {
g_error ("could not find a usable GL visual\n");
self->backend = GDKCAIRO_BACKEND_XLIB;
@@ -195,8 +194,8 @@
}
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_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+ gdk_window_set_user_data (widget->window, widget);
}
void
@@ -206,7 +205,7 @@
int width,
int height)
{
- if (GTK_WIDGET_REALIZED (self->widget)) {
+ if (GTK_WIDGET_REALIZED (self->widget)) {
gdk_window_move_resize (self->widget->window, x, y, width, height);
switch (self->backend) {
@@ -217,22 +216,22 @@
#ifdef USE_GL
case GDKCAIRO_BACKEND_GL:
if (self->glitz_surface) {
- glitz_format_t *format;
+ glitz_format_t *format;
- format = glitz_surface_get_format (self->glitz_surface);
-
- glitz_surface_destroy (self->glitz_surface);
-
- self->glitz_surface =
- glitz_glx_surface_create_for_window (gdk_x11_get_default_xdisplay (),
- gdk_x11_get_default_screen (),
- format,
- gdk_x11_drawable_get_xid (self->widget->window),
- width,
- height);
- cairo_set_target_glitz (self->cr, self->glitz_surface);
+ format = glitz_surface_get_format (self->glitz_surface);
+
+ glitz_surface_destroy (self->glitz_surface);
+
+ self->glitz_surface =
+ glitz_glx_surface_create_for_window (gdk_x11_get_default_xdisplay (),
+ gdk_x11_get_default_screen (),
+ format,
+ gdk_x11_drawable_get_xid (self->widget->window),
+ width,
+ height);
+ cairo_set_target_glitz (self->cr, self->glitz_surface);
}
-
+
break;
#endif
default:
@@ -248,8 +247,8 @@
{
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
@@ -261,7 +260,7 @@
&(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);
glitz_surface_swap_buffers (self->glitz_surface);
XSync (gdk_x11_get_default_xdisplay (), 0);
}break;
@@ -271,30 +270,30 @@
GdkDrawable *gdkdrawable;
gint x_off, y_off;
- gdk_window_get_internal_paint_info (widget->window,
- &gdkdrawable, &x_off, &y_off);
+ gdk_window_get_internal_paint_info (widget->window,
+ &gdkdrawable, &x_off, &y_off);
- cairo_set_target_drawable (self->cr,
- gdk_x11_drawable_get_xdisplay (gdkdrawable),
- gdk_x11_drawable_get_xid (gdkdrawable));
+ cairo_set_target_drawable (self->cr,
+ gdk_x11_drawable_get_xdisplay (gdkdrawable),
+ gdk_x11_drawable_get_xid (gdkdrawable));
- /* counter offset of expose */
- if (x_off || y_off) {
- cairo_save (self->cr);
- cairo_translate (self->cr, -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);
+ }
- g_signal_emit_by_name (self->widget, "paint", self->cr);
+ g_signal_emit_by_name (self->widget, "paint", self->cr);
- if (x_off || y_off) {
- cairo_restore (self->cr);
+ if (x_off || y_off) {
+ cairo_restore (self->cr);
}
- }break;
+ }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.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- gdkcairo.h 11 Nov 2004 08:48:10 -0000 1.8
+++ gdkcairo.h 11 Nov 2004 09:05:23 -0000 1.9
@@ -48,7 +48,7 @@
gdkcairo_backend backend;
#ifdef USE_GL
- glitz_drawable_t *glitz_drawable;
+ glitz_surface_t *glitz_surface;
#endif
} gdkcairo_t;
More information about the cairo-commit
mailing list