sync code with last improvements from OpenBSD

This commit is contained in:
purplerain 2023-08-28 05:57:34 +00:00
commit 88965415ff
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
26235 changed files with 29195616 additions and 0 deletions

View file

@ -0,0 +1,12 @@
lib_LTLIBRARIES = libxcb-render-util.la
xcbinclude_HEADERS = xcb_renderutil.h
AM_CFLAGS = $(BASE_CFLAGS)
AM_CPPFLAGS = $(XCB_CFLAGS) $(XCB_RENDER_CFLAGS)
libxcb_render_util_la_SOURCES = cache.c util.c glyph.c
libxcb_render_util_la_LIBADD = $(XCB_LIBS) $(XCB_RENDER_LIBS)
libxcb_render_util_la_LDFLAGS = -no-undefined
pkgconfig_DATA = xcb-renderutil.pc

View file

@ -0,0 +1,693 @@
# Makefile.in generated by automake 1.12.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 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@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@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 $(top_srcdir)/depcomp \
$(xcbinclude_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/xcb_util_common.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = xcb-renderutil.pc
CONFIG_CLEAN_VPATH_FILES =
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 = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \
"$(DESTDIR)$(xcbincludedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
libxcb_render_util_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
am_libxcb_render_util_la_OBJECTS = cache.lo util.lo glyph.lo
libxcb_render_util_la_OBJECTS = $(am_libxcb_render_util_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
libxcb_render_util_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libxcb_render_util_la_LDFLAGS) \
$(LDFLAGS) -o $@
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libxcb_render_util_la_SOURCES)
DIST_SOURCES = $(libxcb_render_util_la_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
DATA = $(pkgconfig_DATA)
HEADERS = $(xcbinclude_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
APP_MAN_DIR = @APP_MAN_DIR@
APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHANGELOG_CMD = @CHANGELOG_CMD@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CWARNFLAGS = @CWARNFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
GREP = @GREP@
HAVE_DOT = @HAVE_DOT@
INSTALL = @INSTALL@
INSTALL_CMD = @INSTALL_CMD@
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@
LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
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_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@
VERSION = @VERSION@
XCB_CFLAGS = @XCB_CFLAGS@
XCB_LIBS = @XCB_LIBS@
XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
XORG_MAN_PAGE = @XORG_MAN_PAGE@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
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@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkgconfigdir = @pkgconfigdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
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@
lib_LTLIBRARIES = libxcb-render-util.la
xcbinclude_HEADERS = xcb_renderutil.h
AM_CFLAGS = $(BASE_CFLAGS)
AM_CPPFLAGS = $(XCB_CFLAGS) $(XCB_RENDER_CFLAGS)
libxcb_render_util_la_SOURCES = cache.c util.c glyph.c
libxcb_render_util_la_LIBADD = $(XCB_LIBS) $(XCB_RENDER_LIBS)
libxcb_render_util_la_LDFLAGS = -no-undefined
pkgconfig_DATA = xcb-renderutil.pc
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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'; \
$(am__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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
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)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
libxcb-render-util.la: $(libxcb_render_util_la_OBJECTS) $(libxcb_render_util_la_DEPENDENCIES) $(EXTRA_libxcb_render_util_la_DEPENDENCIES)
$(AM_V_CCLD)$(libxcb_render_util_la_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)/cache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glyph.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-pkgconfigDATA: $(pkgconfig_DATA)
@$(NORMAL_INSTALL)
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
done
uninstall-pkgconfigDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
install-xcbincludeHEADERS: $(xcbinclude_HEADERS)
@$(NORMAL_INSTALL)
@list='$(xcbinclude_HEADERS)'; test -n "$(xcbincludedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(xcbincludedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(xcbincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(xcbincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(xcbincludedir)" || exit $$?; \
done
uninstall-xcbincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(xcbinclude_HEADERS)'; test -n "$(xcbincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(xcbincludedir)'; $(am__uninstall_files_from_dir)
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)
set x; \
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; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
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)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
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 "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$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:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
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
html-am:
info: info-am
info-am:
install-data-am: install-pkgconfigDATA install-xcbincludeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-libLTLIBRARIES
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
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 cscopelist 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:

View file

@ -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) (1U << ((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;
}

View file

@ -0,0 +1,293 @@
/* 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#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));
if (!stream)
return NULL;
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);
}

View file

@ -0,0 +1,255 @@
/* 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#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 *ptemplate,
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 (ptemplate->id != i.data->id)
continue;
if (mask & XCB_PICT_FORMAT_TYPE)
if (ptemplate->type != i.data->type)
continue;
if (mask & XCB_PICT_FORMAT_DEPTH)
if (ptemplate->depth != i.data->depth)
continue;
if (mask & XCB_PICT_FORMAT_RED)
if (ptemplate->direct.red_shift != i.data->direct.red_shift)
continue;
if (mask & XCB_PICT_FORMAT_RED_MASK)
if (ptemplate->direct.red_mask != i.data->direct.red_mask)
continue;
if (mask & XCB_PICT_FORMAT_GREEN)
if (ptemplate->direct.green_shift != i.data->direct.green_shift)
continue;
if (mask & XCB_PICT_FORMAT_GREEN_MASK)
if (ptemplate->direct.green_mask != i.data->direct.green_mask)
continue;
if (mask & XCB_PICT_FORMAT_BLUE)
if (ptemplate->direct.blue_shift != i.data->direct.blue_shift)
continue;
if (mask & XCB_PICT_FORMAT_BLUE_MASK)
if (ptemplate->direct.blue_mask != i.data->direct.blue_mask)
continue;
if (mask & XCB_PICT_FORMAT_ALPHA)
if (ptemplate->direct.alpha_shift != i.data->direct.alpha_shift)
continue;
if (mask & XCB_PICT_FORMAT_ALPHA_MASK)
if (ptemplate->direct.alpha_mask != i.data->direct.alpha_mask)
continue;
if (mask & XCB_PICT_FORMAT_COLORMAP)
if (ptemplate->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);
}

View file

@ -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}

View file

@ -0,0 +1,150 @@
/* 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>
#ifdef __cplusplus
extern "C" {
#endif
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 *ptemplate,
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 );
#ifdef __cplusplus
}
#endif
#endif /* XCB_RENDERUTIL */