[Xcb-commit] renderutil

Jamey Sharp jamey at kemper.freedesktop.org
Sat Oct 14 19:06:18 PDT 2006


 renderutil/glyph.c          |   85 ++++++++++++++++++++++++++++++--------------
 renderutil/xcb_renderutil.h |   11 +++++
 2 files changed, 70 insertions(+), 26 deletions(-)

New commits:
diff-tree f8a821fe2b3332725c5c3d7111fda6fbdf7b05a9 (from 28c2d56465530fd90675a6da2e5ce490f22ccccd)
Author: Jamey Sharp <jamey at minilop.net>
Date:   Sat Oct 14 19:05:52 2006 -0700

    Simplify xcb_render_util_composite_text, add xcb_render_util_composite_text_checked.

diff --git a/renderutil/glyph.c b/renderutil/glyph.c
index da8c53f..dc6624f 100644
--- a/renderutil/glyph.c
+++ b/renderutil/glyph.c
@@ -198,6 +198,18 @@ xcb_render_util_change_glyphset (
 	stream->current_glyphset = glyphset;
 }
 	
+typedef xcb_void_cookie_t
+(*xcb_render_composite_glyphs_func) (xcb_connection_t        *c,
+	                             uint8_t                  op,
+                                     xcb_render_picture_t     src,
+                                     xcb_render_picture_t     dst,
+                                     xcb_render_pictformat_t  mask_format,
+                                     xcb_render_glyphset_t    glyphset,
+                                     int16_t                  src_x,
+                                     int16_t                  src_y,
+                                     uint32_t                 glyphcmds_len,
+                                     const uint8_t           *glyphcmds);
+
 
 xcb_void_cookie_t
 xcb_render_util_composite_text (
@@ -210,45 +222,66 @@ xcb_render_util_composite_text (
 	int16_t                  src_y,
 	xcb_render_util_composite_text_stream_t *stream )
 {
-	xcb_void_cookie_t reply = { 0 };
-	uint32_t stream_len = CURRENT_LEN(stream);
+	xcb_render_composite_glyphs_func f;
 
 	switch (stream->glyph_size)
 	{
 	case 1:
-		reply = xcb_render_composite_glyphs_8 (
-			xc, op, src, dst, mask_format,
-			stream->initial_glyphset,
-			src_x, src_y,
-			stream_len,
-			(uint8_t *)stream->stream
-		);
+		f = xcb_render_composite_glyphs_8;
 		break;
 	case 2:
-		reply = xcb_render_composite_glyphs_16 (
-			xc, op, src, dst, mask_format,
-			stream->initial_glyphset,
-			src_x, src_y,
-			stream_len,
-			(uint8_t *)stream->stream
-		);
+		f = xcb_render_composite_glyphs_16;
 		break;
 	case 4:
-		reply = xcb_render_composite_glyphs_32 (
-			xc, op, src, dst, mask_format,
-			stream->initial_glyphset,
-			src_x, src_y,
-			stream_len,
-			(uint8_t *)stream->stream
-		);
+		f = xcb_render_composite_glyphs_32;
 		break;
 	default: /* uninitialized */
-		break;
+		return xcb_no_operation(xc);
 	}
-	return reply;
+	return f(
+		xc, op, src, dst, mask_format,
+		stream->initial_glyphset,
+		src_x, src_y,
+		CURRENT_LEN(stream),
+		(uint8_t *)stream->stream
+	);
 }
 
-/* FIXME: xcb_render_util_composite_text_checked */
+xcb_void_cookie_t
+xcb_render_util_composite_text_checked (
+	xcb_connection_t        *xc,
+	uint8_t                  op,
+	xcb_render_picture_t     src,
+	xcb_render_picture_t     dst,
+	xcb_render_pictformat_t  mask_format,
+	int16_t                  src_x,
+	int16_t                  src_y,
+	xcb_render_util_composite_text_stream_t *stream )
+{
+	xcb_render_composite_glyphs_func f;
+
+	switch (stream->glyph_size)
+	{
+	case 1:
+		f = xcb_render_composite_glyphs_8_checked;
+		break;
+	case 2:
+		f = xcb_render_composite_glyphs_16_checked;
+		break;
+	case 4:
+		f = xcb_render_composite_glyphs_32_checked;
+		break;
+	default: /* uninitialized */
+		return xcb_no_operation_checked(xc);
+	}
+	return f(
+		xc, op, src, dst, mask_format,
+		stream->initial_glyphset,
+		src_x, src_y,
+		CURRENT_LEN(stream),
+		(uint8_t *)stream->stream
+	);
+}
 
 void
 xcb_render_util_composite_text_free (
diff --git a/renderutil/xcb_renderutil.h b/renderutil/xcb_renderutil.h
index 33592a2..2026585 100644
--- a/renderutil/xcb_renderutil.h
+++ b/renderutil/xcb_renderutil.h
@@ -125,6 +125,17 @@ xcb_render_util_composite_text (
 	int16_t                  src_y,
 	xcb_render_util_composite_text_stream_t *stream );
 
+xcb_void_cookie_t
+xcb_render_util_composite_text_checked (
+	xcb_connection_t        *xc,
+	uint8_t                  op,
+	xcb_render_picture_t     src,
+	xcb_render_picture_t     dst,
+	xcb_render_pictformat_t  mask_format,
+	int16_t                  src_x,
+	int16_t                  src_y,
+	xcb_render_util_composite_text_stream_t *stream );
+
 void
 xcb_render_util_composite_text_free (
 	xcb_render_util_composite_text_stream_t *stream );


More information about the xcb-commit mailing list