diff options
author | marha <marha@users.sourceforge.net> | 2009-09-09 05:23:48 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-09-09 05:23:48 +0000 |
commit | 81f91c615982e50bb62708201569c33a3cd3d973 (patch) | |
tree | 4f32ecc48a3b7b5e76642f3792338263c53879bd /xorg-server/render | |
parent | b571a562410f565af2bdde52d9f7f9a23ffae04f (diff) | |
parent | a915739887477b28d924ecc8417ee107d125bd6c (diff) | |
download | vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.tar.gz vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.tar.bz2 vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.zip |
svn merge https://vcxsrv.svn.sourceforge.net/svnroot/vcxsrv/branches/released .
Diffstat (limited to 'xorg-server/render')
-rw-r--r-- | xorg-server/render/Makefile.in | 35 | ||||
-rw-r--r-- | xorg-server/render/animcur.c | 13 | ||||
-rw-r--r-- | xorg-server/render/filter.c | 4 | ||||
-rw-r--r-- | xorg-server/render/glyph.c | 4 | ||||
-rw-r--r-- | xorg-server/render/glyphstr.h | 32 | ||||
-rw-r--r-- | xorg-server/render/matrix.c | 8 | ||||
-rw-r--r-- | xorg-server/render/mipict.c | 56 | ||||
-rw-r--r-- | xorg-server/render/mipict.h | 72 | ||||
-rw-r--r-- | xorg-server/render/mirect.c | 2 | ||||
-rw-r--r-- | xorg-server/render/picture.c | 60 | ||||
-rw-r--r-- | xorg-server/render/picture.h | 18 | ||||
-rw-r--r-- | xorg-server/render/picturestr.h | 123 | ||||
-rw-r--r-- | xorg-server/render/render.c | 203 | ||||
-rw-r--r-- | xorg-server/render/renderedge.c | 10 | ||||
-rw-r--r-- | xorg-server/render/renderedge.h | 10 |
15 files changed, 320 insertions, 330 deletions
diff --git a/xorg-server/render/Makefile.in b/xorg-server/render/Makefile.in index 59e271678..1a1c1eeca 100644 --- a/xorg-server/render/Makefile.in +++ b/xorg-server/render/Makefile.in @@ -39,8 +39,11 @@ 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)/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/shave.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -50,7 +53,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 = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) @@ -104,6 +108,7 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ +AM_MAKEFLAGS = @AM_MAKEFLAGS@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ @@ -124,9 +129,12 @@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CWARNFLAGS = @CWARNFLAGS@ +CXX = @CXX@ CYGPATH_W = @CYGPATH_W@ DARWIN_LIBS = @DARWIN_LIBS@ DBUS_CFLAGS = @DBUS_CFLAGS@ @@ -155,7 +163,9 @@ 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_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -164,9 +174,13 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FC = @FC@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ @@ -205,12 +219,13 @@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ +MAIN_LIB = @MAIN_LIB@ +MAKEFLAGS = @MAKEFLAGS@ 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@ MKDIR_P = @MKDIR_P@ @@ -230,7 +245,6 @@ 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@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ @@ -240,6 +254,7 @@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PROJECTROOT = @PROJECTROOT@ PS2PDF = @PS2PDF@ +Q = @Q@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ @@ -253,11 +268,10 @@ STRIP = @STRIP@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ -VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ -VENDOR_NAME = @VENDOR_NAME@ +V = @V@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ -VENDOR_RELEASE = @VENDOR_RELEASE@ VERSION = @VERSION@ +WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ @@ -293,6 +307,7 @@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ +XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ @@ -317,7 +332,6 @@ YFLAGS = @YFLAGS@ __XCONFIGFILE__ = @__XCONFIGFILE__@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ -abi_font = @abi_font@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ @@ -340,6 +354,7 @@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ +distcleancheck_listfiles = @distcleancheck_listfiles@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ @@ -371,7 +386,9 @@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ +shavedir = @shavedir@ srcdir = @srcdir@ +symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ diff --git a/xorg-server/render/animcur.c b/xorg-server/render/animcur.c index d80094d98..276e5e4af 100644 --- a/xorg-server/render/animcur.c +++ b/xorg-server/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/xorg-server/render/filter.c b/xorg-server/render/filter.c index 21eedca31..89cc0646a 100644 --- a/xorg-server/render/filter.c +++ b/xorg-server/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/xorg-server/render/glyph.c b/xorg-server/render/glyph.c index 87b332e2a..7c044aada 100644 --- a/xorg-server/render/glyph.c +++ b/xorg-server/render/glyph.c @@ -614,7 +614,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, @@ -645,7 +645,7 @@ miUnrealizeGlyph (ScreenPtr pScreen, { } -_X_EXPORT void +void miGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst, diff --git a/xorg-server/render/glyphstr.h b/xorg-server/render/glyphstr.h index 67b21fe63..6c1a837e0 100644 --- a/xorg-server/render/glyphstr.h +++ b/xorg-server/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/xorg-server/render/matrix.c b/xorg-server/render/matrix.c index 3b55eb989..eccb90270 100644 --- a/xorg-server/render/matrix.c +++ b/xorg-server/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/xorg-server/render/mipict.c b/xorg-server/render/mipict.c index 9836bd569..30dd2c80f 100644 --- a/xorg-server/render/mipict.c +++ b/xorg-server/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/xorg-server/render/mipict.h b/xorg-server/render/mipict.h index 60baf7f66..eb6b6645d 100644 --- a/xorg-server/render/mipict.h +++ b/xorg-server/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/xorg-server/render/mirect.c b/xorg-server/render/mirect.c index 38f4faf67..b54fe6fe6 100644 --- a/xorg-server/render/mirect.c +++ b/xorg-server/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/xorg-server/render/picture.c b/xorg-server/render/picture.c index 956738734..a3670778e 100644 --- a/xorg-server/render/picture.c +++ b/xorg-server/render/picture.c @@ -44,7 +44,7 @@ #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 +200,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++) @@ -233,6 +239,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); @@ -310,6 +322,19 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp) PICT_x8r8g8b8, pDepth->depth); nformats = addFormat (formats, nformats, PICT_x8b8g8r8, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_b8g8r8x8, 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 +391,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 +453,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 +500,7 @@ PictureFinishInit (void) return TRUE; } -_X_EXPORT Bool +Bool PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel) { PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); @@ -468,7 +512,7 @@ PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel) } -_X_EXPORT int +int PictureGetSubpixelOrder (ScreenPtr pScreen) { PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); @@ -568,7 +612,7 @@ PictureParseCmapPolicy (const char *name) return PictureCmapPolicyInvalid; } -_X_EXPORT Bool +Bool PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) { PictureScreenPtr ps; @@ -621,8 +665,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/xorg-server/render/picture.h b/xorg-server/render/picture.h index 045b29944..8bd38b98e 100644 --- a/xorg-server/render/picture.h +++ b/xorg-server/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/xorg-server/render/picturestr.h b/xorg-server/render/picturestr.h index 4d788fcfb..6a8d76d99 100644 --- a/xorg-server/render/picturestr.h +++ b/xorg-server/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/xorg-server/render/render.c b/xorg-server/render/render.c index e3d76d2c1..995ebd956 100644 --- a/xorg-server/render/render.c +++ b/xorg-server/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 @@ -268,6 +266,7 @@ 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; @@ -365,12 +364,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; @@ -510,7 +509,7 @@ static int ProcRenderQueryPictIndexValues (ClientPtr client) { PictFormatPtr pFormat; - int num; + int rc, num; int rlength; int i, n; REQUEST(xRenderQueryPictIndexValuesReq); @@ -519,16 +518,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; @@ -543,7 +537,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); @@ -593,18 +587,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; @@ -633,7 +623,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; @@ -691,6 +681,8 @@ PictOpValid (CARD8 op) return TRUE; if (PictOpConjointMinimum <= op && op <= PictOpConjointMaximum) return TRUE; + if (PictOpBlendMinimum <= op && op <= PictOpBlendMaximum) + return TRUE; return FALSE; } @@ -741,7 +733,7 @@ ProcRenderScale (ClientPtr client) static int ProcRenderTrapezoids (ClientPtr client) { - int ntraps; + int rc, ntraps; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrapezoidsReq); @@ -762,15 +754,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; @@ -788,7 +775,7 @@ ProcRenderTrapezoids (ClientPtr client) static int ProcRenderTriangles (ClientPtr client) { - int ntris; + int rc, ntris; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrianglesReq); @@ -809,15 +796,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; @@ -835,7 +817,7 @@ ProcRenderTriangles (ClientPtr client) static int ProcRenderTriStrip (ClientPtr client) { - int npoints; + int rc, npoints; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrianglesReq); @@ -856,15 +838,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; @@ -882,7 +859,7 @@ ProcRenderTriStrip (ClientPtr client) static int ProcRenderTriFan (ClientPtr client) { - int npoints; + int rc, npoints; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrianglesReq); @@ -903,15 +880,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; @@ -955,15 +927,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; @@ -1269,7 +1237,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) { @@ -1301,7 +1269,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) int nlist; int space; int size; - int n; + int rc, n; REQUEST(xRenderCompositeGlyphsReq); @@ -1328,28 +1296,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); @@ -1403,18 +1361,16 @@ ProcRenderCompositeGlyphs (ClientPtr client) if (buffer + sizeof (GlyphSet) < end) { memcpy(&gs, buffer, sizeof(GlyphSet)); - glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, - gs, - GlyphSetType, - DixUseAccess); - if (!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; @@ -1507,7 +1463,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; @@ -1678,8 +1634,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 { @@ -1687,9 +1643,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; @@ -1781,7 +1737,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) @@ -1873,7 +1829,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; @@ -1895,7 +1851,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; @@ -1903,13 +1859,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++; @@ -2690,11 +2645,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) {\ @@ -2714,12 +2668,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; diff --git a/xorg-server/render/renderedge.c b/xorg-server/render/renderedge.c index d0ee30716..8771fe164 100644 --- a/xorg-server/render/renderedge.c +++ b/xorg-server/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/xorg-server/render/renderedge.h b/xorg-server/render/renderedge.h index 644d9d9e5..6585aeb90 100644 --- a/xorg-server/render/renderedge.h +++ b/xorg-server/render/renderedge.h @@ -76,16 +76,16 @@ typedef pixman_edge_t RenderEdge; } \ } -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, @@ -94,7 +94,7 @@ RenderEdgeInit (RenderEdge *e, xFixed x_bot, xFixed y_bot); -void +extern _X_EXPORT void RenderLineFixedEdgeInit (RenderEdge *e, int bpp, xFixed y, |