[cairo-commit] 5 commits - doc/public src/cairo-xcb.h src/cairo-xcb-private.h src/cairo-xcb-surface.c
Chris Wilson
ickle at kemper.freedesktop.org
Fri Dec 2 07:33:00 PST 2011
doc/public/cairo-docs.xml | 2
doc/public/cairo-sections.txt | 13 ++++
src/cairo-xcb-private.h | 1
src/cairo-xcb-surface.c | 118 +++++++++++++++++++++++++++++++++---------
src/cairo-xcb.h | 6 ++
5 files changed, 114 insertions(+), 26 deletions(-)
New commits:
commit 498ca4bf74b5c6202e74a71f2134baae9f5cad69
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Dec 2 15:16:11 2011 +0000
doc: Add similar-image, map-to-image, unmap-image
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/doc/public/cairo-sections.txt b/doc/public/cairo-sections.txt
index c8c559a..8c642d4 100644
--- a/doc/public/cairo-sections.txt
+++ b/doc/public/cairo-sections.txt
@@ -201,6 +201,7 @@ CAIRO_MIME_TYPE_UNIQUE_ID
cairo_surface_t
cairo_content_t
cairo_surface_create_similar
+cairo_surface_create_similar_image
cairo_surface_create_for_rectangle
cairo_surface_reference
cairo_surface_destroy
@@ -226,6 +227,8 @@ cairo_surface_show_page
cairo_surface_has_show_text_glyphs
cairo_surface_set_mime_data
cairo_surface_get_mime_data
+cairo_surface_map_to_image
+cairo_surface_unmap_image
</SECTION>
<SECTION>
commit 9156339295e0223f8c806baaefa293c98a37ba93
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Dec 2 15:08:40 2011 +0000
xcb: Silence a compiler warning for mixing status and internal status enums
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index 3254cda..fd82514 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -229,7 +229,7 @@ _cairo_xcb_surface_create_shm_image (cairo_xcb_connection_t *connection,
{
cairo_surface_t *image;
cairo_xcb_shm_info_t *shm_info;
- cairo_status_t status;
+ cairo_int_status_t status;
size_t stride;
*shm_info_out = NULL;
commit b9d4a5f1068ac038ca47fdad7dcf05dfa21b211b
Author: Keith Packard <keithp at keithp.com>
Date: Fri Dec 2 14:57:24 2011 +0000
Add cairo_xcb_surface_set_drawable
Mirrors cairo_xlib_surface_set_drawable, allowing the drawable
targeted by a surface to be changed on the fly.
Signed-off-by: Keith Packard <keithp at keithp.com>
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/doc/public/cairo-sections.txt b/doc/public/cairo-sections.txt
index 3d41533..c8c559a 100644
--- a/doc/public/cairo-sections.txt
+++ b/doc/public/cairo-sections.txt
@@ -160,6 +160,7 @@ cairo_xcb_surface_create
cairo_xcb_surface_create_for_bitmap
cairo_xcb_surface_create_with_xrender_format
cairo_xcb_surface_set_size
+cairo_xcb_surface_set_drawable
</SECTION>
<SECTION>
diff --git a/src/cairo-xcb-private.h b/src/cairo-xcb-private.h
index 42a112c..8d90bc6 100644
--- a/src/cairo-xcb-private.h
+++ b/src/cairo-xcb-private.h
@@ -806,6 +806,7 @@ slim_hidden_proto (cairo_xcb_surface_create);
slim_hidden_proto (cairo_xcb_surface_create_for_bitmap);
slim_hidden_proto (cairo_xcb_surface_create_with_xrender_format);
slim_hidden_proto (cairo_xcb_surface_set_size);
+slim_hidden_proto (cairo_xcb_surface_set_drawable);
slim_hidden_proto (cairo_xcb_device_debug_get_precision);
slim_hidden_proto_no_warn (cairo_xcb_device_debug_set_precision);
#endif
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index 6ddc815..3254cda 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -1430,3 +1430,71 @@ cairo_xcb_surface_set_size (cairo_surface_t *abstract_surface,
#if CAIRO_HAS_XLIB_XCB_FUNCTIONS
slim_hidden_def (cairo_xcb_surface_set_size);
#endif
+
+/**
+ * cairo_xcb_surface_set_drawable:
+ * @surface: a #cairo_surface_t for the XCB backend
+ * @drawable: the new drawable of the surface
+ * @width: the new width of the surface
+ * @height: the new height of the surface
+ *
+ * Informs cairo of the new drawable and size of the XCB drawable underlying the
+ * surface.
+ *
+ **/
+void
+cairo_xcb_surface_set_drawable (cairo_surface_t *abstract_surface,
+ xcb_drawable_t drawable,
+ int width,
+ int height)
+{
+ cairo_xcb_surface_t *surface;
+
+ if (unlikely (abstract_surface->status))
+ return;
+ if (unlikely (abstract_surface->finished)) {
+ _cairo_surface_set_error (abstract_surface,
+ _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
+ return;
+ }
+
+
+ if (abstract_surface->type != CAIRO_SURFACE_TYPE_XCB) {
+ _cairo_surface_set_error (abstract_surface,
+ _cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
+ return;
+ }
+
+ if (width > XLIB_COORD_MAX || height > XLIB_COORD_MAX || width <= 0 || height <= 0) {
+ _cairo_surface_set_error (abstract_surface,
+ _cairo_error (CAIRO_STATUS_INVALID_SIZE));
+ return;
+ }
+
+ surface = (cairo_xcb_surface_t *) abstract_surface;
+
+ if (surface->owns_pixmap)
+ return;
+
+ if (surface->drawable != drawable) {
+ cairo_status_t status;
+ status = _cairo_xcb_connection_acquire (surface->connection);
+ if (unlikely (status))
+ return;
+
+ if (surface->picture != XCB_NONE) {
+ _cairo_xcb_connection_render_free_picture (surface->connection,
+ surface->picture);
+ surface->picture = XCB_NONE;
+ }
+
+ _cairo_xcb_connection_release (surface->connection);
+
+ surface->drawable = drawable;
+ }
+ surface->width = width;
+ surface->height = height;
+}
+#if CAIRO_HAS_XLIB_XCB_FUNCTIONS
+slim_hidden_def (cairo_xcb_surface_set_drawable);
+#endif
diff --git a/src/cairo-xcb.h b/src/cairo-xcb.h
index 4bfb0b5..e321d84 100644
--- a/src/cairo-xcb.h
+++ b/src/cairo-xcb.h
@@ -75,6 +75,12 @@ cairo_xcb_surface_set_size (cairo_surface_t *surface,
int width,
int height);
+cairo_public void
+cairo_xcb_surface_set_drawable (cairo_surface_t *surface,
+ xcb_drawable_t drawable,
+ int width,
+ int height);
+
cairo_public xcb_connection_t *
cairo_xcb_device_get_connection (cairo_device_t *device);
commit a30013f72a4096085d1ddd60180644132ae87522
Author: Keith Packard <keithp at keithp.com>
Date: Fri Dec 2 14:57:23 2011 +0000
Create XCB documentation.
Signed-off-by: Keith Packard <keithp at keithp.com>
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/doc/public/cairo-docs.xml b/doc/public/cairo-docs.xml
index c2ffead..f67f3e9 100644
--- a/doc/public/cairo-docs.xml
+++ b/doc/public/cairo-docs.xml
@@ -42,7 +42,7 @@
<xi:include href="xml/cairo-svg.xml"/>
<xi:include href="xml/cairo-quartz.xml" />
<!--xi:include href="xml/cairo-quartz-image.xml"/-->
- <!--xi:include href="xml/cairo-xcb.xml"/-->
+ <xi:include href="xml/cairo-xcb.xml"/>
<xi:include href="xml/cairo-xlib.xml"/>
</chapter>
<chapter id="cairo-support">
diff --git a/doc/public/cairo-sections.txt b/doc/public/cairo-sections.txt
index 11439ae..3d41533 100644
--- a/doc/public/cairo-sections.txt
+++ b/doc/public/cairo-sections.txt
@@ -154,6 +154,15 @@ cairo_xlib_surface_get_xrender_format
</SECTION>
<SECTION>
+<FILE>cairo-xcb</FILE>
+CAIRO_HAS_XCB_SURFACE
+cairo_xcb_surface_create
+cairo_xcb_surface_create_for_bitmap
+cairo_xcb_surface_create_with_xrender_format
+cairo_xcb_surface_set_size
+</SECTION>
+
+<SECTION>
<FILE>cairo-svg</FILE>
CAIRO_HAS_SVG_SURFACE
cairo_svg_surface_create
commit d5c7d2e2f4e201166e3f0df4ae326f10bdcfe07c
Author: Keith Packard <keithp at keithp.com>
Date: Fri Dec 2 14:57:22 2011 +0000
cairo-xcb: gtk-doc doesn't like _ in parameter names
Any function documented with gtk-doc must not have _ in any parameter
names, or at least that's what I've found. This patch simply renames
parameters as needed to make things work.
Signed-off-by: Keith Packard <keithp at keithp.com>
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index 77d4e79..6ddc815 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -1149,7 +1149,7 @@ _cairo_xcb_screen_from_visual (xcb_connection_t *connection,
/**
* cairo_xcb_surface_create:
- * @xcb_connection: an XCB connection
+ * @connection: an XCB connection
* @drawable: an XCB drawable
* @visual: the visual to use for drawing to @drawable. The depth
* of the visual must match the depth of the drawable.
@@ -1179,7 +1179,7 @@ _cairo_xcb_screen_from_visual (xcb_connection_t *connection,
* occurs. You can use cairo_surface_status() to check for this.
**/
cairo_surface_t *
-cairo_xcb_surface_create (xcb_connection_t *xcb_connection,
+cairo_xcb_surface_create (xcb_connection_t *connection,
xcb_drawable_t drawable,
xcb_visualtype_t *visual,
int width,
@@ -1192,7 +1192,7 @@ cairo_xcb_surface_create (xcb_connection_t *xcb_connection,
xcb_render_pictformat_t xrender_format;
int depth;
- if (xcb_connection_has_error (xcb_connection))
+ if (xcb_connection_has_error (connection))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_WRITE_ERROR));
if (unlikely (width > XLIB_COORD_MAX || height > XLIB_COORD_MAX))
@@ -1200,7 +1200,7 @@ cairo_xcb_surface_create (xcb_connection_t *xcb_connection,
if (unlikely (width <= 0 || height <= 0))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
- xcb_screen = _cairo_xcb_screen_from_visual (xcb_connection, visual, &depth);
+ xcb_screen = _cairo_xcb_screen_from_visual (connection, visual, &depth);
if (unlikely (xcb_screen == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_VISUAL));
@@ -1223,7 +1223,7 @@ cairo_xcb_surface_create (xcb_connection_t *xcb_connection,
if (! _pixman_format_from_masks (&image_masks, &pixman_format))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
- screen = _cairo_xcb_screen_get (xcb_connection, xcb_screen);
+ screen = _cairo_xcb_screen_get (connection, xcb_screen);
if (unlikely (screen == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@@ -1242,11 +1242,11 @@ slim_hidden_def (cairo_xcb_surface_create);
/**
* cairo_xcb_surface_create_for_bitmap:
- * @xcb_connection: an XCB connection
- * @xcb_screen: the XCB screen associated with @bitmap
+ * @connection: an XCB connection
+ * @screen: the XCB screen associated with @bitmap
* @bitmap: an XCB drawable (a Pixmap with depth 1)
- * @width: the current width of @drawable
- * @height: the current height of @drawable
+ * @width: the current width of @bitmap
+ * @height: the current height of @bitmap
*
* Creates an XCB surface that draws to the given bitmap.
* This will be drawn to as a %CAIRO_FORMAT_A1 object.
@@ -1260,15 +1260,15 @@ slim_hidden_def (cairo_xcb_surface_create);
* occurs. You can use cairo_surface_status() to check for this.
**/
cairo_surface_t *
-cairo_xcb_surface_create_for_bitmap (xcb_connection_t *xcb_connection,
- xcb_screen_t *xcb_screen,
+cairo_xcb_surface_create_for_bitmap (xcb_connection_t *connection,
+ xcb_screen_t *screen,
xcb_pixmap_t bitmap,
int width,
int height)
{
- cairo_xcb_screen_t *screen;
+ cairo_xcb_screen_t *cairo_xcb_screen;
- if (xcb_connection_has_error (xcb_connection))
+ if (xcb_connection_has_error (connection))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_WRITE_ERROR));
if (width > XLIB_COORD_MAX || height > XLIB_COORD_MAX)
@@ -1276,13 +1276,13 @@ cairo_xcb_surface_create_for_bitmap (xcb_connection_t *xcb_connection,
if (unlikely (width <= 0 || height <= 0))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
- screen = _cairo_xcb_screen_get (xcb_connection, xcb_screen);
- if (unlikely (screen == NULL))
+ cairo_xcb_screen = _cairo_xcb_screen_get (connection, screen);
+ if (unlikely (cairo_xcb_screen == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
- return _cairo_xcb_surface_create_internal (screen, bitmap, FALSE,
+ return _cairo_xcb_surface_create_internal (cairo_xcb_screen, bitmap, FALSE,
PIXMAN_a1,
- screen->connection->standard_formats[CAIRO_FORMAT_A1],
+ cairo_xcb_screen->connection->standard_formats[CAIRO_FORMAT_A1],
width, height);
}
#if CAIRO_HAS_XLIB_XCB_FUNCTIONS
@@ -1321,18 +1321,18 @@ slim_hidden_def (cairo_xcb_surface_create_for_bitmap);
* occurs. You can use cairo_surface_status() to check for this.
**/
cairo_surface_t *
-cairo_xcb_surface_create_with_xrender_format (xcb_connection_t *xcb_connection,
- xcb_screen_t *xcb_screen,
+cairo_xcb_surface_create_with_xrender_format (xcb_connection_t *connection,
+ xcb_screen_t *screen,
xcb_drawable_t drawable,
xcb_render_pictforminfo_t *format,
int width,
int height)
{
- cairo_xcb_screen_t *screen;
+ cairo_xcb_screen_t *cairo_xcb_screen;
cairo_format_masks_t image_masks;
pixman_format_code_t pixman_format;
- if (xcb_connection_has_error (xcb_connection))
+ if (xcb_connection_has_error (connection))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_WRITE_ERROR));
if (width > XLIB_COORD_MAX || height > XLIB_COORD_MAX)
@@ -1364,11 +1364,11 @@ cairo_xcb_surface_create_with_xrender_format (xcb_connection_t *xcb_connecti
if (! _pixman_format_from_masks (&image_masks, &pixman_format))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
- screen = _cairo_xcb_screen_get (xcb_connection, xcb_screen);
- if (unlikely (screen == NULL))
+ cairo_xcb_screen = _cairo_xcb_screen_get (connection, screen);
+ if (unlikely (cairo_xcb_screen == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
- return _cairo_xcb_surface_create_internal (screen,
+ return _cairo_xcb_surface_create_internal (cairo_xcb_screen,
drawable,
FALSE,
pixman_format,
More information about the cairo-commit
mailing list