2006-11-26 11:13:41 -07:00
|
|
|
/*
|
|
|
|
* Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation on the rights to use, copy, modify, merge,
|
|
|
|
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
|
|
* and to permit persons to whom the Software is furnished to do so,
|
|
|
|
* subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
* next paragraph) shall be included in all copies or substantial
|
|
|
|
* portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Authors:
|
|
|
|
* Kevin E. Martin <kem@redhat.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
* Provide support for the RENDER extension (version 0.8).
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_DMX_CONFIG_H
|
|
|
|
#include <dmx-config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "dmx.h"
|
|
|
|
#include "dmxsync.h"
|
|
|
|
#include "dmxpict.h"
|
|
|
|
#include "dmxwindow.h"
|
|
|
|
#include "dmxpixmap.h"
|
|
|
|
|
|
|
|
#include "fb.h"
|
|
|
|
#include "pixmapstr.h"
|
|
|
|
#include "dixstruct.h"
|
|
|
|
|
|
|
|
#include <X11/extensions/render.h>
|
|
|
|
#include <X11/extensions/renderproto.h>
|
2010-07-27 13:02:24 -06:00
|
|
|
#include <X11/extensions/Xfixes.h>
|
2006-11-26 11:13:41 -07:00
|
|
|
#include "picture.h"
|
|
|
|
#include "picturestr.h"
|
|
|
|
#include "mipict.h"
|
|
|
|
#include "fbpict.h"
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
extern int (*ProcRenderVector[RenderNumberRequests]) (ClientPtr);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static int (*dmxSaveRenderVector[RenderNumberRequests]) (ClientPtr);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
static int dmxProcRenderCreateGlyphSet(ClientPtr client);
|
|
|
|
static int dmxProcRenderFreeGlyphSet(ClientPtr client);
|
|
|
|
static int dmxProcRenderAddGlyphs(ClientPtr client);
|
|
|
|
static int dmxProcRenderFreeGlyphs(ClientPtr client);
|
|
|
|
static int dmxProcRenderCompositeGlyphs(ClientPtr client);
|
|
|
|
static int dmxProcRenderSetPictureTransform(ClientPtr client);
|
|
|
|
static int dmxProcRenderSetPictureFilter(ClientPtr client);
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
#if 0
|
|
|
|
/* FIXME: Not (yet) supported */
|
|
|
|
static int dmxProcRenderCreateCursor(ClientPtr client);
|
|
|
|
static int dmxProcRenderCreateAnimCursor(ClientPtr client);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** Catch errors that might occur when allocating Glyph Sets. Errors
|
|
|
|
* are saved in dmxGlyphLastError for later handling. */
|
|
|
|
static int dmxGlyphLastError;
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
dmxGlyphErrorHandler(Display * dpy, XErrorEvent * ev)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
dmxGlyphLastError = ev->error_code;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Initialize the Proc Vector for the RENDER extension. The functions
|
|
|
|
* here cannot be handled by the mi layer RENDER hooks either because
|
|
|
|
* the required information is no longer available when it reaches the
|
|
|
|
* mi layer or no mi layer hooks exist. This function is called from
|
|
|
|
* InitOutput() since it should be initialized only once per server
|
|
|
|
* generation. */
|
2012-06-10 07:21:05 -06:00
|
|
|
void
|
|
|
|
dmxInitRender(void)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < RenderNumberRequests; i++)
|
|
|
|
dmxSaveRenderVector[i] = ProcRenderVector[i];
|
|
|
|
|
|
|
|
ProcRenderVector[X_RenderCreateGlyphSet]
|
2012-06-10 07:21:05 -06:00
|
|
|
= dmxProcRenderCreateGlyphSet;
|
2006-11-26 11:13:41 -07:00
|
|
|
ProcRenderVector[X_RenderFreeGlyphSet]
|
2012-06-10 07:21:05 -06:00
|
|
|
= dmxProcRenderFreeGlyphSet;
|
2006-11-26 11:13:41 -07:00
|
|
|
ProcRenderVector[X_RenderAddGlyphs]
|
2012-06-10 07:21:05 -06:00
|
|
|
= dmxProcRenderAddGlyphs;
|
2006-11-26 11:13:41 -07:00
|
|
|
ProcRenderVector[X_RenderFreeGlyphs]
|
2012-06-10 07:21:05 -06:00
|
|
|
= dmxProcRenderFreeGlyphs;
|
2006-11-26 11:13:41 -07:00
|
|
|
ProcRenderVector[X_RenderCompositeGlyphs8]
|
2012-06-10 07:21:05 -06:00
|
|
|
= dmxProcRenderCompositeGlyphs;
|
2006-11-26 11:13:41 -07:00
|
|
|
ProcRenderVector[X_RenderCompositeGlyphs16]
|
2012-06-10 07:21:05 -06:00
|
|
|
= dmxProcRenderCompositeGlyphs;
|
2006-11-26 11:13:41 -07:00
|
|
|
ProcRenderVector[X_RenderCompositeGlyphs32]
|
2012-06-10 07:21:05 -06:00
|
|
|
= dmxProcRenderCompositeGlyphs;
|
2006-11-26 11:13:41 -07:00
|
|
|
ProcRenderVector[X_RenderSetPictureTransform]
|
2012-06-10 07:21:05 -06:00
|
|
|
= dmxProcRenderSetPictureTransform;
|
2006-11-26 11:13:41 -07:00
|
|
|
ProcRenderVector[X_RenderSetPictureFilter]
|
2012-06-10 07:21:05 -06:00
|
|
|
= dmxProcRenderSetPictureFilter;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Reset the Proc Vector for the RENDER extension back to the original
|
|
|
|
* functions. This function is called from dmxCloseScreen() during the
|
|
|
|
* server reset (only for screen #0). */
|
2012-06-10 07:21:05 -06:00
|
|
|
void
|
|
|
|
dmxResetRender(void)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < RenderNumberRequests; i++)
|
|
|
|
ProcRenderVector[i] = dmxSaveRenderVector[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Initialize the RENDER extension, allocate the picture privates and
|
|
|
|
* wrap mi function hooks. If the shadow frame buffer is used, then
|
|
|
|
* call the appropriate fb initialization function. */
|
2012-06-10 07:21:05 -06:00
|
|
|
Bool
|
|
|
|
dmxPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
|
|
|
PictureScreenPtr ps;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (!miPictureInit(pScreen, formats, nformats))
|
2012-06-10 07:21:05 -06:00
|
|
|
return FALSE;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!dixRegisterPrivateKey
|
|
|
|
(&dmxPictPrivateKeyRec, PRIVATE_PICTURE, sizeof(dmxPictPrivRec)))
|
|
|
|
return FALSE;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
ps = GetPictureScreen(pScreen);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps);
|
|
|
|
DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps);
|
2006-11-26 11:13:41 -07:00
|
|
|
DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps);
|
|
|
|
DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
DMX_WRAP(Composite, dmxComposite, dmxScreen, ps);
|
|
|
|
DMX_WRAP(Glyphs, dmxGlyphs, dmxScreen, ps);
|
|
|
|
DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps);
|
|
|
|
DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Find the appropriate format on the requested screen given the
|
|
|
|
* internal format requested. The list of formats is searched
|
|
|
|
* sequentially as the XRenderFindFormat() function does not always
|
|
|
|
* find the appropriate format when a specific format is requested. */
|
2012-06-10 07:21:05 -06:00
|
|
|
static XRenderPictFormat *
|
|
|
|
dmxFindFormat(DMXScreenInfo * dmxScreen, PictFormatPtr pFmt)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
XRenderPictFormat *pFormat = NULL;
|
2012-06-10 07:21:05 -06:00
|
|
|
int i = 0;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!pFmt || !dmxScreen->beDisplay)
|
|
|
|
return pFormat;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
while (1) {
|
2012-06-10 07:21:05 -06:00
|
|
|
pFormat = XRenderFindFormat(dmxScreen->beDisplay, 0, 0, i++);
|
|
|
|
if (!pFormat)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (pFormat->type != pFmt->type)
|
|
|
|
continue;
|
|
|
|
if (pFormat->depth != pFmt->depth)
|
|
|
|
continue;
|
|
|
|
if (pFormat->direct.red != pFmt->direct.red)
|
|
|
|
continue;
|
|
|
|
if (pFormat->direct.redMask != pFmt->direct.redMask)
|
|
|
|
continue;
|
|
|
|
if (pFormat->direct.green != pFmt->direct.green)
|
|
|
|
continue;
|
|
|
|
if (pFormat->direct.greenMask != pFmt->direct.greenMask)
|
|
|
|
continue;
|
|
|
|
if (pFormat->direct.blue != pFmt->direct.blue)
|
|
|
|
continue;
|
|
|
|
if (pFormat->direct.blueMask != pFmt->direct.blueMask)
|
|
|
|
continue;
|
|
|
|
if (pFormat->direct.alpha != pFmt->direct.alpha)
|
|
|
|
continue;
|
|
|
|
if (pFormat->direct.alphaMask != pFmt->direct.alphaMask)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* We have a match! */
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return pFormat;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Free \a glyphSet on back-end screen number \a idx. */
|
2012-06-10 07:21:05 -06:00
|
|
|
Bool
|
|
|
|
dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
|
|
|
|
int idx = pScreen->myNum;
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (glyphPriv->glyphSets[idx]) {
|
2012-06-10 07:21:05 -06:00
|
|
|
XRenderFreeGlyphSet(dmxScreen->beDisplay, glyphPriv->glyphSets[idx]);
|
|
|
|
glyphPriv->glyphSets[idx] = (GlyphSet) 0;
|
|
|
|
return TRUE;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2007-03-03 04:09:19 -07:00
|
|
|
/** Create \a glyphSet on the backend screen number \a idx. */
|
2012-06-10 07:21:05 -06:00
|
|
|
int
|
|
|
|
dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet)
|
2007-03-03 04:09:19 -07:00
|
|
|
{
|
|
|
|
XRenderPictFormat *pFormat;
|
2012-06-10 07:21:05 -06:00
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
|
|
|
|
dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
|
|
|
|
PictFormatPtr pFmt = glyphSet->format;
|
|
|
|
int (*oldErrorHandler) (Display *, XErrorEvent *);
|
2007-03-03 04:09:19 -07:00
|
|
|
|
|
|
|
pFormat = dmxFindFormat(dmxScreen, pFmt);
|
|
|
|
if (!pFormat) {
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadMatch;
|
2007-03-03 04:09:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
dmxGlyphLastError = 0;
|
|
|
|
oldErrorHandler = XSetErrorHandler(dmxGlyphErrorHandler);
|
|
|
|
|
|
|
|
/* Catch when this fails */
|
|
|
|
glyphPriv->glyphSets[idx]
|
2012-06-10 07:21:05 -06:00
|
|
|
= XRenderCreateGlyphSet(dmxScreen->beDisplay, pFormat);
|
2007-03-03 04:09:19 -07:00
|
|
|
|
|
|
|
XSetErrorHandler(oldErrorHandler);
|
|
|
|
|
|
|
|
if (dmxGlyphLastError) {
|
2012-06-10 07:21:05 -06:00
|
|
|
return dmxGlyphLastError;
|
2007-03-03 04:09:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
/** Create a Glyph Set on each screen. Save the glyphset ID from each
|
|
|
|
* screen in the Glyph Set's private structure. Fail if the format
|
|
|
|
* requested is not available or if the Glyph Set cannot be created on
|
|
|
|
* the screen. */
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
dmxProcRenderCreateGlyphSet(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
int ret;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xRenderCreateGlyphSetReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
ret = dmxSaveRenderVector[stuff->renderReqType] (client);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (ret == Success) {
|
2012-06-10 07:21:05 -06:00
|
|
|
GlyphSetPtr glyphSet;
|
|
|
|
dmxGlyphPrivPtr glyphPriv;
|
|
|
|
int i;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
/* Look up glyphSet that was just created ???? */
|
|
|
|
/* Store glyphsets from backends in glyphSet->devPrivate ????? */
|
|
|
|
/* Make sure we handle all errors here!! */
|
2011-11-05 07:32:40 -06:00
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
dixLookupResourceByType((void **) &glyphSet,
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->gsid, GlyphSetType,
|
|
|
|
client, DixDestroyAccess);
|
2011-11-05 07:32:40 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
glyphPriv = malloc(sizeof(dmxGlyphPrivRec));
|
|
|
|
if (!glyphPriv)
|
|
|
|
return BadAlloc;
|
2006-11-26 11:13:41 -07:00
|
|
|
glyphPriv->glyphSets = NULL;
|
|
|
|
MAXSCREENSALLOC_RETURN(glyphPriv->glyphSets, BadAlloc);
|
2012-06-10 07:21:05 -06:00
|
|
|
DMX_SET_GLYPH_PRIV(glyphSet, glyphPriv);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
for (i = 0; i < dmxNumScreens; i++) {
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[i];
|
|
|
|
int beret;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!dmxScreen->beDisplay) {
|
|
|
|
glyphPriv->glyphSets[i] = 0;
|
|
|
|
continue;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if ((beret = dmxBECreateGlyphSet(i, glyphSet)) != Success) {
|
|
|
|
int j;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
/* Free the glyph sets we've allocated thus far */
|
|
|
|
for (j = 0; j < i; j++)
|
|
|
|
dmxBEFreeGlyphSet(screenInfo.screens[j], glyphSet);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
/* Free the resource created by render */
|
|
|
|
FreeResource(stuff->gsid, RT_NONE);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
return beret;
|
|
|
|
}
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Free the previously allocated Glyph Sets for each screen. */
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
dmxProcRenderFreeGlyphSet(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
GlyphSetPtr glyphSet;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xRenderFreeGlyphSetReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
|
2014-09-27 11:52:59 -06:00
|
|
|
dixLookupResourceByType((void **) &glyphSet,
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->glyphset, GlyphSetType,
|
|
|
|
client, DixDestroyAccess);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (glyphSet && glyphSet->refcnt == 1) {
|
2012-06-10 07:21:05 -06:00
|
|
|
dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < dmxNumScreens; i++) {
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[i];
|
|
|
|
|
|
|
|
if (dmxScreen->beDisplay) {
|
|
|
|
if (dmxBEFreeGlyphSet(screenInfo.screens[i], glyphSet))
|
|
|
|
dmxSync(dmxScreen, FALSE);
|
|
|
|
}
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
MAXSCREENSFREE(glyphPriv->glyphSets);
|
2012-06-10 07:21:05 -06:00
|
|
|
free(glyphPriv);
|
|
|
|
DMX_SET_GLYPH_PRIV(glyphSet, NULL);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
return dmxSaveRenderVector[stuff->renderReqType] (client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Add glyphs to the Glyph Set on each screen. */
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
dmxProcRenderAddGlyphs(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
int ret;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xRenderAddGlyphsReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
ret = dmxSaveRenderVector[stuff->renderReqType] (client);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (ret == Success) {
|
2012-06-10 07:21:05 -06:00
|
|
|
GlyphSetPtr glyphSet;
|
|
|
|
dmxGlyphPrivPtr glyphPriv;
|
|
|
|
int i;
|
|
|
|
int nglyphs;
|
|
|
|
CARD32 *gids;
|
|
|
|
Glyph *gidsCopy;
|
|
|
|
xGlyphInfo *gi;
|
|
|
|
CARD8 *bits;
|
|
|
|
int nbytes;
|
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
dixLookupResourceByType((void **) &glyphSet,
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->glyphset, GlyphSetType,
|
|
|
|
client, DixReadAccess);
|
|
|
|
glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
|
|
|
|
|
|
|
|
nglyphs = stuff->nglyphs;
|
|
|
|
gids = (CARD32 *) (stuff + 1);
|
|
|
|
gi = (xGlyphInfo *) (gids + nglyphs);
|
|
|
|
bits = (CARD8 *) (gi + nglyphs);
|
|
|
|
nbytes = ((stuff->length << 2) -
|
|
|
|
sizeof(xRenderAddGlyphsReq) -
|
|
|
|
(sizeof(CARD32) + sizeof(xGlyphInfo)) * nglyphs);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
gidsCopy = malloc(sizeof(*gidsCopy) * nglyphs);
|
2012-06-10 07:21:05 -06:00
|
|
|
for (i = 0; i < nglyphs; i++)
|
|
|
|
gidsCopy[i] = gids[i];
|
|
|
|
|
|
|
|
/* FIXME: Will this ever fail? */
|
|
|
|
for (i = 0; i < dmxNumScreens; i++) {
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[i];
|
|
|
|
|
|
|
|
if (dmxScreen->beDisplay) {
|
|
|
|
XRenderAddGlyphs(dmxScreen->beDisplay,
|
|
|
|
glyphPriv->glyphSets[i],
|
|
|
|
gidsCopy,
|
|
|
|
(XGlyphInfo *) gi,
|
|
|
|
nglyphs, (char *) bits, nbytes);
|
|
|
|
dmxSync(dmxScreen, FALSE);
|
|
|
|
}
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
free(gidsCopy);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Free glyphs from the Glyph Set for each screen. */
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
dmxProcRenderFreeGlyphs(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
GlyphSetPtr glyphSet;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xRenderFreeGlyphsReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
|
2014-09-27 11:52:59 -06:00
|
|
|
dixLookupResourceByType((void **) &glyphSet,
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->glyphset, GlyphSetType,
|
|
|
|
client, DixWriteAccess);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (glyphSet) {
|
2012-06-10 07:21:05 -06:00
|
|
|
dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
|
|
|
|
int i;
|
|
|
|
int nglyphs;
|
|
|
|
Glyph *gids;
|
|
|
|
|
|
|
|
nglyphs = ((client->req_len << 2) - sizeof(xRenderFreeGlyphsReq)) >> 2;
|
|
|
|
if (nglyphs) {
|
|
|
|
gids = malloc(sizeof(*gids) * nglyphs);
|
2006-11-26 11:13:41 -07:00
|
|
|
for (i = 0; i < nglyphs; i++)
|
2012-06-10 07:21:05 -06:00
|
|
|
gids[i] = ((CARD32 *) (stuff + 1))[i];
|
|
|
|
|
|
|
|
for (i = 0; i < dmxNumScreens; i++) {
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[i];
|
|
|
|
|
|
|
|
if (dmxScreen->beDisplay) {
|
|
|
|
XRenderFreeGlyphs(dmxScreen->beDisplay,
|
|
|
|
glyphPriv->glyphSets[i], gids, nglyphs);
|
|
|
|
dmxSync(dmxScreen, FALSE);
|
|
|
|
}
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
free(gids);
|
2012-06-10 07:21:05 -06:00
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
return dmxSaveRenderVector[stuff->renderReqType] (client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Composite glyphs on each screen into the requested picture. If
|
|
|
|
* either the src or dest picture has not been allocated due to lazy
|
|
|
|
* window creation, this request will gracefully return. */
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
dmxProcRenderCompositeGlyphs(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
int ret;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xRenderCompositeGlyphsReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
ret = dmxSaveRenderVector[stuff->renderReqType] (client);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
/* For the following to work with PanoramiX, it assumes that Render
|
|
|
|
* wraps the ProcRenderVector after dmxRenderInit has been called.
|
|
|
|
*/
|
|
|
|
if (ret == Success) {
|
2012-06-10 07:21:05 -06:00
|
|
|
PicturePtr pSrc;
|
|
|
|
dmxPictPrivPtr pSrcPriv;
|
|
|
|
PicturePtr pDst;
|
|
|
|
dmxPictPrivPtr pDstPriv;
|
|
|
|
PictFormatPtr pFmt;
|
|
|
|
XRenderPictFormat *pFormat;
|
|
|
|
int size;
|
|
|
|
|
|
|
|
int scrnNum;
|
|
|
|
DMXScreenInfo *dmxScreen;
|
|
|
|
|
|
|
|
CARD8 *buffer;
|
|
|
|
CARD8 *end;
|
|
|
|
int space;
|
|
|
|
|
|
|
|
int nglyph;
|
|
|
|
char *glyphs;
|
|
|
|
char *curGlyph;
|
|
|
|
|
|
|
|
xGlyphElt *elt;
|
|
|
|
int nelt;
|
|
|
|
XGlyphElt8 *elts;
|
|
|
|
XGlyphElt8 *curElt;
|
|
|
|
|
|
|
|
GlyphSetPtr glyphSet;
|
|
|
|
dmxGlyphPrivPtr glyphPriv;
|
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
dixLookupResourceByType((void **) &pSrc,
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->src, PictureType, client, DixReadAccess);
|
|
|
|
|
|
|
|
pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
|
|
|
|
if (!pSrcPriv->pict)
|
|
|
|
return ret;
|
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
dixLookupResourceByType((void **) &pDst,
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->dst, PictureType,
|
|
|
|
client, DixWriteAccess);
|
|
|
|
|
|
|
|
pDstPriv = DMX_GET_PICT_PRIV(pDst);
|
|
|
|
if (!pDstPriv->pict)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
scrnNum = pDst->pDrawable->pScreen->myNum;
|
|
|
|
dmxScreen = &dmxScreens[scrnNum];
|
|
|
|
|
|
|
|
/* Note: If the back-end display has been detached, then it
|
|
|
|
* should not be possible to reach here since the pSrcPriv->pict
|
|
|
|
* and pDstPriv->pict will have already been set to 0.
|
|
|
|
*/
|
|
|
|
if (!dmxScreen->beDisplay)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
if (stuff->maskFormat)
|
2014-09-27 11:52:59 -06:00
|
|
|
dixLookupResourceByType((void **) &pFmt,
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->maskFormat, PictFormatType,
|
|
|
|
client, DixReadAccess);
|
|
|
|
else
|
|
|
|
pFmt = NULL;
|
|
|
|
|
|
|
|
pFormat = dmxFindFormat(dmxScreen, pFmt);
|
|
|
|
|
|
|
|
switch (stuff->renderReqType) {
|
|
|
|
case X_RenderCompositeGlyphs8:
|
|
|
|
size = sizeof(CARD8);
|
|
|
|
break;
|
|
|
|
case X_RenderCompositeGlyphs16:
|
|
|
|
size = sizeof(CARD16);
|
|
|
|
break;
|
|
|
|
case X_RenderCompositeGlyphs32:
|
|
|
|
size = sizeof(CARD32);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return BadPictOp; /* Can't happen */
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer = (CARD8 *) (stuff + 1);
|
|
|
|
end = (CARD8 *) stuff + (stuff->length << 2);
|
|
|
|
nelt = 0;
|
|
|
|
nglyph = 0;
|
|
|
|
while (buffer + sizeof(xGlyphElt) < end) {
|
|
|
|
elt = (xGlyphElt *) buffer;
|
|
|
|
buffer += sizeof(xGlyphElt);
|
|
|
|
|
|
|
|
if (elt->len == 0xff) {
|
|
|
|
buffer += 4;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
nelt++;
|
|
|
|
nglyph += elt->len;
|
|
|
|
space = size * elt->len;
|
|
|
|
if (space & 3)
|
|
|
|
space += 4 - (space & 3);
|
|
|
|
buffer += space;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The following only works for Render version > 0.2 */
|
|
|
|
|
|
|
|
/* All of the XGlyphElt* structure sizes are identical */
|
|
|
|
elts = malloc(nelt * sizeof(XGlyphElt8));
|
|
|
|
if (!elts)
|
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
glyphs = malloc(nglyph * size);
|
|
|
|
if (!glyphs) {
|
|
|
|
free(elts);
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer = (CARD8 *) (stuff + 1);
|
|
|
|
end = (CARD8 *) stuff + (stuff->length << 2);
|
|
|
|
curGlyph = glyphs;
|
|
|
|
curElt = elts;
|
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
dixLookupResourceByType((void **) &glyphSet,
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->glyphset, GlyphSetType,
|
|
|
|
client, DixReadAccess);
|
|
|
|
glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
|
|
|
|
|
|
|
|
while (buffer + sizeof(xGlyphElt) < end) {
|
|
|
|
elt = (xGlyphElt *) buffer;
|
|
|
|
buffer += sizeof(xGlyphElt);
|
|
|
|
|
|
|
|
if (elt->len == 0xff) {
|
2014-09-27 11:52:59 -06:00
|
|
|
dixLookupResourceByType((void **) &glyphSet,
|
2012-06-10 07:21:05 -06:00
|
|
|
*((CARD32 *) buffer),
|
|
|
|
GlyphSetType, client, DixReadAccess);
|
|
|
|
glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
|
|
|
|
buffer += 4;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
curElt->glyphset = glyphPriv->glyphSets[scrnNum];
|
|
|
|
curElt->xOff = elt->deltax;
|
|
|
|
curElt->yOff = elt->deltay;
|
|
|
|
curElt->nchars = elt->len;
|
|
|
|
curElt->chars = curGlyph;
|
|
|
|
|
|
|
|
memcpy(curGlyph, buffer, size * elt->len);
|
|
|
|
curGlyph += size * elt->len;
|
|
|
|
|
|
|
|
curElt++;
|
|
|
|
|
|
|
|
space = size * elt->len;
|
|
|
|
if (space & 3)
|
|
|
|
space += 4 - (space & 3);
|
|
|
|
buffer += space;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (stuff->renderReqType) {
|
|
|
|
case X_RenderCompositeGlyphs8:
|
|
|
|
XRenderCompositeText8(dmxScreen->beDisplay, stuff->op,
|
|
|
|
pSrcPriv->pict, pDstPriv->pict,
|
|
|
|
pFormat,
|
|
|
|
stuff->xSrc, stuff->ySrc, 0, 0, elts, nelt);
|
|
|
|
break;
|
|
|
|
case X_RenderCompositeGlyphs16:
|
|
|
|
XRenderCompositeText16(dmxScreen->beDisplay, stuff->op,
|
|
|
|
pSrcPriv->pict, pDstPriv->pict,
|
|
|
|
pFormat,
|
|
|
|
stuff->xSrc, stuff->ySrc,
|
|
|
|
0, 0, (XGlyphElt16 *) elts, nelt);
|
|
|
|
break;
|
|
|
|
case X_RenderCompositeGlyphs32:
|
|
|
|
XRenderCompositeText32(dmxScreen->beDisplay, stuff->op,
|
|
|
|
pSrcPriv->pict, pDstPriv->pict,
|
|
|
|
pFormat,
|
|
|
|
stuff->xSrc, stuff->ySrc,
|
|
|
|
0, 0, (XGlyphElt32 *) elts, nelt);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
dmxSync(dmxScreen, FALSE);
|
|
|
|
|
|
|
|
free(elts);
|
|
|
|
free(glyphs);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Set the picture transform on each screen. */
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
dmxProcRenderSetPictureTransform(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
DMXScreenInfo *dmxScreen;
|
|
|
|
PicturePtr pPicture;
|
|
|
|
dmxPictPrivPtr pPictPriv;
|
|
|
|
XTransform xform;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xRenderSetPictureTransformReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
|
2010-12-05 08:36:02 -07:00
|
|
|
VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
/* For the following to work with PanoramiX, it assumes that Render
|
|
|
|
* wraps the ProcRenderVector after dmxRenderInit has been called.
|
|
|
|
*/
|
|
|
|
dmxScreen = &dmxScreens[pPicture->pDrawable->pScreen->myNum];
|
|
|
|
pPictPriv = DMX_GET_PICT_PRIV(pPicture);
|
|
|
|
|
|
|
|
if (pPictPriv->pict) {
|
2012-06-10 07:21:05 -06:00
|
|
|
xform.matrix[0][0] = stuff->transform.matrix11;
|
|
|
|
xform.matrix[0][1] = stuff->transform.matrix12;
|
|
|
|
xform.matrix[0][2] = stuff->transform.matrix13;
|
|
|
|
xform.matrix[1][0] = stuff->transform.matrix21;
|
|
|
|
xform.matrix[1][1] = stuff->transform.matrix22;
|
|
|
|
xform.matrix[1][2] = stuff->transform.matrix23;
|
|
|
|
xform.matrix[2][0] = stuff->transform.matrix31;
|
|
|
|
xform.matrix[2][1] = stuff->transform.matrix32;
|
|
|
|
xform.matrix[2][2] = stuff->transform.matrix33;
|
|
|
|
|
|
|
|
XRenderSetPictureTransform(dmxScreen->beDisplay,
|
|
|
|
pPictPriv->pict, &xform);
|
|
|
|
dmxSync(dmxScreen, FALSE);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
return dmxSaveRenderVector[stuff->renderReqType] (client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Set the picture filter on each screen. */
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
dmxProcRenderSetPictureFilter(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
DMXScreenInfo *dmxScreen;
|
|
|
|
PicturePtr pPicture;
|
|
|
|
dmxPictPrivPtr pPictPriv;
|
|
|
|
char *filter;
|
|
|
|
XFixed *params;
|
|
|
|
int nparams;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xRenderSetPictureFilterReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
|
2010-12-05 08:36:02 -07:00
|
|
|
VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
/* For the following to work with PanoramiX, it assumes that Render
|
|
|
|
* wraps the ProcRenderVector after dmxRenderInit has been called.
|
|
|
|
*/
|
|
|
|
dmxScreen = &dmxScreens[pPicture->pDrawable->pScreen->myNum];
|
|
|
|
pPictPriv = DMX_GET_PICT_PRIV(pPicture);
|
|
|
|
|
|
|
|
if (pPictPriv->pict) {
|
2012-06-10 07:21:05 -06:00
|
|
|
filter = (char *) (stuff + 1);
|
|
|
|
params = (XFixed *) (filter + ((stuff->nbytes + 3) & ~3));
|
|
|
|
nparams = ((XFixed *) stuff + client->req_len) - params;
|
|
|
|
|
|
|
|
XRenderSetPictureFilter(dmxScreen->beDisplay,
|
|
|
|
pPictPriv->pict, filter, params, nparams);
|
|
|
|
dmxSync(dmxScreen, FALSE);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
return dmxSaveRenderVector[stuff->renderReqType] (client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Create a picture on the appropriate screen. This is the actual
|
|
|
|
* function that creates the picture. However, if the associated
|
|
|
|
* window has not yet been created due to lazy window creation, then
|
|
|
|
* delay the picture creation until the window is mapped. */
|
2012-06-10 07:21:05 -06:00
|
|
|
static Picture
|
|
|
|
dmxDoCreatePicture(PicturePtr pPicture)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
DrawablePtr pDraw = pPicture->pDrawable;
|
|
|
|
ScreenPtr pScreen = pDraw->pScreen;
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
|
|
|
XRenderPictFormat *pFormat;
|
|
|
|
Drawable draw;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (pPicture->pDrawable->type == DRAWABLE_WINDOW) {
|
2012-06-10 07:21:05 -06:00
|
|
|
dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV((WindowPtr) (pDraw));
|
|
|
|
|
|
|
|
if (!(draw = pWinPriv->window)) {
|
|
|
|
/* Window has not been created yet due to the window
|
|
|
|
* optimization. Delay picture creation until window is
|
|
|
|
* mapped.
|
|
|
|
*/
|
|
|
|
pWinPriv->hasPict = TRUE;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV((PixmapPtr) (pDraw));
|
|
|
|
|
|
|
|
if (!(draw = pPixPriv->pixmap)) {
|
|
|
|
/* FIXME: Zero width/height pixmap?? */
|
|
|
|
return 0;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This should not be reached if the back-end display has been
|
|
|
|
* detached because the pWinPriv->window or the pPixPriv->pixmap
|
|
|
|
* will be NULL; however, we add it here for completeness
|
|
|
|
*/
|
|
|
|
if (!dmxScreen->beDisplay)
|
2012-06-10 07:21:05 -06:00
|
|
|
return 0;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
pFormat = dmxFindFormat(dmxScreen, pPicture->pFormat);
|
|
|
|
|
|
|
|
return XRenderCreatePicture(dmxScreen->beDisplay, draw, pFormat, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Create a list of pictures. This function is called by
|
|
|
|
* dmxCreateAndRealizeWindow() during the lazy window creation
|
|
|
|
* realization process. It creates the entire list of pictures that
|
|
|
|
* are associated with the given window. */
|
2012-06-10 07:21:05 -06:00
|
|
|
void
|
|
|
|
dmxCreatePictureList(WindowPtr pWindow)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
PicturePtr pPicture = GetPictureWindow(pWindow);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
while (pPicture) {
|
2012-06-10 07:21:05 -06:00
|
|
|
dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
/* Create the picture for this window */
|
|
|
|
pPictPriv->pict = dmxDoCreatePicture(pPicture);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
/* ValidatePicture takes care of the state changes */
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
pPicture = pPicture->pNext;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-03 04:09:19 -07:00
|
|
|
/** Create \a pPicture on the backend. */
|
2012-06-10 07:21:05 -06:00
|
|
|
int
|
|
|
|
dmxBECreatePicture(PicturePtr pPicture)
|
2007-03-03 04:09:19 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
|
2007-03-03 04:09:19 -07:00
|
|
|
|
|
|
|
/* Create picutre on BE */
|
|
|
|
pPictPriv->pict = dmxDoCreatePicture(pPicture);
|
|
|
|
|
|
|
|
/* Flush changes to the backend server */
|
2012-06-10 07:21:05 -06:00
|
|
|
dmxValidatePicture(pPicture, (1 << (CPLastBit + 1)) - 1);
|
2007-03-03 04:09:19 -07:00
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
/** Create a picture. This function handles the CreatePicture
|
|
|
|
* unwrapping/wrapping and calls dmxDoCreatePicture to actually create
|
|
|
|
* the picture on the appropriate screen. */
|
2012-06-10 07:21:05 -06:00
|
|
|
int
|
|
|
|
dmxCreatePicture(PicturePtr pPicture)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
|
|
|
dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
|
|
|
|
int ret = Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
DMX_UNWRAP(CreatePicture, dmxScreen, ps);
|
|
|
|
#if 1
|
|
|
|
if (ps->CreatePicture)
|
2012-06-10 07:21:05 -06:00
|
|
|
ret = ps->CreatePicture(pPicture);
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Create picture on back-end server */
|
2012-06-10 07:21:05 -06:00
|
|
|
pPictPriv->pict = dmxDoCreatePicture(pPicture);
|
2006-11-26 11:13:41 -07:00
|
|
|
pPictPriv->savedMask = 0;
|
|
|
|
|
|
|
|
DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Destroy \a pPicture on the back-end server. */
|
2012-06-10 07:21:05 -06:00
|
|
|
Bool
|
|
|
|
dmxBEFreePicture(PicturePtr pPicture)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
|
2006-11-26 11:13:41 -07:00
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
|
|
|
dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
|
|
|
|
|
|
|
|
if (pPictPriv->pict) {
|
2012-06-10 07:21:05 -06:00
|
|
|
XRenderFreePicture(dmxScreen->beDisplay, pPictPriv->pict);
|
|
|
|
pPictPriv->pict = (Picture) 0;
|
|
|
|
return TRUE;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Destroy a list of pictures that are associated with the window that
|
|
|
|
* is being destroyed. This function is called by #dmxDestroyWindow().
|
|
|
|
* */
|
2012-06-10 07:21:05 -06:00
|
|
|
Bool
|
|
|
|
dmxDestroyPictureList(WindowPtr pWindow)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
PicturePtr pPicture = GetPictureWindow(pWindow);
|
|
|
|
Bool ret = FALSE;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
while (pPicture) {
|
2012-06-10 07:21:05 -06:00
|
|
|
ret |= dmxBEFreePicture(pPicture);
|
|
|
|
pPicture = pPicture->pNext;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Destroy a picture. This function calls the wrapped function that
|
|
|
|
* frees the resources in the DMX server associated with this
|
|
|
|
* picture. */
|
2012-06-10 07:21:05 -06:00
|
|
|
void
|
|
|
|
dmxDestroyPicture(PicturePtr pPicture)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
DMX_UNWRAP(DestroyPicture, dmxScreen, ps);
|
|
|
|
|
|
|
|
/* Destroy picture on back-end server */
|
|
|
|
if (dmxBEFreePicture(pPicture))
|
2012-06-10 07:21:05 -06:00
|
|
|
dmxSync(dmxScreen, FALSE);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
#if 1
|
|
|
|
if (ps->DestroyPicture)
|
2012-06-10 07:21:05 -06:00
|
|
|
ps->DestroyPicture(pPicture);
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
|
|
|
DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Change the picture's list of clip rectangles. */
|
2012-06-10 07:21:05 -06:00
|
|
|
int
|
2014-09-27 11:52:59 -06:00
|
|
|
dmxChangePictureClip(PicturePtr pPicture, int clipType, void *value, int n)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
|
|
|
dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
DMX_UNWRAP(ChangePictureClip, dmxScreen, ps);
|
|
|
|
#if 1
|
|
|
|
if (ps->ChangePictureClip)
|
2012-06-10 07:21:05 -06:00
|
|
|
ps->ChangePictureClip(pPicture, clipType, value, n);
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Change picture clip rects on back-end server */
|
|
|
|
if (pPictPriv->pict) {
|
2012-06-10 07:21:05 -06:00
|
|
|
/* The clip has already been changed into a region by the mi
|
|
|
|
* routine called above.
|
|
|
|
*/
|
|
|
|
if (clipType == CT_NONE) {
|
|
|
|
/* Disable clipping, show all */
|
|
|
|
XFixesSetPictureClipRegion(dmxScreen->beDisplay,
|
|
|
|
pPictPriv->pict, 0, 0, None);
|
|
|
|
}
|
|
|
|
else if (pPicture->clientClip) {
|
|
|
|
RegionPtr pClip = pPicture->clientClip;
|
|
|
|
BoxPtr pBox = RegionRects(pClip);
|
|
|
|
int nBox = RegionNumRects(pClip);
|
|
|
|
XRectangle *pRects;
|
|
|
|
XRectangle *pRect;
|
|
|
|
int nRects;
|
|
|
|
|
|
|
|
nRects = nBox;
|
|
|
|
pRects = pRect = malloc(nRects * sizeof(*pRect));
|
|
|
|
|
|
|
|
while (nBox--) {
|
|
|
|
pRect->x = pBox->x1;
|
|
|
|
pRect->y = pBox->y1;
|
|
|
|
pRect->width = pBox->x2 - pBox->x1;
|
|
|
|
pRect->height = pBox->y2 - pBox->y1;
|
|
|
|
pBox++;
|
|
|
|
pRect++;
|
|
|
|
}
|
|
|
|
|
|
|
|
XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
|
|
|
|
pPictPriv->pict,
|
|
|
|
0, 0, pRects, nRects);
|
|
|
|
free(pRects);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
|
|
|
|
pPictPriv->pict, 0, 0, NULL, 0);
|
|
|
|
}
|
|
|
|
dmxSync(dmxScreen, FALSE);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* FIXME: Handle saving clip region when offscreen */
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps);
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Destroy the picture's list of clip rectangles. */
|
2012-06-10 07:21:05 -06:00
|
|
|
void
|
|
|
|
dmxDestroyPictureClip(PicturePtr pPicture)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
|
|
|
dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
DMX_UNWRAP(DestroyPictureClip, dmxScreen, ps);
|
|
|
|
#if 1
|
|
|
|
if (ps->DestroyPictureClip)
|
2012-06-10 07:21:05 -06:00
|
|
|
ps->DestroyPictureClip(pPicture);
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Destroy picture clip rects on back-end server */
|
|
|
|
if (pPictPriv->pict) {
|
2012-06-10 07:21:05 -06:00
|
|
|
XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
|
|
|
|
pPictPriv->pict, 0, 0, NULL, 0);
|
|
|
|
dmxSync(dmxScreen, FALSE);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* FIXME: Handle destroying clip region when offscreen */
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Change the attributes of the pictures. If the picture has not yet
|
|
|
|
* been created due to lazy window creation, save the mask so that it
|
|
|
|
* can be used to appropriately initialize the picture's attributes
|
|
|
|
* when it is created later. */
|
2012-06-10 07:21:05 -06:00
|
|
|
void
|
|
|
|
dmxChangePicture(PicturePtr pPicture, Mask mask)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
|
|
|
dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
DMX_UNWRAP(ChangePicture, dmxScreen, ps);
|
|
|
|
#if 1
|
|
|
|
if (ps->ChangePicture)
|
2012-06-10 07:21:05 -06:00
|
|
|
ps->ChangePicture(pPicture, mask);
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Picture attribute changes are handled in ValidatePicture */
|
|
|
|
pPictPriv->savedMask |= mask;
|
|
|
|
|
|
|
|
DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Validate the picture's attributes before rendering to it. Update
|
|
|
|
* any picture attributes that have been changed by one of the higher
|
|
|
|
* layers. */
|
2012-06-10 07:21:05 -06:00
|
|
|
void
|
|
|
|
dmxValidatePicture(PicturePtr pPicture, Mask mask)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
|
|
|
dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
DMX_UNWRAP(ValidatePicture, dmxScreen, ps);
|
|
|
|
|
|
|
|
/* Change picture attributes on back-end server */
|
|
|
|
if (pPictPriv->pict) {
|
2012-06-10 07:21:05 -06:00
|
|
|
XRenderPictureAttributes attribs;
|
|
|
|
|
|
|
|
if (mask & CPRepeat) {
|
|
|
|
attribs.repeat = pPicture->repeatType;
|
|
|
|
}
|
|
|
|
if (mask & CPAlphaMap) {
|
|
|
|
if (pPicture->alphaMap) {
|
|
|
|
dmxPictPrivPtr pAlphaPriv;
|
|
|
|
|
|
|
|
pAlphaPriv = DMX_GET_PICT_PRIV(pPicture->alphaMap);
|
|
|
|
if (pAlphaPriv->pict) {
|
|
|
|
attribs.alpha_map = pAlphaPriv->pict;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* FIXME: alpha picture drawable has not been created?? */
|
|
|
|
return; /* or should this be: attribs.alpha_map = None; */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
attribs.alpha_map = None;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (mask & CPAlphaXOrigin)
|
|
|
|
attribs.alpha_x_origin = pPicture->alphaOrigin.x;
|
|
|
|
if (mask & CPAlphaYOrigin)
|
|
|
|
attribs.alpha_y_origin = pPicture->alphaOrigin.y;
|
|
|
|
if (mask & CPClipXOrigin)
|
|
|
|
attribs.clip_x_origin = pPicture->clipOrigin.x;
|
|
|
|
if (mask & CPClipYOrigin)
|
|
|
|
attribs.clip_y_origin = pPicture->clipOrigin.y;
|
|
|
|
if (mask & CPClipMask)
|
|
|
|
mask &= ~CPClipMask; /* Handled in ChangePictureClip */
|
|
|
|
if (mask & CPGraphicsExposure)
|
|
|
|
attribs.graphics_exposures = pPicture->graphicsExposures;
|
|
|
|
if (mask & CPSubwindowMode)
|
|
|
|
attribs.subwindow_mode = pPicture->subWindowMode;
|
|
|
|
if (mask & CPPolyEdge)
|
|
|
|
attribs.poly_edge = pPicture->polyEdge;
|
|
|
|
if (mask & CPPolyMode)
|
|
|
|
attribs.poly_mode = pPicture->polyMode;
|
|
|
|
if (mask & CPComponentAlpha)
|
|
|
|
attribs.component_alpha = pPicture->componentAlpha;
|
|
|
|
|
|
|
|
XRenderChangePicture(dmxScreen->beDisplay, pPictPriv->pict,
|
|
|
|
mask, &attribs);
|
|
|
|
dmxSync(dmxScreen, FALSE);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
pPictPriv->savedMask |= mask;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
if (ps->ValidatePicture)
|
2012-06-10 07:21:05 -06:00
|
|
|
ps->ValidatePicture(pPicture, mask);
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Composite a picture on the appropriate screen by combining the
|
|
|
|
* specified rectangle of the transformed src and mask operands with
|
|
|
|
* the specified rectangle of the dst using op as the compositing
|
|
|
|
* operator. For a complete description see the protocol document of
|
|
|
|
* the RENDER library. */
|
2012-06-10 07:21:05 -06:00
|
|
|
void
|
|
|
|
dmxComposite(CARD8 op,
|
|
|
|
PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
|
|
|
|
INT16 xSrc, INT16 ySrc,
|
|
|
|
INT16 xMask, INT16 yMask,
|
|
|
|
INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ScreenPtr pScreen = pDst->pDrawable->pScreen;
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
|
|
|
dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
|
|
|
|
dmxPictPrivPtr pMaskPriv = NULL;
|
|
|
|
dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (pMask)
|
|
|
|
pMaskPriv = DMX_GET_PICT_PRIV(pMask);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
DMX_UNWRAP(Composite, dmxScreen, ps);
|
|
|
|
#if 0
|
|
|
|
if (ps->Composite)
|
2012-06-10 07:21:05 -06:00
|
|
|
ps->Composite(op, pSrc, pMask, pDst,
|
|
|
|
xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Composite on back-end server */
|
|
|
|
if (pSrcPriv->pict && pDstPriv->pict &&
|
2012-06-10 07:21:05 -06:00
|
|
|
((pMaskPriv && pMaskPriv->pict) || !pMaskPriv)) {
|
|
|
|
XRenderComposite(dmxScreen->beDisplay,
|
|
|
|
op,
|
|
|
|
pSrcPriv->pict,
|
|
|
|
pMaskPriv ? pMaskPriv->pict : None,
|
|
|
|
pDstPriv->pict,
|
|
|
|
xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
|
|
|
|
dmxSync(dmxScreen, FALSE);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
DMX_WRAP(Composite, dmxComposite, dmxScreen, ps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Null function to catch when/if RENDER calls lower level mi hooks.
|
|
|
|
* Compositing glyphs is handled by dmxProcRenderCompositeGlyphs().
|
|
|
|
* This function should never be called. */
|
2012-06-10 07:21:05 -06:00
|
|
|
void
|
|
|
|
dmxGlyphs(CARD8 op,
|
|
|
|
PicturePtr pSrc, PicturePtr pDst,
|
|
|
|
PictFormatPtr maskFormat,
|
|
|
|
INT16 xSrc, INT16 ySrc,
|
|
|
|
int nlists, GlyphListPtr lists, GlyphPtr * glyphs)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
/* This won't work, so we need to wrap ProcRenderCompositeGlyphs */
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Fill a rectangle on the appropriate screen by combining the color
|
|
|
|
* with the dest picture in the area specified by the list of
|
|
|
|
* rectangles. For a complete description see the protocol document of
|
|
|
|
* the RENDER library. */
|
2012-06-10 07:21:05 -06:00
|
|
|
void
|
|
|
|
dmxCompositeRects(CARD8 op,
|
|
|
|
PicturePtr pDst,
|
|
|
|
xRenderColor * color, int nRect, xRectangle *rects)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ScreenPtr pScreen = pDst->pDrawable->pScreen;
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
|
|
|
dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pDst);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
DMX_UNWRAP(CompositeRects, dmxScreen, ps);
|
|
|
|
#if 0
|
|
|
|
if (ps->CompositeRects)
|
2012-06-10 07:21:05 -06:00
|
|
|
ps->CompositeRects(op, pDst, color, nRect, rects);
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* CompositeRects on back-end server */
|
|
|
|
if (pPictPriv->pict) {
|
2012-06-10 07:21:05 -06:00
|
|
|
XRenderFillRectangles(dmxScreen->beDisplay,
|
|
|
|
op,
|
|
|
|
pPictPriv->pict,
|
|
|
|
(XRenderColor *) color,
|
|
|
|
(XRectangle *) rects, nRect);
|
|
|
|
dmxSync(dmxScreen, FALSE);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Indexed color visuals are not yet supported. */
|
2012-06-10 07:21:05 -06:00
|
|
|
Bool
|
|
|
|
dmxInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Indexed color visuals are not yet supported. */
|
2012-06-10 07:21:05 -06:00
|
|
|
void
|
|
|
|
dmxCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Indexed color visuals are not yet supported. */
|
2012-06-10 07:21:05 -06:00
|
|
|
void
|
|
|
|
dmxUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat,
|
|
|
|
int ndef, xColorItem * pdef)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Composite a list of trapezoids on the appropriate screen. For a
|
|
|
|
* complete description see the protocol document of the RENDER
|
|
|
|
* library. */
|
2012-06-10 07:21:05 -06:00
|
|
|
void
|
|
|
|
dmxTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
|
|
|
|
PictFormatPtr maskFormat,
|
|
|
|
INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ScreenPtr pScreen = pDst->pDrawable->pScreen;
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
|
|
|
dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
|
|
|
|
dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
DMX_UNWRAP(Trapezoids, dmxScreen, ps);
|
|
|
|
#if 0
|
|
|
|
if (ps->Trapezoids)
|
2012-06-10 07:21:05 -06:00
|
|
|
ps->Trapezoids(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, *traps);
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Draw trapezoids on back-end server */
|
|
|
|
if (pDstPriv->pict) {
|
2012-06-10 07:21:05 -06:00
|
|
|
XRenderPictFormat *pFormat;
|
|
|
|
|
|
|
|
pFormat = dmxFindFormat(dmxScreen, maskFormat);
|
|
|
|
if (!pFormat) {
|
|
|
|
/* FIXME: Error! */
|
|
|
|
}
|
|
|
|
|
|
|
|
XRenderCompositeTrapezoids(dmxScreen->beDisplay,
|
|
|
|
op,
|
|
|
|
pSrcPriv->pict,
|
|
|
|
pDstPriv->pict,
|
|
|
|
pFormat,
|
|
|
|
xSrc, ySrc, (XTrapezoid *) traps, ntrap);
|
|
|
|
dmxSync(dmxScreen, FALSE);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Composite a list of triangles on the appropriate screen. For a
|
|
|
|
* complete description see the protocol document of the RENDER
|
|
|
|
* library. */
|
2012-06-10 07:21:05 -06:00
|
|
|
void
|
|
|
|
dmxTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
|
|
|
|
PictFormatPtr maskFormat,
|
|
|
|
INT16 xSrc, INT16 ySrc, int ntri, xTriangle * tris)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ScreenPtr pScreen = pDst->pDrawable->pScreen;
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
|
|
|
dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
|
|
|
|
dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
DMX_UNWRAP(Triangles, dmxScreen, ps);
|
|
|
|
#if 0
|
|
|
|
if (ps->Triangles)
|
2012-06-10 07:21:05 -06:00
|
|
|
ps->Triangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, *tris);
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Draw trapezoids on back-end server */
|
|
|
|
if (pDstPriv->pict) {
|
2012-06-10 07:21:05 -06:00
|
|
|
XRenderPictFormat *pFormat;
|
|
|
|
|
|
|
|
pFormat = dmxFindFormat(dmxScreen, maskFormat);
|
|
|
|
if (!pFormat) {
|
|
|
|
/* FIXME: Error! */
|
|
|
|
}
|
|
|
|
|
|
|
|
XRenderCompositeTriangles(dmxScreen->beDisplay,
|
|
|
|
op,
|
|
|
|
pSrcPriv->pict,
|
|
|
|
pDstPriv->pict,
|
|
|
|
pFormat,
|
|
|
|
xSrc, ySrc, (XTriangle *) tris, ntri);
|
|
|
|
dmxSync(dmxScreen, FALSE);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps);
|
|
|
|
}
|