diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2009-05-23 14:38:22 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2009-05-23 14:38:22 +0000 |
commit | 86bb951017acff65627eb198fe1fa4c73b46aad4 (patch) | |
tree | 18afd632e81d724b548b60373016d1459dfce5f3 /dist/xcb-util/renderutil | |
parent | 013b4a3065ff281c23c32277f08a521fd7922c23 (diff) |
import xcb-util 0.3.4
Diffstat (limited to 'dist/xcb-util/renderutil')
-rw-r--r-- | dist/xcb-util/renderutil/Makefile.am | 14 | ||||
-rw-r--r-- | dist/xcb-util/renderutil/Makefile.in | 567 | ||||
-rw-r--r-- | dist/xcb-util/renderutil/cache.c | 234 | ||||
-rw-r--r-- | dist/xcb-util/renderutil/glyph.c | 287 | ||||
-rw-r--r-- | dist/xcb-util/renderutil/util.c | 251 | ||||
-rw-r--r-- | dist/xcb-util/renderutil/xcb-renderutil.pc.in | 11 | ||||
-rw-r--r-- | dist/xcb-util/renderutil/xcb_renderutil.h | 142 |
7 files changed, 1506 insertions, 0 deletions
diff --git a/dist/xcb-util/renderutil/Makefile.am b/dist/xcb-util/renderutil/Makefile.am new file mode 100644 index 000000000..aaf0f4847 --- /dev/null +++ b/dist/xcb-util/renderutil/Makefile.am @@ -0,0 +1,14 @@ + +MAINTAINERCLEANFILES = Makefile.in + +lib_LTLIBRARIES = libxcb-render-util.la + +xcbinclude_HEADERS = xcb_renderutil.h + +libxcb_render_util_la_SOURCES = cache.c util.c glyph.c +libxcb_render_util_la_CPPFLAGS = $(XCB_CFLAGS) $(XCB_RENDER_CFLAGS) +libxcb_render_util_la_LIBADD = $(XCB_LIBS) $(XCB_RENDER_LIBS) + +pkgconfig_DATA = xcb-renderutil.pc + +EXTRA_DIST=xcb-renderutil.pc.in diff --git a/dist/xcb-util/renderutil/Makefile.in b/dist/xcb-util/renderutil/Makefile.in new file mode 100644 index 000000000..2882cc11b --- /dev/null +++ b/dist/xcb-util/renderutil/Makefile.in @@ -0,0 +1,567 @@ +# Makefile.in generated by automake 1.10.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = renderutil +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/xcb-renderutil.pc.in $(xcbinclude_HEADERS) +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = xcb-renderutil.pc +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \ + "$(DESTDIR)$(xcbincludedir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libxcb_render_util_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am_libxcb_render_util_la_OBJECTS = libxcb_render_util_la-cache.lo \ + libxcb_render_util_la-util.lo libxcb_render_util_la-glyph.lo +libxcb_render_util_la_OBJECTS = $(am_libxcb_render_util_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libxcb_render_util_la_SOURCES) +DIST_SOURCES = $(libxcb_render_util_la_SOURCES) +pkgconfigDATA_INSTALL = $(INSTALL_DATA) +DATA = $(pkgconfig_DATA) +xcbincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(xcbinclude_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CWARNFLAGS = @CWARNFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GPERF = @GPERF@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +M4 = @M4@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XCB_ATOM_CFLAGS = @XCB_ATOM_CFLAGS@ +XCB_ATOM_LIBS = @XCB_ATOM_LIBS@ +XCB_AUX_CFLAGS = @XCB_AUX_CFLAGS@ +XCB_AUX_LIBS = @XCB_AUX_LIBS@ +XCB_CFLAGS = @XCB_CFLAGS@ +XCB_EVENT_CFLAGS = @XCB_EVENT_CFLAGS@ +XCB_EVENT_LIBS = @XCB_EVENT_LIBS@ +XCB_ICCCM_CFLAGS = @XCB_ICCCM_CFLAGS@ +XCB_ICCCM_LIBS = @XCB_ICCCM_LIBS@ +XCB_LIBS = @XCB_LIBS@ +XCB_PROPERTY_CFLAGS = @XCB_PROPERTY_CFLAGS@ +XCB_PROPERTY_LIBS = @XCB_PROPERTY_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SHM_CFLAGS = @XCB_SHM_CFLAGS@ +XCB_SHM_LIBS = @XCB_SHM_LIBS@ +XPROTO_CFLAGS = @XPROTO_CFLAGS@ +XPROTO_LIBS = @XPROTO_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfigdir = @pkgconfigdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +xcbincludedir = @xcbincludedir@ +MAINTAINERCLEANFILES = Makefile.in +lib_LTLIBRARIES = libxcb-render-util.la +xcbinclude_HEADERS = xcb_renderutil.h +libxcb_render_util_la_SOURCES = cache.c util.c glyph.c +libxcb_render_util_la_CPPFLAGS = $(XCB_CFLAGS) $(XCB_RENDER_CFLAGS) +libxcb_render_util_la_LIBADD = $(XCB_LIBS) $(XCB_RENDER_LIBS) +pkgconfig_DATA = xcb-renderutil.pc +EXTRA_DIST = xcb-renderutil.pc.in +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign renderutil/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign renderutil/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +xcb-renderutil.pc: $(top_builddir)/config.status $(srcdir)/xcb-renderutil.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libxcb-render-util.la: $(libxcb_render_util_la_OBJECTS) $(libxcb_render_util_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libxcb_render_util_la_OBJECTS) $(libxcb_render_util_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxcb_render_util_la-cache.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxcb_render_util_la-glyph.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxcb_render_util_la-util.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +libxcb_render_util_la-cache.lo: cache.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxcb_render_util_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libxcb_render_util_la-cache.lo -MD -MP -MF $(DEPDIR)/libxcb_render_util_la-cache.Tpo -c -o libxcb_render_util_la-cache.lo `test -f 'cache.c' || echo '$(srcdir)/'`cache.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxcb_render_util_la-cache.Tpo $(DEPDIR)/libxcb_render_util_la-cache.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cache.c' object='libxcb_render_util_la-cache.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxcb_render_util_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libxcb_render_util_la-cache.lo `test -f 'cache.c' || echo '$(srcdir)/'`cache.c + +libxcb_render_util_la-util.lo: util.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxcb_render_util_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libxcb_render_util_la-util.lo -MD -MP -MF $(DEPDIR)/libxcb_render_util_la-util.Tpo -c -o libxcb_render_util_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxcb_render_util_la-util.Tpo $(DEPDIR)/libxcb_render_util_la-util.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util.c' object='libxcb_render_util_la-util.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxcb_render_util_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libxcb_render_util_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c + +libxcb_render_util_la-glyph.lo: glyph.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxcb_render_util_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libxcb_render_util_la-glyph.lo -MD -MP -MF $(DEPDIR)/libxcb_render_util_la-glyph.Tpo -c -o libxcb_render_util_la-glyph.lo `test -f 'glyph.c' || echo '$(srcdir)/'`glyph.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxcb_render_util_la-glyph.Tpo $(DEPDIR)/libxcb_render_util_la-glyph.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glyph.c' object='libxcb_render_util_la-glyph.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxcb_render_util_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libxcb_render_util_la-glyph.lo `test -f 'glyph.c' || echo '$(srcdir)/'`glyph.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" + @list='$(pkgconfig_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ + $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \ + done +install-xcbincludeHEADERS: $(xcbinclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(xcbincludedir)" || $(MKDIR_P) "$(DESTDIR)$(xcbincludedir)" + @list='$(xcbinclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(xcbincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(xcbincludedir)/$$f'"; \ + $(xcbincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(xcbincludedir)/$$f"; \ + done + +uninstall-xcbincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(xcbinclude_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(xcbincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(xcbincludedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(xcbincludedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-pkgconfigDATA install-xcbincludeHEADERS + +install-dvi: install-dvi-am + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES uninstall-pkgconfigDATA \ + uninstall-xcbincludeHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-pkgconfigDATA install-ps install-ps-am install-strip \ + install-xcbincludeHEADERS installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-libLTLIBRARIES uninstall-pkgconfigDATA \ + uninstall-xcbincludeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/dist/xcb-util/renderutil/cache.c b/dist/xcb-util/renderutil/cache.c new file mode 100644 index 000000000..96acbe8f2 --- /dev/null +++ b/dist/xcb-util/renderutil/cache.c @@ -0,0 +1,234 @@ +/* Copyright © 2006 Jamey Sharp. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the names of the authors or their + * institutions shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the authors. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include "xcb_renderutil.h" +#include <stdlib.h> +#include <pthread.h> + +typedef struct connection_cache { + struct connection_cache *next; /* keep a linked list */ + xcb_connection_t *c; /* which display this is */ + xcb_render_query_version_reply_t *version; + xcb_render_query_pict_formats_reply_t *formats; +} connection_cache; + +static struct { + pthread_mutex_t lock; + connection_cache *head; /* start of the list */ + connection_cache *cur; /* most recently used */ +} connections = { PTHREAD_MUTEX_INITIALIZER }; + +/* + * If the server is missing support for any of the required depths on + * any screen, tell the application that Render is not present. + */ + +#define DEPTH_MASK(d) (1 << ((d) - 1)) + +/* + * Render requires support for depth 1, 4, 8, 24 and 32 pixmaps + */ + +#define REQUIRED_DEPTHS (DEPTH_MASK(1) | \ + DEPTH_MASK(4) | \ + DEPTH_MASK(8) | \ + DEPTH_MASK(24) | \ + DEPTH_MASK(32)) + +/* Test each depth not explicitly advertised to see if pixmap creation + * succeeds: if it does, that depth is usable. */ +static int +pixmap_depths_usable (xcb_connection_t *c, uint32_t missing, xcb_pixmap_t pixmap, xcb_drawable_t root) +{ + xcb_void_cookie_t create_cookie[32] = { { 0 } }; + xcb_void_cookie_t free_cookie[32] = { { 0 } }; + int d; + int success = 1; + for (d = 1; d <= 32; d++) + if (missing & DEPTH_MASK(d)) + { + create_cookie[d - 1] = xcb_create_pixmap_checked (c, d, pixmap, root, 1, 1); + free_cookie[d - 1] = xcb_free_pixmap_checked (c, pixmap); + if (!create_cookie[d - 1].sequence || !free_cookie[d - 1].sequence) + { + success = 0; + break; + } + } + for (d = 0; d < 32; d++) + if (create_cookie[d].sequence || free_cookie[d].sequence) + { + xcb_generic_error_t *create_error = xcb_request_check (c, create_cookie[d]); + xcb_generic_error_t *free_error = xcb_request_check (c, free_cookie[d]); + success = success && !create_error; + free(create_error); + free(free_error); + } + return success; +} + +static int +has_required_depths (xcb_connection_t *c) +{ + xcb_screen_iterator_t screens; + xcb_pixmap_t pixmap = { -1 }; + for (screens = xcb_setup_roots_iterator(xcb_get_setup(c)); screens.rem; xcb_screen_next(&screens)) + { + xcb_depth_iterator_t depths; + uint32_t missing = REQUIRED_DEPTHS; + xcb_drawable_t root; + + for (depths = xcb_screen_allowed_depths_iterator(screens.data); depths.rem; xcb_depth_next(&depths)) + missing &= ~DEPTH_MASK(depths.data->depth); + if (!missing) + continue; + + /* + * Ok, this is ugly. It should be sufficient at this + * point to just return false, but Xinerama is broken at + * this point and only advertises depths which have an + * associated visual. Of course, the other depths still + * work, but the only way to find out is to try them. + */ + if (pixmap == -1) + pixmap = xcb_generate_id(c); + root = screens.data->root; + if (!pixmap_depths_usable (c, missing, pixmap, root)) + return 0; + } + return 1; +} + +static connection_cache * +find_or_create_display (xcb_connection_t *c) +{ + connection_cache *info; + xcb_render_query_version_cookie_t version_cookie; + xcb_render_query_pict_formats_cookie_t formats_cookie; + int present; + + /* + * look for display in list + */ + for (info = connections.head; info; info = info->next) + if (info->c == c) { + connections.cur = info; /* cache most recently used */ + return info; + } + + /* + * don't already have this display: add it. + */ + info = malloc (sizeof (connection_cache)); + if (!info) + return NULL; + info->c = c; + + version_cookie = xcb_render_query_version(c, 0, 10); + formats_cookie = xcb_render_query_pict_formats(c); + xcb_flush(c); + present = has_required_depths (c); + info->version = xcb_render_query_version_reply(c, version_cookie, 0); + info->formats = xcb_render_query_pict_formats_reply(c, formats_cookie, 0); + + if (!present || !info->version || !info->formats) + { + free(info->version); + info->version = 0; + free(info->formats); + info->formats = 0; + } + /* Check for the lack of sub-pixel data */ + else if (info->version->major_version == 0 && info->version->minor_version < 6) + info->formats->num_subpixel = 0; + + /* + * now, chain it onto the list + */ + info->next = connections.head; + connections.head = info; + connections.cur = info; + + return info; +} + +static connection_cache * +find_display (xcb_connection_t *c) +{ + connection_cache *info; + + /* + * see if this was the most recently accessed display + */ + if ((info = connections.cur) && info->c == c) + return info; + + pthread_mutex_lock(&connections.lock); + info = find_or_create_display (c); + pthread_mutex_unlock(&connections.lock); + return info; +} + +const xcb_render_query_version_reply_t * +xcb_render_util_query_version (xcb_connection_t *c) +{ + connection_cache *info = find_display (c); + if (!info) + return 0; + return info->version; +} + +const xcb_render_query_pict_formats_reply_t * +xcb_render_util_query_formats (xcb_connection_t *c) +{ + connection_cache *info = find_display (c); + if (!info) + return 0; + return info->formats; +} + +int +xcb_render_util_disconnect (xcb_connection_t *c) +{ + connection_cache **prev, *cur = NULL; + pthread_mutex_lock(&connections.lock); + for(prev = &connections.head; *prev; prev = &(*prev)->next) + if((*prev)->c == c) + { + cur = *prev; + *prev = cur->next; + if(cur == connections.cur) + connections.cur = NULL; /* flush cache */ + free(cur->version); + free(cur->formats); + free(cur); + break; + } + pthread_mutex_unlock(&connections.lock); + return cur != NULL; +} diff --git a/dist/xcb-util/renderutil/glyph.c b/dist/xcb-util/renderutil/glyph.c new file mode 100644 index 000000000..1721cadac --- /dev/null +++ b/dist/xcb-util/renderutil/glyph.c @@ -0,0 +1,287 @@ +/* Copyright © 2006 Ian Osgood + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the names of the authors or their + * institutions shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the authors. + */ + +#include <stdlib.h> +#include <string.h> + +#include "xcb_renderutil.h" + +typedef struct _glyph_header_t { + uint8_t count; + uint8_t pad0[3]; + int16_t dx, dy; +} _glyph_header_t; + +/* implementation of the opaque stream */ +struct xcb_render_util_composite_text_stream_t { + /* state info */ + uint32_t glyph_size; /* 0 for unset, 1/2/4 for 8/16/32 */ + xcb_render_glyphset_t initial_glyphset; + xcb_render_glyphset_t current_glyphset; + + /* dynamically allocated stream */ + /* contents are 32-bit aligned, network byte order */ + size_t stream_len; + uint32_t *stream; + uint32_t *current; +}; + +#define CURRENT_LEN(s) (((char *)s->current - (char *)s->stream)) + +xcb_render_util_composite_text_stream_t * +xcb_render_util_composite_text_stream ( + xcb_render_glyphset_t initial_glyphset, + uint32_t total_glyphs, + uint32_t total_glyphset_changes ) +{ + xcb_render_util_composite_text_stream_t *stream; + size_t size = 32; + + /* assume worst case: each glyph has its own dx,dy */ + if (total_glyphs || total_glyphset_changes) { + size = total_glyphs * 3 * sizeof(uint32_t) + + total_glyphset_changes * 3 * sizeof(uint32_t); + } + + stream = malloc(sizeof(xcb_render_util_composite_text_stream_t)); + + stream->glyph_size = 0; + stream->initial_glyphset = initial_glyphset; + stream->current_glyphset = initial_glyphset; + + stream->stream_len = size; + stream->stream = malloc(size); + stream->current = stream->stream; + + return stream; +} + +static void +_grow_stream( xcb_render_util_composite_text_stream_t *stream, size_t increase ) +{ + size_t current_len = CURRENT_LEN(stream); + if (current_len + increase > stream->stream_len) { + uint32_t *s = realloc(stream->stream, 2 * stream->stream_len); + if (s != NULL) { + stream->stream_len *= 2; + stream->stream = s; + stream->current = stream->stream + (current_len>>2); + } + } +} + +void +xcb_render_util_glyphs_8 ( + xcb_render_util_composite_text_stream_t *stream, + int16_t dx, + int16_t dy, + uint32_t count, + const uint8_t *glyphs ) +{ + _glyph_header_t header = { count, {0,0,0}, dx, dy }; + + if (count > 252) return; /* FIXME */ + + if (stream->glyph_size != sizeof(*glyphs)) { + if (stream->glyph_size != 0) + return; + stream->glyph_size = sizeof(*glyphs); + } + _grow_stream(stream, sizeof(header) + count+3); + + memcpy(stream->current, &header, sizeof(header)); + stream->current += 2; + + memcpy(stream->current, glyphs, header.count); + stream->current += ((int)header.count+3)>>2; +} + +void +xcb_render_util_glyphs_16 ( + xcb_render_util_composite_text_stream_t *stream, + int16_t dx, + int16_t dy, + uint32_t count, + const uint16_t *glyphs ) +{ + _glyph_header_t header = { count, {0,0,0}, dx, dy }; + + if (count > 254) return; /* FIXME */ + + if (stream->glyph_size != sizeof(*glyphs)) { + if (stream->glyph_size != 0) + return; + stream->glyph_size = sizeof(*glyphs); + } + _grow_stream(stream, sizeof(header) + count*sizeof(*glyphs)+1); + + memcpy(stream->current, &header, sizeof(header)); + stream->current += 2; + + memcpy(stream->current, glyphs, header.count*sizeof(*glyphs)); + stream->current += ((int)header.count*sizeof(*glyphs)+3)>>2; +} + +void +xcb_render_util_glyphs_32 ( + xcb_render_util_composite_text_stream_t *stream, + int16_t dx, + int16_t dy, + uint32_t count, + const uint32_t *glyphs ) +{ + _glyph_header_t header = { count, {0,0,0}, dx, dy }; + + if (count > 254) return; /* FIXME */ + + if (stream->glyph_size != sizeof(*glyphs)) { + if (stream->glyph_size != 0) + return; + stream->glyph_size = sizeof(*glyphs); + } + _grow_stream(stream, sizeof(header) + count*sizeof(*glyphs)+1); + + memcpy(stream->current, &header, sizeof(header)); + stream->current += 2; + + memcpy(stream->current, glyphs, header.count*sizeof(*glyphs)); + stream->current += header.count; +} + +/* note: these glyph arrays must be swapped to network byte order */ + +void +xcb_render_util_change_glyphset ( + xcb_render_util_composite_text_stream_t *stream, + xcb_render_glyphset_t glyphset ) +{ + static _glyph_header_t header = { 255, {0,0,0}, 0, 0 }; + + if (glyphset == stream->current_glyphset) + return; + + _grow_stream(stream, 3*sizeof(uint32_t)); + + memcpy(stream->current, &header, sizeof(header)); + stream->current += 2; + + *stream->current = glyphset; + stream->current++; + + 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 ( + 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; + break; + case 2: + f = xcb_render_composite_glyphs_16; + break; + case 4: + f = xcb_render_composite_glyphs_32; + break; + default: /* uninitialized */ + return xcb_no_operation(xc); + } + return f( + xc, op, src, dst, mask_format, + stream->initial_glyphset, + src_x, src_y, + CURRENT_LEN(stream), + (uint8_t *)stream->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 ) +{ + 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 ( + xcb_render_util_composite_text_stream_t *stream ) +{ + free(stream->stream); + free(stream); +} diff --git a/dist/xcb-util/renderutil/util.c b/dist/xcb-util/renderutil/util.c new file mode 100644 index 000000000..2d8840d20 --- /dev/null +++ b/dist/xcb-util/renderutil/util.c @@ -0,0 +1,251 @@ +/* Copyright © 2000 Keith Packard + * + * 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 Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD 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. + */ + +#include "xcb_renderutil.h" + +xcb_render_pictvisual_t * +xcb_render_util_find_visual_format (const xcb_render_query_pict_formats_reply_t *formats, + const xcb_visualid_t visual) +{ + xcb_render_pictscreen_iterator_t screens; + xcb_render_pictdepth_iterator_t depths; + xcb_render_pictvisual_iterator_t visuals; + if (!formats) + return 0; + for (screens = xcb_render_query_pict_formats_screens_iterator(formats); screens.rem; xcb_render_pictscreen_next(&screens)) + for (depths = xcb_render_pictscreen_depths_iterator(screens.data); depths.rem; xcb_render_pictdepth_next(&depths)) + for (visuals = xcb_render_pictdepth_visuals_iterator(depths.data); visuals.rem; xcb_render_pictvisual_next(&visuals)) + if (visuals.data->visual == visual) + return visuals.data; + return 0; +} + +xcb_render_pictforminfo_t * +xcb_render_util_find_format (const xcb_render_query_pict_formats_reply_t *formats, + unsigned long mask, + const xcb_render_pictforminfo_t *template, + int count) +{ + xcb_render_pictforminfo_iterator_t i; + if (!formats) + return 0; + for (i = xcb_render_query_pict_formats_formats_iterator(formats); i.rem; xcb_render_pictforminfo_next(&i)) + { + if (mask & XCB_PICT_FORMAT_ID) + if (template->id != i.data->id) + continue; + if (mask & XCB_PICT_FORMAT_TYPE) + if (template->type != i.data->type) + continue; + if (mask & XCB_PICT_FORMAT_DEPTH) + if (template->depth != i.data->depth) + continue; + if (mask & XCB_PICT_FORMAT_RED) + if (template->direct.red_shift != i.data->direct.red_shift) + continue; + if (mask & XCB_PICT_FORMAT_RED_MASK) + if (template->direct.red_mask != i.data->direct.red_mask) + continue; + if (mask & XCB_PICT_FORMAT_GREEN) + if (template->direct.green_shift != i.data->direct.green_shift) + continue; + if (mask & XCB_PICT_FORMAT_GREEN_MASK) + if (template->direct.green_mask != i.data->direct.green_mask) + continue; + if (mask & XCB_PICT_FORMAT_BLUE) + if (template->direct.blue_shift != i.data->direct.blue_shift) + continue; + if (mask & XCB_PICT_FORMAT_BLUE_MASK) + if (template->direct.blue_mask != i.data->direct.blue_mask) + continue; + if (mask & XCB_PICT_FORMAT_ALPHA) + if (template->direct.alpha_shift != i.data->direct.alpha_shift) + continue; + if (mask & XCB_PICT_FORMAT_ALPHA_MASK) + if (template->direct.alpha_mask != i.data->direct.alpha_mask) + continue; + if (mask & XCB_PICT_FORMAT_COLORMAP) + if (template->colormap != i.data->colormap) + continue; + if (count-- == 0) + return i.data; + } + return 0; +} + +xcb_render_pictforminfo_t * +xcb_render_util_find_standard_format (const xcb_render_query_pict_formats_reply_t *formats, + xcb_pict_standard_t format) +{ + static const struct { + xcb_render_pictforminfo_t templ; + unsigned long mask; + } standardFormats[] = { + /* XCB_PICT_STANDARD_ARGB_32 */ + { + { + 0, /* id */ + XCB_RENDER_PICT_TYPE_DIRECT, /* type */ + 32, /* depth */ + { 0 }, /* pad */ + { /* direct */ + 16, /* direct.red */ + 0xff, /* direct.red_mask */ + 8, /* direct.green */ + 0xff, /* direct.green_mask */ + 0, /* direct.blue */ + 0xff, /* direct.blue_mask */ + 24, /* direct.alpha */ + 0xff, /* direct.alpha_mask */ + }, + 0, /* colormap */ + }, + XCB_PICT_FORMAT_TYPE | + XCB_PICT_FORMAT_DEPTH | + XCB_PICT_FORMAT_RED | + XCB_PICT_FORMAT_RED_MASK | + XCB_PICT_FORMAT_GREEN | + XCB_PICT_FORMAT_GREEN_MASK | + XCB_PICT_FORMAT_BLUE | + XCB_PICT_FORMAT_BLUE_MASK | + XCB_PICT_FORMAT_ALPHA | + XCB_PICT_FORMAT_ALPHA_MASK, + }, + /* XCB_PICT_STANDARD_RGB_24 */ + { + { + 0, /* id */ + XCB_RENDER_PICT_TYPE_DIRECT, /* type */ + 24, /* depth */ + { 0 }, /* pad */ + { /* direct */ + 16, /* direct.red */ + 0xff, /* direct.red_MASK */ + 8, /* direct.green */ + 0xff, /* direct.green_MASK */ + 0, /* direct.blue */ + 0xff, /* direct.blue_MASK */ + 0, /* direct.alpha */ + 0x00, /* direct.alpha_MASK */ + }, + 0, /* colormap */ + }, + XCB_PICT_FORMAT_TYPE | + XCB_PICT_FORMAT_DEPTH | + XCB_PICT_FORMAT_RED | + XCB_PICT_FORMAT_RED_MASK | + XCB_PICT_FORMAT_GREEN | + XCB_PICT_FORMAT_GREEN_MASK | + XCB_PICT_FORMAT_BLUE | + XCB_PICT_FORMAT_BLUE_MASK | + XCB_PICT_FORMAT_ALPHA_MASK, + }, + /* XCB_PICT_STANDARD_A_8 */ + { + { + 0, /* id */ + XCB_RENDER_PICT_TYPE_DIRECT, /* type */ + 8, /* depth */ + { 0 }, /* pad */ + { /* direct */ + 0, /* direct.red */ + 0x00, /* direct.red_MASK */ + 0, /* direct.green */ + 0x00, /* direct.green_MASK */ + 0, /* direct.blue */ + 0x00, /* direct.blue_MASK */ + 0, /* direct.alpha */ + 0xff, /* direct.alpha_MASK */ + }, + 0, /* colormap */ + }, + XCB_PICT_FORMAT_TYPE | + XCB_PICT_FORMAT_DEPTH | + XCB_PICT_FORMAT_RED_MASK | + XCB_PICT_FORMAT_GREEN_MASK | + XCB_PICT_FORMAT_BLUE_MASK | + XCB_PICT_FORMAT_ALPHA | + XCB_PICT_FORMAT_ALPHA_MASK, + }, + /* XCB_PICT_STANDARD_A_4 */ + { + { + 0, /* id */ + XCB_RENDER_PICT_TYPE_DIRECT, /* type */ + 4, /* depth */ + { 0 }, /* pad */ + { /* direct */ + 0, /* direct.red */ + 0x00, /* direct.red_MASK */ + 0, /* direct.green */ + 0x00, /* direct.green_MASK */ + 0, /* direct.blue */ + 0x00, /* direct.blue_MASK */ + 0, /* direct.alpha */ + 0x0f, /* direct.alpha_MASK */ + }, + 0, /* colormap */ + }, + XCB_PICT_FORMAT_TYPE | + XCB_PICT_FORMAT_DEPTH | + XCB_PICT_FORMAT_RED_MASK | + XCB_PICT_FORMAT_GREEN_MASK | + XCB_PICT_FORMAT_BLUE_MASK | + XCB_PICT_FORMAT_ALPHA | + XCB_PICT_FORMAT_ALPHA_MASK, + }, + /* XCB_PICT_STANDARD_A_1 */ + { + { + 0, /* id */ + XCB_RENDER_PICT_TYPE_DIRECT, /* type */ + 1, /* depth */ + { 0 }, /* pad */ + { /* direct */ + 0, /* direct.red */ + 0x00, /* direct.red_MASK */ + 0, /* direct.green */ + 0x00, /* direct.green_MASK */ + 0, /* direct.blue */ + 0x00, /* direct.blue_MASK */ + 0, /* direct.alpha */ + 0x01, /* direct.alpha_MASK */ + }, + 0, /* colormap */ + }, + XCB_PICT_FORMAT_TYPE | + XCB_PICT_FORMAT_DEPTH | + XCB_PICT_FORMAT_RED_MASK | + XCB_PICT_FORMAT_GREEN_MASK | + XCB_PICT_FORMAT_BLUE_MASK | + XCB_PICT_FORMAT_ALPHA | + XCB_PICT_FORMAT_ALPHA_MASK, + }, + }; + + if (format < 0 || format >= sizeof(standardFormats) / sizeof(*standardFormats)) + return 0; + + return xcb_render_util_find_format (formats, + standardFormats[format].mask, + &standardFormats[format].templ, + 0); +} diff --git a/dist/xcb-util/renderutil/xcb-renderutil.pc.in b/dist/xcb-util/renderutil/xcb-renderutil.pc.in new file mode 100644 index 000000000..cbad81590 --- /dev/null +++ b/dist/xcb-util/renderutil/xcb-renderutil.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: XCB RenderUtil library +Description: XCB RENDER-extension utilities library +Version: @PACKAGE_VERSION@ +Requires: xcb xcb-render +Libs: -L${libdir} -lxcb-render-util @LIBS@ +Cflags: -I${includedir} diff --git a/dist/xcb-util/renderutil/xcb_renderutil.h b/dist/xcb-util/renderutil/xcb_renderutil.h new file mode 100644 index 000000000..6eb592323 --- /dev/null +++ b/dist/xcb-util/renderutil/xcb_renderutil.h @@ -0,0 +1,142 @@ +/* Copyright © 2006 Jamey Sharp. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the names of the authors or their + * institutions shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the authors. + */ + +#ifndef XCB_RENDERUTIL +#define XCB_RENDERUTIL +#include <xcb/render.h> + +typedef enum xcb_pict_format_t { + XCB_PICT_FORMAT_ID = (1 << 0), + XCB_PICT_FORMAT_TYPE = (1 << 1), + XCB_PICT_FORMAT_DEPTH = (1 << 2), + XCB_PICT_FORMAT_RED = (1 << 3), + XCB_PICT_FORMAT_RED_MASK = (1 << 4), + XCB_PICT_FORMAT_GREEN = (1 << 5), + XCB_PICT_FORMAT_GREEN_MASK = (1 << 6), + XCB_PICT_FORMAT_BLUE = (1 << 7), + XCB_PICT_FORMAT_BLUE_MASK = (1 << 8), + XCB_PICT_FORMAT_ALPHA = (1 << 9), + XCB_PICT_FORMAT_ALPHA_MASK = (1 << 10), + XCB_PICT_FORMAT_COLORMAP = (1 << 11) +} xcb_pict_format_t; + +typedef enum xcb_pict_standard_t { + XCB_PICT_STANDARD_ARGB_32, + XCB_PICT_STANDARD_RGB_24, + XCB_PICT_STANDARD_A_8, + XCB_PICT_STANDARD_A_4, + XCB_PICT_STANDARD_A_1 +} xcb_pict_standard_t; + + +xcb_render_pictvisual_t * +xcb_render_util_find_visual_format (const xcb_render_query_pict_formats_reply_t *formats, + const xcb_visualid_t visual); + +xcb_render_pictforminfo_t * +xcb_render_util_find_format (const xcb_render_query_pict_formats_reply_t *formats, + unsigned long mask, + const xcb_render_pictforminfo_t *template, + int count); + +xcb_render_pictforminfo_t * +xcb_render_util_find_standard_format (const xcb_render_query_pict_formats_reply_t *formats, + xcb_pict_standard_t format); + +const xcb_render_query_version_reply_t * +xcb_render_util_query_version (xcb_connection_t *c); + +const xcb_render_query_pict_formats_reply_t * +xcb_render_util_query_formats (xcb_connection_t *c); + +int +xcb_render_util_disconnect (xcb_connection_t *c); + +/* wrappers for xcb_render_composite_glyphs_8/16/32 */ + +typedef struct xcb_render_util_composite_text_stream_t xcb_render_util_composite_text_stream_t; + +xcb_render_util_composite_text_stream_t * +xcb_render_util_composite_text_stream ( + xcb_render_glyphset_t initial_glyphset, + uint32_t total_glyphs, + uint32_t total_glyphset_changes ); + +void +xcb_render_util_glyphs_8 ( + xcb_render_util_composite_text_stream_t *stream, + int16_t dx, + int16_t dy, + uint32_t count, + const uint8_t *glyphs ); + +void +xcb_render_util_glyphs_16 ( + xcb_render_util_composite_text_stream_t *stream, + int16_t dx, + int16_t dy, + uint32_t count, + const uint16_t *glyphs ); + +void +xcb_render_util_glyphs_32 ( + xcb_render_util_composite_text_stream_t *stream, + int16_t dx, + int16_t dy, + uint32_t count, + const uint32_t *glyphs ); + +void +xcb_render_util_change_glyphset ( + xcb_render_util_composite_text_stream_t *stream, + xcb_render_glyphset_t glyphset ); + +xcb_void_cookie_t +xcb_render_util_composite_text ( + 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_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 ); + +#endif /* XCB_RENDERUTIL */ |