summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/xftrender.c61
1 files changed, 43 insertions, 18 deletions
diff --git a/src/xftrender.c b/src/xftrender.c
index dd605c3..227ae7e 100644
--- a/src/xftrender.c
+++ b/src/xftrender.c
@@ -26,6 +26,47 @@
#define NUM_ELT_LOCAL 128
/*
+ * Dispatch glyph drawing to the correct XRenderCompositeString function
+ */
+static void
+_XftCompositeString (Display *dpy,
+ int op,
+ Picture src,
+ Picture dst,
+ XRenderPictFormat *format,
+ GlyphSet glyphset,
+ int srcx,
+ int srcy,
+ int dstx,
+ int dsty,
+ int charwidth,
+ unsigned int *chars,
+ int nchars)
+{
+ if (nchars == 0)
+ return;
+
+ switch (charwidth) {
+ case 1:
+ default:
+ XRenderCompositeString8 (dpy, op,
+ src, dst, format, glyphset,
+ srcx, srcy, dstx, dsty, (char*)chars, nchars);
+ break;
+ case 2:
+ XRenderCompositeString16(dpy, op,
+ src, dst, format, glyphset,
+ srcx, srcy, dstx, dsty, (unsigned short*)chars, nchars);
+ break;
+ case 4:
+ XRenderCompositeString32(dpy, op,
+ src, dst, format, glyphset,
+ srcx, srcy, dstx, dsty, (unsigned int*)chars, nchars);
+ break;
+ }
+}
+
+/*
* Use the Render extension to draw the glyphs
*/
@@ -114,24 +155,8 @@ XftGlyphRender (Display *dpy,
case 4: char32[i] = (unsigned int) wire; break;
}
}
- switch (width) {
- case 1:
- default:
- XRenderCompositeString8 (dpy, op,
- src, dst, font->format, font->glyphset,
- srcx, srcy, x, y, char8, nglyphs);
- break;
- case 2:
- XRenderCompositeString16(dpy, op,
- src, dst, font->format, font->glyphset,
- srcx, srcy, x, y, char16, nglyphs);
- break;
- case 4:
- XRenderCompositeString32(dpy, op,
- src, dst, font->format, font->glyphset,
- srcx, srcy, x, y, char32, nglyphs);
- break;
- }
+ _XftCompositeString(dpy, op, src, dst, font->format, font->glyphset,
+ srcx, srcy, x, y, width, chars, nglyphs);
if (chars != char_local)
free (chars);
bail1: