diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-07-27 19:02:39 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-07-27 19:02:39 +0000 |
commit | 269d40cbcc43b41f621ca6d91c182952f60ec48e (patch) | |
tree | 872f2fddd3f2207e57a28595e73886713ce4a77a /xserver/render | |
parent | 917a2249b787451cad3f9697872aeccfd0da3324 (diff) |
Update to xserver 1.8. Tested by many. Ok oga@, todd@.
Diffstat (limited to 'xserver/render')
-rw-r--r-- | xserver/render/Makefile.in | 95 | ||||
-rw-r--r-- | xserver/render/animcur.c | 13 | ||||
-rw-r--r-- | xserver/render/filter.c | 4 | ||||
-rw-r--r-- | xserver/render/glyph.c | 143 | ||||
-rw-r--r-- | xserver/render/glyphstr.h | 32 | ||||
-rw-r--r-- | xserver/render/matrix.c | 8 | ||||
-rw-r--r-- | xserver/render/mipict.c | 56 | ||||
-rw-r--r-- | xserver/render/mipict.h | 72 | ||||
-rw-r--r-- | xserver/render/mirect.c | 2 | ||||
-rw-r--r-- | xserver/render/picture.c | 71 | ||||
-rw-r--r-- | xserver/render/picture.h | 18 | ||||
-rw-r--r-- | xserver/render/picturestr.h | 123 | ||||
-rw-r--r-- | xserver/render/render.c | 380 | ||||
-rw-r--r-- | xserver/render/renderedge.c | 10 | ||||
-rw-r--r-- | xserver/render/renderedge.h | 27 |
15 files changed, 598 insertions, 456 deletions
diff --git a/xserver/render/Makefile.in b/xserver/render/Makefile.in index 7b7f1a9c4..f4209a92d 100644 --- a/xserver/render/Makefile.in +++ b/xserver/render/Makefile.in @@ -41,8 +41,8 @@ subdir = render DIST_COMMON = $(am__sdk_HEADERS_DIST) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ + $(top_srcdir)/m4/dolt.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(install_sh) -d @@ -52,7 +52,8 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ - $(top_builddir)/include/kdrive-config.h + $(top_builddir)/include/kdrive-config.h \ + $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) librender_la_LIBADD = @@ -60,7 +61,7 @@ am_librender_la_OBJECTS = animcur.lo filter.lo glyph.lo matrix.lo \ miindex.lo mipict.lo mirect.lo mitrap.lo mitri.lo picture.lo \ render.lo renderedge.lo librender_la_OBJECTS = $(am_librender_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -97,12 +98,13 @@ ALPHA_VIDEO_TRUE = @ALPHA_VIDEO_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ -APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ +ARM_BACKTRACE_CFLAGS = @ARM_BACKTRACE_CFLAGS@ ARM_VIDEO_FALSE = @ARM_VIDEO_FALSE@ ARM_VIDEO_TRUE = @ARM_VIDEO_TRUE@ AS = @AS@ @@ -130,6 +132,7 @@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ COMPOSITE_FALSE = @COMPOSITE_FALSE@ COMPOSITE_TRUE = @COMPOSITE_TRUE@ @@ -139,8 +142,11 @@ CONFIG_HAL_FALSE = @CONFIG_HAL_FALSE@ CONFIG_HAL_TRUE = @CONFIG_HAL_TRUE@ CONFIG_NEED_DBUS_FALSE = @CONFIG_NEED_DBUS_FALSE@ CONFIG_NEED_DBUS_TRUE = @CONFIG_NEED_DBUS_TRUE@ +CONFIG_UDEV_FALSE = @CONFIG_UDEV_FALSE@ +CONFIG_UDEV_TRUE = @CONFIG_UDEV_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CWARNFLAGS = @CWARNFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ @@ -154,6 +160,7 @@ DBUS_LIBS = @DBUS_LIBS@ DEBUG_FALSE = @DEBUG_FALSE@ DEBUG_TRUE = @DEBUG_TRUE@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFS = @DEFS@ @@ -163,7 +170,9 @@ DGA_FALSE = @DGA_FALSE@ DGA_LIBS = @DGA_LIBS@ DGA_TRUE = @DGA_TRUE@ DIX_CFLAGS = @DIX_CFLAGS@ +DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ +DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ @@ -179,6 +188,7 @@ DMX_BUILD_USB_TRUE = @DMX_BUILD_USB_TRUE@ DMX_FALSE = @DMX_FALSE@ DMX_TRUE = @DMX_TRUE@ DOLT_BASH = @DOLT_BASH@ +DOXYGEN = @DOXYGEN@ DPMSExtension_FALSE = @DPMSExtension_FALSE@ DPMSExtension_TRUE = @DPMSExtension_TRUE@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ @@ -191,8 +201,10 @@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DRI_FALSE = @DRI_FALSE@ +DRI_LIBS = @DRI_LIBS@ DRI_TRUE = @DRI_TRUE@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ @@ -208,8 +220,17 @@ FBDEVHW_TRUE = @FBDEVHW_TRUE@ FFLAGS = @FFLAGS@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +FONT100DPIDIR = @FONT100DPIDIR@ +FONT75DPIDIR = @FONT75DPIDIR@ +FONTMISCDIR = @FONTMISCDIR@ +FONTOTFDIR = @FONTOTFDIR@ +FONTROOTDIR = @FONTROOTDIR@ +FONTTTFDIR = @FONTTTFDIR@ +FONTTYPE1DIR = @FONTTYPE1DIR@ FREEBSD_KLDLOAD_FALSE = @FREEBSD_KLDLOAD_FALSE@ FREEBSD_KLDLOAD_TRUE = @FREEBSD_KLDLOAD_TRUE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_FALSE = @GLX_FALSE@ @@ -219,18 +240,17 @@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ -HAVE_AGL_FRAMEWORK_FALSE = @HAVE_AGL_FRAMEWORK_FALSE@ -HAVE_AGL_FRAMEWORK_TRUE = @HAVE_AGL_FRAMEWORK_TRUE@ HAVE_DBUS_FALSE = @HAVE_DBUS_FALSE@ HAVE_DBUS_TRUE = @HAVE_DBUS_TRUE@ -HAVE_XPLUGIN_FALSE = @HAVE_XPLUGIN_FALSE@ -HAVE_XPLUGIN_TRUE = @HAVE_XPLUGIN_TRUE@ +HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ +HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ HP300_VIDEO_FALSE = @HP300_VIDEO_FALSE@ HP300_VIDEO_TRUE = @HP300_VIDEO_TRUE@ HPPA_VIDEO_FALSE = @HPPA_VIDEO_FALSE@ HPPA_VIDEO_TRUE = @HPPA_VIDEO_TRUE@ I386_VIDEO_FALSE = @I386_VIDEO_FALSE@ I386_VIDEO_TRUE = @I386_VIDEO_TRUE@ +INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_LIBXF86CONFIG_FALSE = @INSTALL_LIBXF86CONFIG_FALSE@ INSTALL_LIBXF86CONFIG_TRUE = @INSTALL_LIBXF86CONFIG_TRUE@ @@ -239,6 +259,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_SETUID_FALSE = @INSTALL_SETUID_FALSE@ INSTALL_SETUID_TRUE = @INSTALL_SETUID_TRUE@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INT10MODULE_FALSE = @INT10MODULE_FALSE@ +INT10MODULE_TRUE = @INT10MODULE_TRUE@ INT10_STUB_FALSE = @INT10_STUB_FALSE@ INT10_STUB_TRUE = @INT10_STUB_TRUE@ INT10_VM86_FALSE = @INT10_VM86_FALSE@ @@ -251,20 +273,23 @@ KDRIVELINUX_FALSE = @KDRIVELINUX_FALSE@ KDRIVELINUX_TRUE = @KDRIVELINUX_TRUE@ KDRIVEOPENBSD_FALSE = @KDRIVEOPENBSD_FALSE@ KDRIVEOPENBSD_TRUE = @KDRIVEOPENBSD_TRUE@ -KDRIVEVESA_FALSE = @KDRIVEVESA_FALSE@ -KDRIVEVESA_TRUE = @KDRIVEVESA_TRUE@ KDRIVEWSCONS_FALSE = @KDRIVEWSCONS_FALSE@ KDRIVEWSCONS_TRUE = @KDRIVEWSCONS_TRUE@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ +KDRIVE_EVDEV_FALSE = @KDRIVE_EVDEV_FALSE@ +KDRIVE_EVDEV_TRUE = @KDRIVE_EVDEV_TRUE@ KDRIVE_FALSE = @KDRIVE_FALSE@ -KDRIVE_HW_FALSE = @KDRIVE_HW_FALSE@ -KDRIVE_HW_TRUE = @KDRIVE_HW_TRUE@ KDRIVE_INCS = @KDRIVE_INCS@ +KDRIVE_KBD_FALSE = @KDRIVE_KBD_FALSE@ +KDRIVE_KBD_TRUE = @KDRIVE_KBD_TRUE@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ +KDRIVE_MOUSE_FALSE = @KDRIVE_MOUSE_FALSE@ +KDRIVE_MOUSE_TRUE = @KDRIVE_MOUSE_TRUE@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KDRIVE_TRUE = @KDRIVE_TRUE@ +LAUNCHD_ID_PREFIX = @LAUNCHD_ID_PREFIX@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LEX = @LEX@ @@ -293,12 +318,12 @@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MAKE_HTML = @MAKE_HTML@ MAKE_PDF = @MAKE_PDF@ MAKE_PS = @MAKE_PS@ MAKE_TEXT = @MAKE_TEXT@ -MESA_SOURCE = @MESA_SOURCE@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MITSHM_FALSE = @MITSHM_FALSE@ @@ -317,6 +342,9 @@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OS_LIB = @OS_LIB@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -345,34 +373,51 @@ SCREENSAVER_TRUE = @SCREENSAVER_TRUE@ SECURE_RPC_FALSE = @SECURE_RPC_FALSE@ SECURE_RPC_TRUE = @SECURE_RPC_TRUE@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SGI_VIDEO_FALSE = @SGI_VIDEO_FALSE@ SGI_VIDEO_TRUE = @SGI_VIDEO_TRUE@ +SHA1_CFLAGS = @SHA1_CFLAGS@ +SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ SOLARIS_ASM_INLINE_FALSE = @SOLARIS_ASM_INLINE_FALSE@ SOLARIS_ASM_INLINE_TRUE = @SOLARIS_ASM_INLINE_TRUE@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ -SOLARIS_USL_CONSOLE_FALSE = @SOLARIS_USL_CONSOLE_FALSE@ -SOLARIS_USL_CONSOLE_TRUE = @SOLARIS_USL_CONSOLE_TRUE@ +SOLARIS_VT_FALSE = @SOLARIS_VT_FALSE@ +SOLARIS_VT_TRUE = @SOLARIS_VT_TRUE@ SPARC64_VIDEO_FALSE = @SPARC64_VIDEO_FALSE@ SPARC64_VIDEO_TRUE = @SPARC64_VIDEO_TRUE@ +SPECIAL_DTRACE_OBJECTS_FALSE = @SPECIAL_DTRACE_OBJECTS_FALSE@ +SPECIAL_DTRACE_OBJECTS_TRUE = @SPECIAL_DTRACE_OBJECTS_TRUE@ STANDALONE_XPBPROXY_FALSE = @STANDALONE_XPBPROXY_FALSE@ STANDALONE_XPBPROXY_TRUE = @STANDALONE_XPBPROXY_TRUE@ STRIP = @STRIP@ +SYSCONFDIR = @SYSCONFDIR@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_FALSE = @TSLIB_FALSE@ TSLIB_LIBS = @TSLIB_LIBS@ TSLIB_TRUE = @TSLIB_TRUE@ +UDEV_CFLAGS = @UDEV_CFLAGS@ +UDEV_LIBS = @UDEV_LIBS@ +UNITTESTS_FALSE = @UNITTESTS_FALSE@ +UNITTESTS_TRUE = @UNITTESTS_TRUE@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ -VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ -VENDOR_NAME = @VENDOR_NAME@ +VBE_FALSE = @VBE_FALSE@ +VBE_TRUE = @VBE_TRUE@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ -VENDOR_RELEASE = @VENDOR_RELEASE@ VERSION = @VERSION@ +VGAHW_FALSE = @VGAHW_FALSE@ +VGAHW_TRUE = @VGAHW_TRUE@ +WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ +WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ +WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XAA_FALSE = @XAA_FALSE@ +XAA_TRUE = @XAA_TRUE@ XACE_FALSE = @XACE_FALSE@ XACE_TRUE = @XACE_TRUE@ XCALIBRATE_FALSE = @XCALIBRATE_FALSE@ @@ -397,6 +442,7 @@ XEPHYR_LIBS = @XEPHYR_LIBS@ XEPHYR_TRUE = @XEPHYR_TRUE@ XF86BIGFONT_FALSE = @XF86BIGFONT_FALSE@ XF86BIGFONT_TRUE = @XF86BIGFONT_TRUE@ +XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XF86UTILS_FALSE = @XF86UTILS_FALSE@ XF86UTILS_TRUE = @XF86UTILS_TRUE@ @@ -439,15 +485,14 @@ XORG_TRUE = @XORG_TRUE@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_FALSE = @XQUARTZ_FALSE@ +XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ +XQUARTZ_SPARKLE_FALSE = @XQUARTZ_SPARKLE_FALSE@ +XQUARTZ_SPARKLE_TRUE = @XQUARTZ_SPARKLE_TRUE@ XQUARTZ_TRUE = @XQUARTZ_TRUE@ XREGISTRY_FALSE = @XREGISTRY_FALSE@ XREGISTRY_TRUE = @XREGISTRY_TRUE@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ -XSDLSERVER_FALSE = @XSDLSERVER_FALSE@ -XSDLSERVER_TRUE = @XSDLSERVER_TRUE@ -XSDL_INCS = @XSDL_INCS@ -XSDL_LIBS = @XSDL_LIBS@ XSELINUX_FALSE = @XSELINUX_FALSE@ XSELINUX_TRUE = @XSELINUX_TRUE@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ @@ -495,10 +540,10 @@ X_PRIVSEP_FALSE = @X_PRIVSEP_FALSE@ X_PRIVSEP_TRUE = @X_PRIVSEP_TRUE@ YACC = @YACC@ YFLAGS = @YFLAGS@ +__XCONFIGDIR__ = @__XCONFIGDIR__@ __XCONFIGFILE__ = @__XCONFIGFILE__@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ -abi_font = @abi_font@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ ac_ct_CC = @ac_ct_CC@ @@ -553,7 +598,9 @@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ +symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ +sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ noinst_LTLIBRARIES = librender.la AM_CFLAGS = $(DIX_CFLAGS) diff --git a/xserver/render/animcur.c b/xserver/render/animcur.c index d80094d98..276e5e4af 100644 --- a/xserver/render/animcur.c +++ b/xserver/render/animcur.c @@ -104,17 +104,6 @@ static DevPrivateKey AnimCurScreenPrivateKey = &AnimCurScreenPrivateKeyIndex; #define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func) #define Unwrap(as,s,elt) ((s)->elt = (as)->elt) -static Bool -AnimCurDisplayCursor (DeviceIntPtr pDev, - ScreenPtr pScreen, - CursorPtr pCursor); - -static Bool -AnimCurSetCursorPosition (DeviceIntPtr pDev, - ScreenPtr pScreen, - int x, - int y, - Bool generateEvent); static Bool AnimCurCloseScreen (int index, ScreenPtr pScreen) @@ -157,7 +146,7 @@ AnimCurCursorLimits (DeviceIntPtr pDev, } else { - (*pScreen->CursorLimits) (inputInfo.pointer, pScreen, pCursor, + (*pScreen->CursorLimits) (pDev, pScreen, pCursor, pHotBox, pTopLeftBox); } Wrap (as, pScreen, CursorLimits, AnimCurCursorLimits); diff --git a/xserver/render/filter.c b/xserver/render/filter.c index 21eedca31..89cc0646a 100644 --- a/xserver/render/filter.c +++ b/xserver/render/filter.c @@ -123,7 +123,7 @@ PictureFreeFilterIds (void) filterNames = 0; } -_X_EXPORT int +int PictureAddFilter (ScreenPtr pScreen, char *filter, PictFilterValidateParamsProcPtr ValidateParams, @@ -159,7 +159,7 @@ PictureAddFilter (ScreenPtr pScreen, return id; } -_X_EXPORT Bool +Bool PictureSetFilterAlias (ScreenPtr pScreen, char *filter, char *alias) { PictureScreenPtr ps = GetPictureScreen(pScreen); diff --git a/xserver/render/glyph.c b/xserver/render/glyph.c index 1fd36ef02..f0f3b1913 100644 --- a/xserver/render/glyph.c +++ b/xserver/render/glyph.c @@ -26,14 +26,7 @@ #include <dix-config.h> #endif -#if defined(HAVE_SHA1INIT) || /* Use libc SHA1 */ \ - defined(HAVE_SHA1_IN_LIBMD) /* Use libmd for SHA1 */ -# include <sys/types.h> -# include <sha1.h> -#else /* Use OpenSSL's libcrypto */ -# include <stddef.h> /* buggy openssl/sha.h wants size_t */ -# include <openssl/sha.h> -#endif +#include "xsha1.h" #include "misc.h" #include "scrnintstr.h" @@ -200,35 +193,21 @@ HashGlyph (xGlyphInfo *gi, unsigned long size, unsigned char sha1[20]) { -#if defined(HAVE_SHA1INIT) || /* SHA1 in libC */ \ - defined(HAVE_SHA1_IN_LIBMD) /* Use libmd for SHA1 */ - SHA1_CTX ctx; - - SHA1Init (&ctx); - SHA1Update (&ctx, gi, sizeof (xGlyphInfo)); - SHA1Update (&ctx, bits, size); - SHA1Final (sha1, &ctx); -#else /* Use OpenSSL's libcrypto */ - SHA_CTX ctx; + void *ctx = x_sha1_init(); int success; - success = SHA1_Init (&ctx); - if (! success) + if (!ctx) return BadAlloc; - success = SHA1_Update (&ctx, gi, sizeof (xGlyphInfo)); - if (! success) + success = x_sha1_update(ctx, gi, sizeof(xGlyphInfo)); + if (!success) return BadAlloc; - - success = SHA1_Update (&ctx, bits, size); - if (! success) + success = x_sha1_update(ctx, bits, size); + if (!success) return BadAlloc; - - success = SHA1_Final (sha1, &ctx); - if (! success) + success = x_sha1_final(ctx, sha1); + if (!success) return BadAlloc; -#endif - return Success; } @@ -238,6 +217,9 @@ FindGlyphByHash (unsigned char sha1[20], int format) GlyphRefPtr gr; CARD32 signature = *(CARD32 *) sha1; + if (!globalGlyphs[format].hashSet) + return NULL; + gr = FindGlyphRef (&globalGlyphs[format], signature, TRUE, sha1); @@ -275,13 +257,32 @@ CheckDuplicates (GlyphHashPtr hash, char *where) #define DuplicateRef(a,b) #endif +static void +FreeGlyphPicture(GlyphPtr glyph) +{ + PictureScreenPtr ps; + int i; + + for (i = 0; i < screenInfo.numScreens; i++) + { + ScreenPtr pScreen = screenInfo.screens[i]; + + if (GlyphPicture(glyph)[i]) + FreePicture ((pointer) GlyphPicture (glyph)[i], 0); + + ps = GetPictureScreenIfSet (pScreen); + if (ps) + (*ps->UnrealizeGlyph) (pScreen, glyph); + } +} + + void FreeGlyph (GlyphPtr glyph, int format) { CheckDuplicates (&globalGlyphs[format], "FreeGlyph"); if (--glyph->refcnt == 0) { - PictureScreenPtr ps; GlyphRefPtr gr; int i; int first; @@ -308,17 +309,7 @@ FreeGlyph (GlyphPtr glyph, int format) globalGlyphs[format].tableEntries--; } - for (i = 0; i < screenInfo.numScreens; i++) - { - ScreenPtr pScreen = screenInfo.screens[i]; - - FreePicture ((pointer) GlyphPicture (glyph)[i], 0); - - ps = GetPictureScreenIfSet (pScreen); - if (ps) - (*ps->UnrealizeGlyph) (pScreen, glyph); - } - + FreeGlyphPicture(glyph); FreeGlyphPrivates(glyph); xfree (glyph); } @@ -337,15 +328,7 @@ AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id) TRUE, glyph->sha1); if (gr->glyph && gr->glyph != DeletedGlyph && gr->glyph != glyph) { - PictureScreenPtr ps; - int i; - - for (i = 0; i < screenInfo.numScreens; i++) - { - ps = GetPictureScreenIfSet (screenInfo.screens[i]); - if (ps) - (*ps->UnrealizeGlyph) (screenInfo.screens[i], glyph); - } + FreeGlyphPicture(glyph); FreeGlyphPrivates(glyph); xfree (glyph); glyph = gr->glyph; @@ -417,6 +400,7 @@ AllocateGlyph (xGlyphInfo *gi, int fdepth) for (i = 0; i < screenInfo.numScreens; i++) { + GlyphPicture(glyph)[i] = NULL; ps = GetPictureScreenIfSet (screenInfo.screens[i]); if (ps) @@ -617,7 +601,7 @@ GlyphExtents (int nlist, #define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0) -_X_EXPORT void +void CompositeGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst, @@ -648,7 +632,7 @@ miUnrealizeGlyph (ScreenPtr pScreen, { } -_X_EXPORT void +void miGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst, @@ -724,32 +708,35 @@ miGlyphs (CARD8 op, glyph = *glyphs++; pPicture = GlyphPicture (glyph)[pScreen->myNum]; - if (maskFormat) - { - CompositePicture (PictOpAdd, - pPicture, - None, - pMask, - 0, 0, - 0, 0, - x - glyph->info.x, - y - glyph->info.y, - glyph->info.width, - glyph->info.height); - } - else + if (pPicture) { - CompositePicture (op, - pSrc, - pPicture, - pDst, - xSrc + (x - glyph->info.x) - xDst, - ySrc + (y - glyph->info.y) - yDst, - 0, 0, - x - glyph->info.x, - y - glyph->info.y, - glyph->info.width, - glyph->info.height); + if (maskFormat) + { + CompositePicture (PictOpAdd, + pPicture, + None, + pMask, + 0, 0, + 0, 0, + x - glyph->info.x, + y - glyph->info.y, + glyph->info.width, + glyph->info.height); + } + else + { + CompositePicture (op, + pSrc, + pPicture, + pDst, + xSrc + (x - glyph->info.x) - xDst, + ySrc + (y - glyph->info.y) - yDst, + 0, 0, + x - glyph->info.x, + y - glyph->info.y, + glyph->info.width, + glyph->info.height); + } } x += glyph->info.xOff; diff --git a/xserver/render/glyphstr.h b/xserver/render/glyphstr.h index 67b21fe63..6c1a837e0 100644 --- a/xserver/render/glyphstr.h +++ b/xserver/render/glyphstr.h @@ -91,58 +91,58 @@ typedef struct _GlyphList { PictFormatPtr format; } GlyphListRec, *GlyphListPtr; -GlyphHashSetPtr +extern _X_EXPORT GlyphHashSetPtr FindGlyphHashSet (CARD32 filled); -void +extern _X_EXPORT void GlyphUninit (ScreenPtr pScreen); -GlyphHashSetPtr +extern _X_EXPORT GlyphHashSetPtr FindGlyphHashSet (CARD32 filled); -GlyphRefPtr +extern _X_EXPORT GlyphRefPtr FindGlyphRef (GlyphHashPtr hash, CARD32 signature, Bool match, unsigned char sha1[20]); -GlyphPtr +extern _X_EXPORT GlyphPtr FindGlyphByHash (unsigned char sha1[20], int format); -int +extern _X_EXPORT int HashGlyph (xGlyphInfo *gi, CARD8 *bits, unsigned long size, unsigned char sha1[20]); -void +extern _X_EXPORT void FreeGlyph (GlyphPtr glyph, int format); -void +extern _X_EXPORT void AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id); -Bool +extern _X_EXPORT Bool DeleteGlyph (GlyphSetPtr glyphSet, Glyph id); -GlyphPtr +extern _X_EXPORT GlyphPtr FindGlyph (GlyphSetPtr glyphSet, Glyph id); -GlyphPtr +extern _X_EXPORT GlyphPtr AllocateGlyph (xGlyphInfo *gi, int format); -Bool +extern _X_EXPORT Bool AllocateGlyphHash (GlyphHashPtr hash, GlyphHashSetPtr hashSet); -Bool +extern _X_EXPORT Bool ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global); -Bool +extern _X_EXPORT Bool ResizeGlyphSet (GlyphSetPtr glyphSet, CARD32 change); -GlyphSetPtr +extern _X_EXPORT GlyphSetPtr AllocateGlyphSet (int fdepth, PictFormatPtr format); -int +extern _X_EXPORT int FreeGlyphSet (pointer value, XID gid); diff --git a/xserver/render/matrix.c b/xserver/render/matrix.c index 3b55eb989..eccb90270 100644 --- a/xserver/render/matrix.c +++ b/xserver/render/matrix.c @@ -39,7 +39,7 @@ #include "servermd.h" #include "picturestr.h" -_X_EXPORT void +void PictTransform_from_xRenderTransform (PictTransformPtr pict, xRenderTransform *render) { @@ -56,7 +56,7 @@ PictTransform_from_xRenderTransform (PictTransformPtr pict, pict->matrix[2][2] = render->matrix33; } -_X_EXPORT void +void xRenderTransform_from_PictTransform (xRenderTransform *render, PictTransformPtr pict) { @@ -73,14 +73,14 @@ xRenderTransform_from_PictTransform (xRenderTransform *render, render->matrix33 = pict->matrix[2][2]; } -_X_EXPORT Bool +Bool PictureTransformPoint (PictTransformPtr transform, PictVectorPtr vector) { return pixman_transform_point(transform, vector); } -_X_EXPORT Bool +Bool PictureTransformPoint3d (PictTransformPtr transform, PictVectorPtr vector) { diff --git a/xserver/render/mipict.c b/xserver/render/mipict.c index 2fadd8c36..b5dfcb2ba 100644 --- a/xserver/render/mipict.c +++ b/xserver/render/mipict.c @@ -313,32 +313,24 @@ miClipPictureSrc (RegionPtr pRegion, int dx, int dy) { - /* XXX what to do with clipping from transformed pictures? */ - if (pPicture->transform || !pPicture->pDrawable) - return TRUE; - if (pPicture->repeat) + if (pPicture->clientClipType != CT_NONE) { - if (pPicture->clientClipType != CT_NONE) - { - pixman_region_translate ( pRegion, - dx - pPicture->clipOrigin.x, - dy - pPicture->clipOrigin.y); - if (!REGION_INTERSECT (pScreen, pRegion, pRegion, - (RegionPtr) pPicture->pCompositeClip)) // clientClip)) - return FALSE; - pixman_region_translate ( pRegion, - - (dx - pPicture->clipOrigin.x), - - (dy - pPicture->clipOrigin.y)); - } - return TRUE; - } - else - { - return miClipPictureReg (pRegion, - pPicture->pCompositeClip, - dx, - dy); + Bool result; + + pixman_region_translate ( pPicture->clientClip, + pPicture->clipOrigin.x + dx, + pPicture->clipOrigin.y + dy); + + result = REGION_INTERSECT (pScreen, pRegion, pRegion, pPicture->clientClip); + + pixman_region_translate ( pPicture->clientClip, + - (pPicture->clipOrigin.x + dx), + - (pPicture->clipOrigin.y + dy)); + + if (!result) + return FALSE; } + return TRUE; } void @@ -358,8 +350,6 @@ miCompositeSourceValidate (PicturePtr pPicture, if (pScreen->SourceValidate) { - x -= pPicture->pDrawable->x; - y -= pPicture->pDrawable->y; if (pPicture->transform) { xPoint points[4]; @@ -394,6 +384,8 @@ miCompositeSourceValidate (PicturePtr pPicture, width = xmax - xmin; height = ymax - ymin; } + x += pPicture->pDrawable->x; + y += pPicture->pDrawable->y; (*pScreen->SourceValidate) (pDrawable, x, y, width, height); } } @@ -403,7 +395,7 @@ miCompositeSourceValidate (PicturePtr pPicture, * an allocation failure, but rendering ignores those anyways. */ -_X_EXPORT Bool +Bool miComputeCompositeRegion (RegionPtr pRegion, PicturePtr pSrc, PicturePtr pMask, @@ -459,8 +451,8 @@ miComputeCompositeRegion (RegionPtr pRegion, if (pSrc->alphaMap) { if (!miClipPictureSrc (pRegion, pSrc->alphaMap, - xDst - (xSrc + pSrc->alphaOrigin.x), - yDst - (ySrc + pSrc->alphaOrigin.y))) + xDst - (xSrc - pSrc->alphaOrigin.x), + yDst - (ySrc - pSrc->alphaOrigin.y))) { pixman_region_fini (pRegion); return FALSE; @@ -477,8 +469,8 @@ miComputeCompositeRegion (RegionPtr pRegion, if (pMask->alphaMap) { if (!miClipPictureSrc (pRegion, pMask->alphaMap, - xDst - (xMask + pMask->alphaOrigin.x), - yDst - (yMask + pMask->alphaOrigin.y))) + xDst - (xMask - pMask->alphaOrigin.x), + yDst - (yMask - pMask->alphaOrigin.y))) { pixman_region_fini (pRegion); return FALSE; @@ -612,7 +604,7 @@ miRenderPixelToColor (PictFormatPtr format, } } -_X_EXPORT Bool +Bool miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) { PictureScreenPtr ps; diff --git a/xserver/render/mipict.h b/xserver/render/mipict.h index 60baf7f66..eb6b6645d 100644 --- a/xserver/render/mipict.h +++ b/xserver/render/mipict.h @@ -47,54 +47,46 @@ typedef struct _miIndexed { #define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)]) -int +extern _X_EXPORT int miCreatePicture (PicturePtr pPicture); -void +extern _X_EXPORT void miDestroyPicture (PicturePtr pPicture); -void +extern _X_EXPORT void miDestroyPictureClip (PicturePtr pPicture); -int +extern _X_EXPORT int miChangePictureClip (PicturePtr pPicture, int type, pointer value, int n); -void +extern _X_EXPORT void miChangePicture (PicturePtr pPicture, Mask mask); -void +extern _X_EXPORT void miValidatePicture (PicturePtr pPicture, Mask mask); -int +extern _X_EXPORT int miChangePictureTransform (PicturePtr pPicture, PictTransform *transform); -int +extern _X_EXPORT int miChangePictureFilter (PicturePtr pPicture, int filter, xFixed *params, int nparams); -Bool -miClipPicture (RegionPtr pRegion, - PicturePtr pPicture, - INT16 xReg, - INT16 yReg, - INT16 xPict, - INT16 yPict); - -void +extern _X_EXPORT void miCompositeSourceValidate (PicturePtr pPicture, INT16 x, INT16 y, CARD16 width, CARD16 height); -Bool +extern _X_EXPORT Bool miComputeCompositeRegion (RegionPtr pRegion, PicturePtr pSrc, PicturePtr pMask, @@ -108,18 +100,18 @@ miComputeCompositeRegion (RegionPtr pRegion, CARD16 width, CARD16 height); -Bool +extern _X_EXPORT Bool miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats); -Bool +extern _X_EXPORT Bool miRealizeGlyph (ScreenPtr pScreen, GlyphPtr glyph); -void +extern _X_EXPORT void miUnrealizeGlyph (ScreenPtr pScreen, GlyphPtr glyph); -void +extern _X_EXPORT void miGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst, @@ -130,30 +122,30 @@ miGlyphs (CARD8 op, GlyphListPtr list, GlyphPtr *glyphs); -void +extern _X_EXPORT void miRenderColorToPixel (PictFormatPtr pPict, xRenderColor *color, CARD32 *pixel); -void +extern _X_EXPORT void miRenderPixelToColor (PictFormatPtr pPict, CARD32 pixel, xRenderColor *color); -Bool +extern _X_EXPORT Bool miIsSolidAlpha (PicturePtr pSrc); -void +extern _X_EXPORT void miCompositeRects (CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect, xRectangle *rects); -void +extern _X_EXPORT void miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box); -void +extern _X_EXPORT void miTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst, @@ -163,19 +155,13 @@ miTrapezoids (CARD8 op, int ntrap, xTrapezoid *traps); -void +extern _X_EXPORT void miPointFixedBounds (int npoint, xPointFixed *points, BoxPtr bounds); -void +extern _X_EXPORT void miTriangleBounds (int ntri, xTriangle *tris, BoxPtr bounds); -void -miRasterizeTriangle (PicturePtr pMask, - xTriangle *tri, - int x_off, - int y_off); - -void +extern _X_EXPORT void miTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst, @@ -185,7 +171,7 @@ miTriangles (CARD8 op, int ntri, xTriangle *tris); -void +extern _X_EXPORT void miTriStrip (CARD8 op, PicturePtr pSrc, PicturePtr pDst, @@ -195,7 +181,7 @@ miTriStrip (CARD8 op, int npoint, xPointFixed *points); -void +extern _X_EXPORT void miTriFan (CARD8 op, PicturePtr pSrc, PicturePtr pDst, @@ -205,22 +191,22 @@ miTriFan (CARD8 op, int npoint, xPointFixed *points); -PicturePtr +extern _X_EXPORT PicturePtr miCreateAlphaPicture (ScreenPtr pScreen, PicturePtr pDst, PictFormatPtr pPictFormat, CARD16 width, CARD16 height); -Bool +extern _X_EXPORT Bool miInitIndexed (ScreenPtr pScreen, PictFormatPtr pFormat); -void +extern _X_EXPORT void miCloseIndexed (ScreenPtr pScreen, PictFormatPtr pFormat); -void +extern _X_EXPORT void miUpdateIndexed (ScreenPtr pScreen, PictFormatPtr pFormat, int ndef, diff --git a/xserver/render/mirect.c b/xserver/render/mirect.c index 38f4faf67..b54fe6fe6 100644 --- a/xserver/render/mirect.c +++ b/xserver/render/mirect.c @@ -94,7 +94,7 @@ miColorRects (PicturePtr pDst, FreeScratchGC (pGC); } -_X_EXPORT void +void miCompositeRects (CARD8 op, PicturePtr pDst, xRenderColor *color, diff --git a/xserver/render/picture.c b/xserver/render/picture.c index 956738734..18bfea29b 100644 --- a/xserver/render/picture.c +++ b/xserver/render/picture.c @@ -41,10 +41,9 @@ #include "servermd.h" #include "picturestr.h" #include "xace.h" -#include "registry.h" static int PictureScreenPrivateKeyIndex; -_X_EXPORT DevPrivateKey PictureScreenPrivateKey = &PictureScreenPrivateKeyIndex; +DevPrivateKey PictureScreenPrivateKey = &PictureScreenPrivateKeyIndex; static int PictureWindowPrivateKeyIndex; DevPrivateKey PictureWindowPrivateKey = &PictureWindowPrivateKeyIndex; static int PictureGeneration; @@ -200,6 +199,12 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp) formats[nformats].format = PICT_x8r8g8b8; formats[nformats].depth = 32; nformats++; + formats[nformats].format = PICT_b8g8r8a8; + formats[nformats].depth = 32; + nformats++; + formats[nformats].format = PICT_b8g8r8x8; + formats[nformats].depth = 32; + nformats++; /* now look through the depths and visuals adding other formats */ for (v = 0; v < pScreen->numVisuals; v++) @@ -217,9 +222,8 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp) b = Ones (pVisual->blueMask); type = PICT_TYPE_OTHER; /* - * Current rendering code supports only two direct formats, + * Current rendering code supports only three direct formats, * fields must be packed together at the bottom of the pixel - * and must be either RGB or BGR */ if (pVisual->offsetBlue == 0 && pVisual->offsetGreen == b && @@ -233,6 +237,12 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp) { type = PICT_TYPE_ABGR; } + else if (pVisual->offsetRed == pVisual->offsetGreen - r && + pVisual->offsetGreen == pVisual->offsetBlue - g && + pVisual->offsetBlue == bpp - b) + { + type = PICT_TYPE_BGRA; + } if (type != PICT_TYPE_OTHER) { format = PICT_FORMAT(bpp, type, 0, r, g, b); @@ -311,6 +321,17 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp) nformats = addFormat (formats, nformats, PICT_x8b8g8r8, pDepth->depth); } + if (pDepth->depth >= 30) + { + nformats = addFormat (formats, nformats, + PICT_a2r10g10b10, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_x2r10g10b10, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_a2b10g10r10, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_x2b10g10r10, pDepth->depth); + } break; } } @@ -366,6 +387,24 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp) pFormats[f].direct.red = 0; break; + case PICT_TYPE_BGRA: + pFormats[f].type = PictTypeDirect; + + pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format)); + pFormats[f].direct.blue = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format)); + + pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format)); + pFormats[f].direct.green = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format) - + PICT_FORMAT_G(format)); + + pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format)); + pFormats[f].direct.red = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format) - + PICT_FORMAT_G(format) - PICT_FORMAT_R(format)); + + pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format)); + pFormats[f].direct.alpha = 0; + break; + case PICT_TYPE_A: pFormats[f].type = PictTypeDirect; @@ -410,8 +449,9 @@ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format) return TRUE; if (format->index.vid == pScreen->rootVisual) { - format->index.pColormap = - (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP); + dixLookupResourceByType((pointer *)&format->index.pColormap, + pScreen->defColormap, RT_COLORMAP, + serverClient, DixGetAttrAccess); } else { VisualPtr pVisual = PictureFindVisual(pScreen, format->index.vid); if (CreateColormap(FakeClientID (0), pScreen, pVisual, @@ -456,7 +496,7 @@ PictureFinishInit (void) return TRUE; } -_X_EXPORT Bool +Bool PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel) { PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); @@ -468,7 +508,7 @@ PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel) } -_X_EXPORT int +int PictureGetSubpixelOrder (ScreenPtr pScreen) { PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); @@ -568,7 +608,7 @@ PictureParseCmapPolicy (const char *name) return PictureCmapPolicyInvalid; } -_X_EXPORT Bool +Bool PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) { PictureScreenPtr ps; @@ -577,19 +617,16 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) if (PictureGeneration != serverGeneration) { - PictureType = CreateNewResourceType (FreePicture); + PictureType = CreateNewResourceType (FreePicture, "PICTURE"); if (!PictureType) return FALSE; - PictFormatType = CreateNewResourceType (FreePictFormat); + PictFormatType = CreateNewResourceType (FreePictFormat, "PICTFORMAT"); if (!PictFormatType) return FALSE; - GlyphSetType = CreateNewResourceType (FreeGlyphSet); + GlyphSetType = CreateNewResourceType (FreeGlyphSet, "GLYPHSET"); if (!GlyphSetType) return FALSE; PictureGeneration = serverGeneration; - RegisterResourceName (PictureType, "PICTURE"); - RegisterResourceName (PictFormatType, "PICTFORMAT"); - RegisterResourceName (GlyphSetType, "GLYPHSET"); } if (!formats) { @@ -621,8 +658,10 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) type = PICT_TYPE_A; else if (formats[n].direct.red > formats[n].direct.blue) type = PICT_TYPE_ARGB; - else + else if (formats[n].direct.red == 0) type = PICT_TYPE_ABGR; + else + type = PICT_TYPE_BGRA; a = Ones (formats[n].direct.alphaMask); r = Ones (formats[n].direct.redMask); g = Ones (formats[n].direct.greenMask); diff --git a/xserver/render/picture.h b/xserver/render/picture.h index 045b29944..8bd38b98e 100644 --- a/xserver/render/picture.h +++ b/xserver/render/picture.h @@ -25,6 +25,8 @@ #ifndef _PICTURE_H_ #define _PICTURE_H_ +#include "privates.h" + #include <pixman.h> typedef struct _DirectFormat *DirectFormatPtr; @@ -60,15 +62,23 @@ typedef struct _Picture *PicturePtr; #define PICT_TYPE_ABGR PIXMAN_TYPE_ABGR #define PICT_TYPE_COLOR PIXMAN_TYPE_COLOR #define PICT_TYPE_GRAY PIXMAN_TYPE_GRAY +#define PICT_TYPE_BGRA PIXMAN_TYPE_BGRA #define PICT_FORMAT_COLOR(f) PIXMAN_FORMAT_COLOR(f) /* 32bpp formats */ typedef enum _PictFormatShort { + PICT_a2r10g10b10 = PIXMAN_a2r10g10b10, + PICT_x2r10g10b10 = PIXMAN_x2r10g10b10, + PICT_a2b10g10r10 = PIXMAN_a2b10g10r10, + PICT_x2b10g10r10 = PIXMAN_x2b10g10r10, + PICT_a8r8g8b8 = PIXMAN_a8r8g8b8, PICT_x8r8g8b8 = PIXMAN_x8r8g8b8, PICT_a8b8g8r8 = PIXMAN_a8b8g8r8, PICT_x8b8g8r8 = PIXMAN_x8b8g8r8, + PICT_b8g8r8a8 = PIXMAN_b8g8r8a8, + PICT_b8g8r8x8 = PIXMAN_b8g8r8x8, /* 24bpp formats */ PICT_r8g8b8 = PIXMAN_r8g8b8, @@ -159,12 +169,12 @@ typedef enum _PictFormatShort { #define PictureCmapPolicyColor 3 #define PictureCmapPolicyAll 4 -extern int PictureCmapPolicy; +extern _X_EXPORT int PictureCmapPolicy; -int PictureParseCmapPolicy (const char *name); +extern _X_EXPORT int PictureParseCmapPolicy (const char *name); -extern int RenderErrBase; -extern DevPrivateKey RenderClientPrivateKey; +extern _X_EXPORT int RenderErrBase; +extern _X_EXPORT DevPrivateKey RenderClientPrivateKey; /* Fixed point updates from Carl Worth, USC, Information Sciences Institute */ diff --git a/xserver/render/picturestr.h b/xserver/render/picturestr.h index 4d788fcfb..6a8d76d99 100644 --- a/xserver/render/picturestr.h +++ b/xserver/render/picturestr.h @@ -396,11 +396,11 @@ typedef struct _PictureScreen { } PictureScreenRec, *PictureScreenPtr; -extern DevPrivateKey PictureScreenPrivateKey; -extern DevPrivateKey PictureWindowPrivateKey; -extern RESTYPE PictureType; -extern RESTYPE PictFormatType; -extern RESTYPE GlyphSetType; +extern _X_EXPORT DevPrivateKey PictureScreenPrivateKey; +extern _X_EXPORT DevPrivateKey PictureWindowPrivateKey; +extern _X_EXPORT RESTYPE PictureType; +extern _X_EXPORT RESTYPE PictFormatType; +extern _X_EXPORT RESTYPE GlyphSetType; #define GetPictureScreen(s) ((PictureScreenPtr)dixLookupPrivate(&(s)->devPrivates, PictureScreenPrivateKey)) #define GetPictureScreenIfSet(s) GetPictureScreen(s) @@ -409,11 +409,10 @@ extern RESTYPE GlyphSetType; #define SetPictureWindow(w,p) dixSetPrivate(&(w)->devPrivates, PictureWindowPrivateKey, p) #define VERIFY_PICTURE(pPicture, pid, client, mode, err) {\ - pPicture = SecurityLookupIDByType(client, pid, PictureType, mode);\ - if (!pPicture) { \ - client->errorValue = pid; \ - return err; \ - } \ + int rc = dixLookupResourceByType((pointer)&(pPicture), pid,\ + PictureType, client, mode);\ + if (rc != Success)\ + return (rc == BadValue) ? err : rc;\ } #define VERIFY_ALPHA(pPicture, pid, client, mode, err) {\ @@ -424,76 +423,76 @@ extern RESTYPE GlyphSetType; } \ } \ -Bool +extern _X_EXPORT Bool PictureDestroyWindow (WindowPtr pWindow); -Bool +extern _X_EXPORT Bool PictureCloseScreen (int Index, ScreenPtr pScreen); -void +extern _X_EXPORT void PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef); -Bool +extern _X_EXPORT Bool PictureInitIndexedFormat (ScreenPtr pScreen, PictFormatPtr format); -Bool +extern _X_EXPORT Bool PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel); -int +extern _X_EXPORT int PictureGetSubpixelOrder (ScreenPtr pScreen); -PictFormatPtr +extern _X_EXPORT PictFormatPtr PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp); -PictFormatPtr +extern _X_EXPORT PictFormatPtr PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual); -PictFormatPtr +extern _X_EXPORT PictFormatPtr PictureMatchFormat (ScreenPtr pScreen, int depth, CARD32 format); -Bool +extern _X_EXPORT Bool PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats); -int +extern _X_EXPORT int PictureGetFilterId (char *filter, int len, Bool makeit); -char * +extern _X_EXPORT char * PictureGetFilterName (int id); -int +extern _X_EXPORT int PictureAddFilter (ScreenPtr pScreen, char *filter, PictFilterValidateParamsProcPtr ValidateParams, int width, int height); -Bool +extern _X_EXPORT Bool PictureSetFilterAlias (ScreenPtr pScreen, char *filter, char *alias); -Bool +extern _X_EXPORT Bool PictureSetDefaultFilters (ScreenPtr pScreen); -void +extern _X_EXPORT void PictureResetFilters (ScreenPtr pScreen); -PictFilterPtr +extern _X_EXPORT PictFilterPtr PictureFindFilter (ScreenPtr pScreen, char *name, int len); -int +extern _X_EXPORT int SetPicturePictFilter (PicturePtr pPicture, PictFilterPtr pFilter, xFixed *params, int nparams); -int +extern _X_EXPORT int SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams); -Bool +extern _X_EXPORT Bool PictureFinishInit (void); -void +extern _X_EXPORT void SetPictureToDefaults (PicturePtr pPicture); -PicturePtr +extern _X_EXPORT PicturePtr CreatePicture (Picture pid, DrawablePtr pDrawable, PictFormatPtr pFormat, @@ -502,47 +501,47 @@ CreatePicture (Picture pid, ClientPtr client, int *error); -int +extern _X_EXPORT int ChangePicture (PicturePtr pPicture, Mask vmask, XID *vlist, DevUnion *ulist, ClientPtr client); -int +extern _X_EXPORT int SetPictureClipRects (PicturePtr pPicture, int xOrigin, int yOrigin, int nRect, xRectangle *rects); -int +extern _X_EXPORT int SetPictureClipRegion (PicturePtr pPicture, int xOrigin, int yOrigin, RegionPtr pRegion); -int +extern _X_EXPORT int SetPictureTransform (PicturePtr pPicture, PictTransform *transform); -void +extern _X_EXPORT void CopyPicture (PicturePtr pSrc, Mask mask, PicturePtr pDst); -void +extern _X_EXPORT void ValidatePicture(PicturePtr pPicture); -int +extern _X_EXPORT int FreePicture (pointer pPicture, XID pid); -int +extern _X_EXPORT int FreePictFormat (pointer pPictFormat, XID pid); -void +extern _X_EXPORT void CompositePicture (CARD8 op, PicturePtr pSrc, PicturePtr pMask, @@ -556,7 +555,7 @@ CompositePicture (CARD8 op, CARD16 width, CARD16 height); -void +extern _X_EXPORT void CompositeGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst, @@ -567,14 +566,14 @@ CompositeGlyphs (CARD8 op, GlyphListPtr lists, GlyphPtr *glyphs); -void +extern _X_EXPORT void CompositeRects (CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect, xRectangle *rects); -void +extern _X_EXPORT void CompositeTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst, @@ -584,7 +583,7 @@ CompositeTrapezoids (CARD8 op, int ntrap, xTrapezoid *traps); -void +extern _X_EXPORT void CompositeTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst, @@ -594,7 +593,7 @@ CompositeTriangles (CARD8 op, int ntriangles, xTriangle *triangles); -void +extern _X_EXPORT void CompositeTriStrip (CARD8 op, PicturePtr pSrc, PicturePtr pDst, @@ -604,7 +603,7 @@ CompositeTriStrip (CARD8 op, int npoints, xPointFixed *points); -void +extern _X_EXPORT void CompositeTriFan (CARD8 op, PicturePtr pSrc, PicturePtr pDst, @@ -614,12 +613,12 @@ CompositeTriFan (CARD8 op, int npoints, xPointFixed *points); -CARD32 +extern _X_EXPORT CARD32 PictureGradientColor (PictGradientStopPtr stop1, PictGradientStopPtr stop2, CARD32 x); -void RenderExtensionInit (void); +extern _X_EXPORT void RenderExtensionInit (void); Bool AnimCurInit (ScreenPtr pScreen); @@ -627,23 +626,19 @@ AnimCurInit (ScreenPtr pScreen); int AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor, ClientPtr client, XID cid); -void +extern _X_EXPORT void AddTraps (PicturePtr pPicture, INT16 xOff, INT16 yOff, int ntraps, xTrap *traps); -pixman_image_t * -PixmanImageFromPicture (PicturePtr pPict, - Bool hasClip); - -PicturePtr +extern _X_EXPORT PicturePtr CreateSolidPicture (Picture pid, xRenderColor *color, int *error); -PicturePtr +extern _X_EXPORT PicturePtr CreateLinearGradientPicture (Picture pid, xPointFixed *p1, xPointFixed *p2, @@ -652,7 +647,7 @@ CreateLinearGradientPicture (Picture pid, xRenderColor *colors, int *error); -PicturePtr +extern _X_EXPORT PicturePtr CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer, @@ -663,7 +658,7 @@ CreateRadialGradientPicture (Picture pid, xRenderColor *colors, int *error); -PicturePtr +extern _X_EXPORT PicturePtr CreateConicalGradientPicture (Picture pid, xPointFixed *center, xFixed angle, @@ -673,27 +668,27 @@ CreateConicalGradientPicture (Picture pid, int *error); #ifdef PANORAMIX -void PanoramiXRenderInit (void); -void PanoramiXRenderReset (void); +extern _X_EXPORT void PanoramiXRenderInit (void); +extern _X_EXPORT void PanoramiXRenderReset (void); #endif /* * matrix.c */ -void +extern _X_EXPORT void PictTransform_from_xRenderTransform (PictTransformPtr pict, xRenderTransform *render); -void +extern _X_EXPORT void xRenderTransform_from_PictTransform (xRenderTransform *render, PictTransformPtr pict); -Bool +extern _X_EXPORT Bool PictureTransformPoint (PictTransformPtr transform, PictVectorPtr vector); -Bool +extern _X_EXPORT Bool PictureTransformPoint3d (PictTransformPtr transform, PictVectorPtr vector); diff --git a/xserver/render/render.c b/xserver/render/render.c index dbd0a3777..afe4c92e7 100644 --- a/xserver/render/render.c +++ b/xserver/render/render.c @@ -22,8 +22,6 @@ * Author: Keith Packard, SuSE, Inc. */ -#define NEED_REPLIES -#define NEED_EVENTS #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -47,6 +45,7 @@ #include <X11/Xfuncproto.h> #include "cursorstr.h" #include "xace.h" +#include "protocol-versions.h" #if HAVE_STDINT_H #include <stdint.h> @@ -54,9 +53,6 @@ #define UINT32_MAX 0xffffffffU #endif -#define SERVER_RENDER_MAJOR 0 -#define SERVER_RENDER_MINOR 10 - static int ProcRenderQueryVersion (ClientPtr pClient); static int ProcRenderQueryPictFormats (ClientPtr pClient); static int ProcRenderQueryPictIndexValues (ClientPtr pClient); @@ -271,11 +267,22 @@ ProcRenderQueryVersion (ClientPtr client) pRenderClient->minor_version = stuff->minorVersion; REQUEST_SIZE_MATCH(xRenderQueryVersionReq); + memset(&rep, 0, sizeof(xRenderQueryVersionReply)); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.majorVersion = SERVER_RENDER_MAJOR; - rep.minorVersion = SERVER_RENDER_MINOR; + + if ((stuff->majorVersion * 1000 + stuff->minorVersion) < + (SERVER_RENDER_MAJOR_VERSION * 1000 + SERVER_RENDER_MINOR_VERSION)) + { + rep.majorVersion = stuff->majorVersion; + rep.minorVersion = stuff->minorVersion; + } else + { + rep.majorVersion = SERVER_RENDER_MAJOR_VERSION; + rep.minorVersion = SERVER_RENDER_MINOR_VERSION; + } + if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); @@ -368,12 +375,12 @@ ProcRenderQueryPictFormats (ClientPtr client) ndepth * sizeof (xPictDepth) + nvisual * sizeof (xPictVisual) + numSubpixel * sizeof (CARD32)); - reply = (xRenderQueryPictFormatsReply *) xalloc (rlength); + reply = (xRenderQueryPictFormatsReply *) xcalloc (1, rlength); if (!reply) return BadAlloc; reply->type = X_Reply; reply->sequenceNumber = client->sequence; - reply->length = (rlength - sizeof(xGenericReply)) >> 2; + reply->length = bytes_to_int32(rlength - sizeof(xGenericReply)); reply->numFormats = nformat; reply->numScreens = numScreens; reply->numDepths = ndepth; @@ -513,7 +520,7 @@ static int ProcRenderQueryPictIndexValues (ClientPtr client) { PictFormatPtr pFormat; - int num; + int rc, num; int rlength; int i, n; REQUEST(xRenderQueryPictIndexValuesReq); @@ -522,16 +529,11 @@ ProcRenderQueryPictIndexValues (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq); - pFormat = (PictFormatPtr) SecurityLookupIDByType (client, - stuff->format, - PictFormatType, - DixReadAccess); + rc = dixLookupResourceByType((pointer *)&pFormat, stuff->format, + PictFormatType, client, DixReadAccess); + if (rc != Success) + return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; - if (!pFormat) - { - client->errorValue = stuff->format; - return RenderErrBase + BadPictFormat; - } if (pFormat->type != PictTypeIndexed) { client->errorValue = stuff->format; @@ -546,7 +548,7 @@ ProcRenderQueryPictIndexValues (ClientPtr client) reply->type = X_Reply; reply->sequenceNumber = client->sequence; - reply->length = (rlength - sizeof(xGenericReply)) >> 2; + reply->length = bytes_to_int32(rlength - sizeof(xGenericReply)); reply->numIndexValues = num; values = (xIndexValue *) (reply + 1); @@ -596,18 +598,14 @@ ProcRenderCreatePicture (ClientPtr client) if (rc != Success) return rc; - pFormat = (PictFormatPtr) SecurityLookupIDByType (client, - stuff->format, - PictFormatType, - DixReadAccess); - if (!pFormat) - { - client->errorValue = stuff->format; - return RenderErrBase + BadPictFormat; - } + rc = dixLookupResourceByType((pointer *)&pFormat, stuff->format, + PictFormatType, client, DixReadAccess); + if (rc != Success) + return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; + if (pFormat->depth != pDrawable->depth) return BadMatch; - len = client->req_len - (sizeof(xRenderCreatePictureReq) >> 2); + len = client->req_len - bytes_to_int32(sizeof(xRenderCreatePictureReq)); if (Ones(stuff->mask) != len) return BadLength; @@ -636,7 +634,7 @@ ProcRenderChangePicture (ClientPtr client) VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess, RenderErrBase + BadPicture); - len = client->req_len - (sizeof(xRenderChangePictureReq) >> 2); + len = client->req_len - bytes_to_int32(sizeof(xRenderChangePictureReq)); if (Ones(stuff->mask) != len) return BadLength; @@ -658,7 +656,7 @@ ProcRenderSetPictureClipRectangles (ClientPtr client) if (!pPicture->pDrawable) return BadDrawable; - nr = (client->req_len << 2) - sizeof(xRenderChangePictureReq); + nr = (client->req_len << 2) - sizeof(xRenderSetPictureClipRectanglesReq); if (nr & 4) return BadLength; nr >>= 3; @@ -694,6 +692,8 @@ PictOpValid (CARD8 op) return TRUE; if (PictOpConjointMinimum <= op && op <= PictOpConjointMaximum) return TRUE; + if (PictOpBlendMinimum <= op && op <= PictOpBlendMaximum) + return TRUE; return FALSE; } @@ -744,7 +744,7 @@ ProcRenderScale (ClientPtr client) static int ProcRenderTrapezoids (ClientPtr client) { - int ntraps; + int rc, ntraps; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrapezoidsReq); @@ -765,15 +765,10 @@ ProcRenderTrapezoids (ClientPtr client) return BadMatch; if (stuff->maskFormat) { - pFormat = (PictFormatPtr) SecurityLookupIDByType (client, - stuff->maskFormat, - PictFormatType, - DixReadAccess); - if (!pFormat) - { - client->errorValue = stuff->maskFormat; - return RenderErrBase + BadPictFormat; - } + rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat, + PictFormatType, client, DixReadAccess); + if (rc != Success) + return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; } else pFormat = 0; @@ -791,7 +786,7 @@ ProcRenderTrapezoids (ClientPtr client) static int ProcRenderTriangles (ClientPtr client) { - int ntris; + int rc, ntris; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrianglesReq); @@ -812,15 +807,10 @@ ProcRenderTriangles (ClientPtr client) return BadMatch; if (stuff->maskFormat) { - pFormat = (PictFormatPtr) SecurityLookupIDByType (client, - stuff->maskFormat, - PictFormatType, - DixReadAccess); - if (!pFormat) - { - client->errorValue = stuff->maskFormat; - return RenderErrBase + BadPictFormat; - } + rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat, + PictFormatType, client, DixReadAccess); + if (rc != Success) + return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; } else pFormat = 0; @@ -838,7 +828,7 @@ ProcRenderTriangles (ClientPtr client) static int ProcRenderTriStrip (ClientPtr client) { - int npoints; + int rc, npoints; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrianglesReq); @@ -859,15 +849,10 @@ ProcRenderTriStrip (ClientPtr client) return BadMatch; if (stuff->maskFormat) { - pFormat = (PictFormatPtr) SecurityLookupIDByType (client, - stuff->maskFormat, - PictFormatType, - DixReadAccess); - if (!pFormat) - { - client->errorValue = stuff->maskFormat; - return RenderErrBase + BadPictFormat; - } + rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat, + PictFormatType, client, DixReadAccess); + if (rc != Success) + return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; } else pFormat = 0; @@ -885,7 +870,7 @@ ProcRenderTriStrip (ClientPtr client) static int ProcRenderTriFan (ClientPtr client) { - int npoints; + int rc, npoints; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrianglesReq); @@ -906,15 +891,10 @@ ProcRenderTriFan (ClientPtr client) return BadMatch; if (stuff->maskFormat) { - pFormat = (PictFormatPtr) SecurityLookupIDByType (client, - stuff->maskFormat, - PictFormatType, - DixReadAccess); - if (!pFormat) - { - client->errorValue = stuff->maskFormat; - return RenderErrBase + BadPictFormat; - } + rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat, + PictFormatType, client, DixReadAccess); + if (rc != Success) + return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; } else pFormat = 0; @@ -958,15 +938,11 @@ ProcRenderCreateGlyphSet (ClientPtr client) REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq); LEGAL_NEW_RESOURCE(stuff->gsid, client); - format = (PictFormatPtr) SecurityLookupIDByType (client, - stuff->format, - PictFormatType, - DixReadAccess); - if (!format) - { - client->errorValue = stuff->format; - return RenderErrBase + BadPictFormat; - } + rc = dixLookupResourceByType((pointer *)&format, stuff->format, + PictFormatType, client, DixReadAccess); + if (rc != Success) + return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; + switch (format->depth) { case 1: f = GlyphFormat1; @@ -1067,7 +1043,7 @@ ProcRenderAddGlyphs (ClientPtr client) CARD32 *gids; xGlyphInfo *gi; CARD8 *bits; - int size; + unsigned int size; int err; int i, screen; PicturePtr pSrc = NULL, pDst = NULL; @@ -1155,6 +1131,10 @@ ProcRenderAddGlyphs (ClientPtr client) ScreenPtr pScreen; int error; + /* Skip work if it's invisibly small anyway */ + if (!width || !height) + break; + pScreen = screenInfo.screens[screen]; pSrcPix = GetScratchPixmapHeader (pScreen, width, height, @@ -1179,6 +1159,12 @@ ProcRenderAddGlyphs (ClientPtr client) width, height, depth, CREATE_PIXMAP_USAGE_GLYPH_PICTURE); + if (!pDstPix) + { + err = BadAlloc; + goto bail; + } + GlyphPicture (glyph)[screen] = pDst = CreatePicture (0, &pDstPix->drawable, glyphSet->format, @@ -1188,6 +1174,7 @@ ProcRenderAddGlyphs (ClientPtr client) /* The picture takes a reference to the pixmap, so we drop ours. */ (pScreen->DestroyPixmap) (pDstPix); + pDstPix = NULL; if (! pDst) { @@ -1272,7 +1259,7 @@ ProcRenderFreeGlyphs (ClientPtr client) client->errorValue = stuff->glyphset; return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc; } - nglyph = ((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq)) >> 2; + nglyph = bytes_to_int32((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq)); gids = (CARD32 *) (stuff + 1); while (nglyph-- > 0) { @@ -1304,7 +1291,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) int nlist; int space; int size; - int n; + int rc, n; REQUEST(xRenderCompositeGlyphsReq); @@ -1331,28 +1318,18 @@ ProcRenderCompositeGlyphs (ClientPtr client) return BadMatch; if (stuff->maskFormat) { - pFormat = (PictFormatPtr) SecurityLookupIDByType (client, - stuff->maskFormat, - PictFormatType, - DixReadAccess); - if (!pFormat) - { - client->errorValue = stuff->maskFormat; - return RenderErrBase + BadPictFormat; - } + rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat, + PictFormatType, client, DixReadAccess); + if (rc != Success) + return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; } else pFormat = 0; - glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, - stuff->glyphset, - GlyphSetType, - DixUseAccess); - if (!glyphSet) - { - client->errorValue = stuff->glyphset; - return RenderErrBase + BadGlyphSet; - } + rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, + GlyphSetType, client, DixUseAccess); + if (rc != Success) + return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc; buffer = (CARD8 *) (stuff + 1); end = (CARD8 *) stuff + (client->req_len << 2); @@ -1405,19 +1382,17 @@ ProcRenderCompositeGlyphs (ClientPtr client) { if (buffer + sizeof (GlyphSet) < end) { - gs = *(CARD32 *) buffer; - glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, - gs, - GlyphSetType, - DixUseAccess); - if (!glyphSet) + memcpy(&gs, buffer, sizeof(GlyphSet)); + rc = dixLookupResourceByType((pointer *)&glyphSet, gs, + GlyphSetType, client, + DixUseAccess); + if (rc != Success) { - client->errorValue = gs; if (glyphsBase != glyphsLocal) xfree (glyphsBase); if (listsBase != listsLocal) xfree (listsBase); - return RenderErrBase + BadGlyphSet; + return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc; } } buffer += 4; @@ -1510,7 +1485,7 @@ ProcRenderFillRectangles (ClientPtr client) } static void -SetBit (unsigned char *line, int x, int bit) +RenderSetBit (unsigned char *line, int x, int bit) { unsigned char mask; @@ -1681,8 +1656,8 @@ ProcRenderCreateCursor (ClientPtr client) { CARD32 a = ((p >> 24)); - SetBit (mskline, x, a != 0); - SetBit (srcline, x, a != 0 && p == twocolor[0]); + RenderSetBit (mskline, x, a != 0); + RenderSetBit (srcline, x, a != 0 && p == twocolor[0]); } else { @@ -1690,9 +1665,9 @@ ProcRenderCreateCursor (ClientPtr client) CARD32 i = ((CvtR8G8B8toY15(p) >> 7) * DITHER_SIZE + 127) / 255; CARD32 d = orderedDither[y&(DITHER_DIM-1)][x&(DITHER_DIM-1)]; /* Set mask from dithered alpha value */ - SetBit(mskline, x, a > d); + RenderSetBit(mskline, x, a > d); /* Set src from dithered intensity value */ - SetBit(srcline, x, a > d && i <= d); + RenderSetBit(srcline, x, a > d && i <= d); } } srcline += stride; @@ -1784,7 +1759,7 @@ ProcRenderQueryFilters (ClientPtr client) nbytesName += 1 + strlen (ps->filterAliases[i].alias); nnames = ps->nfilters + ps->nfilterAliases; } - len = ((nnames + 1) >> 1) + ((nbytesName + 3) >> 2); + len = ((nnames + 1) >> 1) + bytes_to_int32(nbytesName); total_bytes = sizeof (xRenderQueryFiltersReply) + (len << 2); reply = (xRenderQueryFiltersReply *) xalloc (total_bytes); if (!reply) @@ -1876,7 +1851,7 @@ ProcRenderSetPictureFilter (ClientPtr client) VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess, RenderErrBase + BadPicture); name = (char *) (stuff + 1); - params = (xFixed *) (name + ((stuff->nbytes + 3) & ~3)); + params = (xFixed *) (name + pad_to_int32(stuff->nbytes)); nparams = ((xFixed *) stuff + client->req_len) - params; result = SetPictureFilter (pPicture, name, stuff->nbytes, params, nparams); return result; @@ -1898,7 +1873,7 @@ ProcRenderCreateAnimCursor (ClientPtr client) LEGAL_NEW_RESOURCE(stuff->cid, client); if (client->req_len & 1) return BadLength; - ncursor = (client->req_len - (SIZEOF(xRenderCreateAnimCursorReq) >> 2)) >> 1; + ncursor = (client->req_len - (bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1; cursors = xalloc (ncursor * (sizeof (CursorPtr) + sizeof (CARD32))); if (!cursors) return BadAlloc; @@ -1906,13 +1881,12 @@ ProcRenderCreateAnimCursor (ClientPtr client) elt = (xAnimCursorElt *) (stuff + 1); for (i = 0; i < ncursor; i++) { - cursors[i] = (CursorPtr)SecurityLookupIDByType(client, elt->cursor, - RT_CURSOR, DixReadAccess); - if (!cursors[i]) + ret = dixLookupResourceByType((pointer *)(cursors + i), elt->cursor, + RT_CURSOR, client, DixReadAccess); + if (ret != Success) { xfree (cursors); - client->errorValue = elt->cursor; - return BadCursor; + return (ret == BadValue) ? BadCursor : ret; } deltas[i] = elt->delay; elt++; @@ -2693,11 +2667,10 @@ SProcRenderDispatch (ClientPtr client) #include "panoramiXsrv.h" #define VERIFY_XIN_PICTURE(pPicture, pid, client, mode, err) {\ - pPicture = SecurityLookupIDByType(client, pid, XRT_PICTURE, mode);\ - if (!pPicture) { \ - client->errorValue = pid; \ - return err; \ - } \ + int rc = dixLookupResourceByType((pointer *)&(pPicture), pid,\ + XRT_PICTURE, client, mode);\ + if (rc != Success)\ + return (rc == BadValue) ? err : rc;\ } #define VERIFY_XIN_ALPHA(pPicture, pid, client, mode, err) {\ @@ -2717,12 +2690,13 @@ PanoramiXRenderCreatePicture (ClientPtr client) { REQUEST(xRenderCreatePictureReq); PanoramiXRes *refDraw, *newPict; - int result = Success, j; + int result, j; REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); - if(!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) - return BadDrawable; + result = dixLookupResourceByClass((pointer *)&refDraw, stuff->drawable, + XRC_DRAWABLE, client, DixWriteAccess); + if (result != Success) + return (result == BadValue) ? BadDrawable : result; if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) return BadAlloc; newPict->type = XRT_PICTURE; @@ -2761,7 +2735,7 @@ PanoramiXRenderChangePicture (ClientPtr client) int result = Success, j; REQUEST(xRenderChangePictureReq); - REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); + REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq); VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); @@ -3268,12 +3242,145 @@ PanoramiXRenderAddTraps (ClientPtr client) return result; } +static int +PanoramiXRenderCreateSolidFill (ClientPtr client) +{ + REQUEST(xRenderCreateSolidFillReq); + PanoramiXRes *newPict; + int result = Success, j; + + REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq); + + if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) + return BadAlloc; + + newPict->type = XRT_PICTURE; + newPict->info[0].id = stuff->pid; + newPict->u.pict.root = FALSE; + + for(j = 1; j < PanoramiXNumScreens; j++) + newPict->info[j].id = FakeClientID(client->index); + + FOR_NSCREENS_BACKWARD(j) { + stuff->pid = newPict->info[j].id; + result = (*PanoramiXSaveRenderVector[X_RenderCreateSolidFill]) (client); + if(result != Success) break; + } + + if (result == Success) + AddResource(newPict->info[0].id, XRT_PICTURE, newPict); + else + xfree(newPict); + + return result; +} + +static int +PanoramiXRenderCreateLinearGradient (ClientPtr client) +{ + REQUEST(xRenderCreateLinearGradientReq); + PanoramiXRes *newPict; + int result = Success, j; + + REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq); + + if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) + return BadAlloc; + + newPict->type = XRT_PICTURE; + newPict->info[0].id = stuff->pid; + newPict->u.pict.root = FALSE; + + for(j = 1; j < PanoramiXNumScreens; j++) + newPict->info[j].id = FakeClientID(client->index); + + FOR_NSCREENS_BACKWARD(j) { + stuff->pid = newPict->info[j].id; + result = (*PanoramiXSaveRenderVector[X_RenderCreateLinearGradient]) (client); + if(result != Success) break; + } + + if (result == Success) + AddResource(newPict->info[0].id, XRT_PICTURE, newPict); + else + xfree(newPict); + + return result; +} + +static int +PanoramiXRenderCreateRadialGradient (ClientPtr client) +{ + REQUEST(xRenderCreateRadialGradientReq); + PanoramiXRes *newPict; + int result = Success, j; + + REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq); + + if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) + return BadAlloc; + + newPict->type = XRT_PICTURE; + newPict->info[0].id = stuff->pid; + newPict->u.pict.root = FALSE; + + for(j = 1; j < PanoramiXNumScreens; j++) + newPict->info[j].id = FakeClientID(client->index); + + FOR_NSCREENS_BACKWARD(j) { + stuff->pid = newPict->info[j].id; + result = (*PanoramiXSaveRenderVector[X_RenderCreateRadialGradient]) (client); + if(result != Success) break; + } + + if (result == Success) + AddResource(newPict->info[0].id, XRT_PICTURE, newPict); + else + xfree(newPict); + + return result; +} + +static int +PanoramiXRenderCreateConicalGradient (ClientPtr client) +{ + REQUEST(xRenderCreateConicalGradientReq); + PanoramiXRes *newPict; + int result = Success, j; + + REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq); + + if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) + return BadAlloc; + + newPict->type = XRT_PICTURE; + newPict->info[0].id = stuff->pid; + newPict->u.pict.root = FALSE; + + for(j = 1; j < PanoramiXNumScreens; j++) + newPict->info[j].id = FakeClientID(client->index); + + FOR_NSCREENS_BACKWARD(j) { + stuff->pid = newPict->info[j].id; + result = (*PanoramiXSaveRenderVector[X_RenderCreateConicalGradient]) (client); + if(result != Success) break; + } + + if (result == Success) + AddResource(newPict->info[0].id, XRT_PICTURE, newPict); + else + xfree(newPict); + + return result; +} + void PanoramiXRenderInit (void) { int i; - XRT_PICTURE = CreateNewResourceType (XineramaDeleteResource); + XRT_PICTURE = CreateNewResourceType (XineramaDeleteResource, + "XineramaPicture"); for (i = 0; i < RenderNumberRequests; i++) PanoramiXSaveRenderVector[i] = ProcRenderVector[i]; /* @@ -3296,6 +3403,11 @@ PanoramiXRenderInit (void) ProcRenderVector[X_RenderTriStrip] = PanoramiXRenderTriStrip; ProcRenderVector[X_RenderTriFan] = PanoramiXRenderTriFan; ProcRenderVector[X_RenderAddTraps] = PanoramiXRenderAddTraps; + + ProcRenderVector[X_RenderCreateSolidFill] = PanoramiXRenderCreateSolidFill; + ProcRenderVector[X_RenderCreateLinearGradient] = PanoramiXRenderCreateLinearGradient; + ProcRenderVector[X_RenderCreateRadialGradient] = PanoramiXRenderCreateRadialGradient; + ProcRenderVector[X_RenderCreateConicalGradient] = PanoramiXRenderCreateConicalGradient; } void diff --git a/xserver/render/renderedge.c b/xserver/render/renderedge.c index d0ee30716..8771fe164 100644 --- a/xserver/render/renderedge.c +++ b/xserver/render/renderedge.c @@ -31,7 +31,7 @@ * grid row */ -_X_EXPORT xFixed +xFixed RenderSampleCeilY (xFixed y, int n) { return pixman_sample_ceil_y (y, n); @@ -43,7 +43,7 @@ RenderSampleCeilY (xFixed y, int n) * Compute the largest value no greater than y which is on a * grid row */ -_X_EXPORT xFixed +xFixed RenderSampleFloorY (xFixed y, int n) { return pixman_sample_floor_y (y, n); @@ -52,7 +52,7 @@ RenderSampleFloorY (xFixed y, int n) /* * Step an edge by any amount (including negative values) */ -_X_EXPORT void +void RenderEdgeStep (RenderEdge *e, int n) { pixman_edge_step (e, n); @@ -62,7 +62,7 @@ RenderEdgeStep (RenderEdge *e, int n) * Initialize one edge structure given the line endpoints and a * starting y value */ -_X_EXPORT void +void RenderEdgeInit (RenderEdge *e, int n, xFixed y_start, @@ -78,7 +78,7 @@ RenderEdgeInit (RenderEdge *e, * Initialize one edge structure given a line, starting y value * and a pixel offset for the line */ -_X_EXPORT void +void RenderLineFixedEdgeInit (RenderEdge *e, int n, xFixed y, diff --git a/xserver/render/renderedge.h b/xserver/render/renderedge.h index 1df3582ce..6585aeb90 100644 --- a/xserver/render/renderedge.h +++ b/xserver/render/renderedge.h @@ -1,6 +1,4 @@ /* - * $Id: renderedge.h,v 1.1 2006/11/26 18:16:23 matthieu Exp $ - * * Copyright © 2004 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its @@ -50,20 +48,7 @@ * and can be quickly stepped across small or large gaps in the * sample grid */ - -typedef struct { - xFixed x; - xFixed e; - xFixed stepx; - xFixed signdx; - xFixed dy; - xFixed dx; - - xFixed stepx_small; - xFixed stepx_big; - xFixed dx_small; - xFixed dx_big; -} RenderEdge; +typedef pixman_edge_t RenderEdge; /* * Step across a small sample grid gap @@ -91,16 +76,16 @@ typedef struct { } \ } -xFixed +extern _X_EXPORT xFixed RenderSampleCeilY (xFixed y, int bpp); -xFixed +extern _X_EXPORT xFixed RenderSampleFloorY (xFixed y, int bpp); -void +extern _X_EXPORT void RenderEdgeStep (RenderEdge *e, int n); -void +extern _X_EXPORT void RenderEdgeInit (RenderEdge *e, int bpp, xFixed y_start, @@ -109,7 +94,7 @@ RenderEdgeInit (RenderEdge *e, xFixed x_bot, xFixed y_bot); -void +extern _X_EXPORT void RenderLineFixedEdgeInit (RenderEdge *e, int bpp, xFixed y, |