[cairo-commit] [cairo-www] 3 commits - src/cookbook

Bryce Harrington bryce at freedesktop.org
Mon Jul 6 13:21:41 PDT 2015


 src/cookbook/xcbsurface.c |   35 ++++++++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)

New commits:
commit 968034942c9610969281b1d323e7a2bfb6d4bb20
Author: Bryce Harrington <bryce at osg.samsung.com>
Date:   Mon Jul 6 13:21:27 2015 -0700

    cookbook: Don't forget cleanup

diff --git a/src/cookbook/xcbsurface.c b/src/cookbook/xcbsurface.c
index fdeff58..9ea0126 100644
--- a/src/cookbook/xcbsurface.c
+++ b/src/cookbook/xcbsurface.c
@@ -116,6 +116,7 @@ int main()
 		xcb_flush(c);
 	}
 	cairo_surface_finish(surface);
+	cairo_surface_destroy(surface);
 	xcb_disconnect(c);
 	return 0;
 }
commit 28347926e4b3d2f7f5b5c51eafba9a9e68c59844
Author: Bryce Harrington <bryce at osg.samsung.com>
Date:   Mon Jul 6 13:20:56 2015 -0700

    cookbook: Avoid extra redraws

diff --git a/src/cookbook/xcbsurface.c b/src/cookbook/xcbsurface.c
index a50d711..fdeff58 100644
--- a/src/cookbook/xcbsurface.c
+++ b/src/cookbook/xcbsurface.c
@@ -87,9 +87,12 @@ int main()
 	while ((event = xcb_wait_for_event(c))) {
 		switch (event->response_type & ~0x80) {
 		case XCB_EXPOSE:
-			/* Should check if this is the last expose event in the
-			 * sequence, but I'm too lazy right now...
+			/* Avoid extra redraws by checking if this is
+			 * the last expose event in the sequence
 			 */
+			if (((xcb_expose_event_t *) event)->count != 0)
+				break;
+
 			cairo_set_source_rgb(cr, 0, 1, 0);
 			cairo_paint(cr);
 
commit 809e36a401636a6458ce091bd59dcef5d9f6004c
Author: Bryce Harrington <bryce at osg.samsung.com>
Date:   Mon Jul 6 12:57:21 2015 -0700

    cookbook: Specify license for xcbsurface

diff --git a/src/cookbook/xcbsurface.c b/src/cookbook/xcbsurface.c
index 8d21dd7..a50d711 100644
--- a/src/cookbook/xcbsurface.c
+++ b/src/cookbook/xcbsurface.c
@@ -1,3 +1,28 @@
+/*
+ * Copyright © 2015 Uli Schlachter <psychon at znc.in>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ * find_visual() is adapted from draw_find_visual() from the Awesome
+ * window manager (http://awesome.naquadah.org).
+ */
+
 #include <xcb/xcb.h>
 #include <cairo-xcb.h>
 #include <stdio.h>
@@ -6,7 +31,7 @@
 static xcb_visualtype_t *find_visual(xcb_connection_t *c, xcb_visualid_t visual)
 {
 	xcb_screen_iterator_t screen_iter = xcb_setup_roots_iterator(xcb_get_setup(c));
-	
+
 	for (; screen_iter.rem; xcb_screen_next(&screen_iter)) {
 		xcb_depth_iterator_t depth_iter = xcb_screen_allowed_depths_iterator(screen_iter.data);
 		for (; depth_iter.rem; xcb_depth_next(&depth_iter)) {


More information about the cairo-commit mailing list