start on cairo rendering github/cairo origin/cairo cairo
authorDana Jansens <danakj@orodu.net>
Wed, 17 Feb 2010 03:00:09 +0000 (22:00 -0500)
committerDana Jansens <danakj@orodu.net>
Wed, 17 Feb 2010 03:00:09 +0000 (22:00 -0500)
Makefile.am
configure.ac
obrender/render.h
obrender/window.c [new file with mode: 0644]
obrender/window.h [new file with mode: 0644]

index d5e60b6d7c079d121a302ad2df4d216fede4c051..e80f1918f545808158c2d2db09914b87874ac621 100644 (file)
@@ -64,6 +64,7 @@ obrender_libobrender_la_CPPFLAGS = \
        $(GLIB_CFLAGS) \
        $(XML_CFLAGS) \
        $(PANGO_CFLAGS) \
+       $(CAIRO_CFLAGS) \
        -DG_LOG_DOMAIN=\"ObRender\" \
        -DDEFAULT_THEME=\"$(theme)\"
 obrender_libobrender_la_LDFLAGS = \
@@ -71,6 +72,7 @@ obrender_libobrender_la_LDFLAGS = \
 obrender_libobrender_la_LIBADD = \
        $(X_LIBS) \
        $(PANGO_LIBS) \
+       $(CAIRO_LIBS) \
        $(GLIB_LIBS) \
        $(XML_LIBS)
 obrender_libobrender_la_SOURCES = \
@@ -94,7 +96,9 @@ obrender_libobrender_la_SOURCES = \
        obrender/render.h \
        obrender/render.c \
        obrender/theme.h \
-       obrender/theme.c
+       obrender/theme.c \
+       obrender/window.h \
+       obrender/window.c
 
 ## obt ##
 
index f58f7e5c1774aa3cbc5cad7b3d677569288a8f8b..7a4d0b8932dbd50a676f3d838d7428461d9c4e71 100644 (file)
@@ -106,6 +106,10 @@ PKG_CHECK_MODULES(PANGO, [pango >= 1.8.0 pangoxft >= 1.8.0])
 AC_SUBST(PANGO_CFLAGS)
 AC_SUBST(PANGO_LIBS)
 
+PKG_CHECK_MODULES(CAIRO, [cairo-xlib])
+AC_SUBST(CAIRO_CFLAGS)
+AC_SUBST(CAIRO_LIBS)
+
 PKG_CHECK_MODULES(XML, [libxml-2.0 >= 2.6.0])
 AC_SUBST(XML_CFLAGS)
 AC_SUBST(XML_LIBS)
index cf9883a96fa9b2f9edd857900488028f5376fb57..d96d1e3380c74a58b00106f0f26ce8649631442f 100644 (file)
@@ -46,6 +46,7 @@ typedef struct _RrColor            RrColor;
 typedef struct _RrImage            RrImage;
 typedef struct _RrImagePic         RrImagePic;
 typedef struct _RrImageCache       RrImageCache;
+typedef struct _RrWindow           RrWindow;
 
 typedef guint32 RrPixel32;
 typedef guint16 RrPixel16;
diff --git a/obrender/window.c b/obrender/window.c
new file mode 100644 (file)
index 0000000..42d92a8
--- /dev/null
@@ -0,0 +1,55 @@
+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+
+   window.c for the Openbox window manager
+   Copyright (c) 2010        Dana Jansens
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   See the COPYING file for a copy of the GNU General Public License.
+*/
+
+#include "window.h"
+#include "instance.h"
+#include "render.h"
+#include <cairo.h>
+#include <cairo-xlib.h>
+
+struct _RrWindow {
+    guint ref;
+    cairo_surface_t *sur;
+    cairo_t *cr;
+};
+
+
+RrWindow* RrWindowNew(RrInstance *inst)
+{
+    RrWindow *win;
+
+    win = g_slice_new(RrWindow);
+    win->sur = cairo_xlib_surface_create(inst->display, None, inst->visual,
+                                         1, 1);
+    win->cr = cairo_create(win->sur);
+
+    return win;
+}
+void RrWindowRef(RrWindow *win)
+{
+    ++win->ref;
+}
+
+void RrWindowUnref(RrWindow *win)
+{
+    if (win && --win->ref < 1) {
+        cairo_destroy(win->cr);
+        cairo_surface_destroy(win->sur);
+        g_slice_free(RrWindow, win);
+    }
+}
diff --git a/obrender/window.h b/obrender/window.h
new file mode 100644 (file)
index 0000000..5d81930
--- /dev/null
@@ -0,0 +1,29 @@
+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+
+   window.h for the Openbox window manager
+   Copyright (c) 2010        Dana Jansens
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   See the COPYING file for a copy of the GNU General Public License.
+*/
+
+#ifndef __render_window_h
+#define __render_window_h
+
+#include "render.h"
+#include "geom.h"
+
+RrWindow* RrWindowNew(RrInstance *inst);
+void RrWindowRef(RrWindow *win);
+void RrWindowUnref(RrWindow *win);
+
+#endif