2007-06-05 23:44:21 +02:00
|
|
|
/*
|
2003-11-14 17:48:57 +01:00
|
|
|
*
|
2004-12-04 01:43:13 +01:00
|
|
|
* Copyright © 1999 Keith Packard
|
2003-11-14 17:48:57 +01:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
* documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
* the above copyright notice appear in all copies and that both that
|
|
|
|
* copyright notice and this permission notice appear in supporting
|
|
|
|
* documentation, and that the name of Keith Packard not be used in
|
|
|
|
* advertising or publicity pertaining to distribution of the software without
|
|
|
|
* specific, written prior permission. Keith Packard makes no
|
|
|
|
* representations about the suitability of this software for any purpose. It
|
|
|
|
* is provided "as is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
|
|
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
|
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
|
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2005-07-03 09:02:09 +02:00
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
#include "scrnintstr.h"
|
|
|
|
#include "gcstruct.h"
|
|
|
|
#include "pixmapstr.h"
|
|
|
|
#include "windowstr.h"
|
|
|
|
#include "mi.h"
|
|
|
|
#include "picturestr.h"
|
|
|
|
#include "mipict.h"
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
miCreatePicture(PicturePtr pPicture)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
miDestroyPicture(PicturePtr pPicture)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
if (pPicture->freeCompClip)
|
2012-03-21 20:55:09 +01:00
|
|
|
RegionDestroy(pPicture->pCompositeClip);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
miDestroyPictureClip(PicturePtr pPicture)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2014-10-08 17:20:33 +02:00
|
|
|
if (pPicture->clientClip)
|
2012-03-21 20:55:09 +01:00
|
|
|
RegionDestroy(pPicture->clientClip);
|
2003-11-14 17:48:57 +01:00
|
|
|
pPicture->clientClip = NULL;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2013-12-15 10:05:51 +01:00
|
|
|
miChangePictureClip(PicturePtr pPicture, int type, void *value, int n)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
|
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
2014-10-08 17:20:33 +02:00
|
|
|
RegionPtr clientClip;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
switch (type) {
|
|
|
|
case CT_PIXMAP:
|
2012-03-21 20:55:09 +01:00
|
|
|
/* convert the pixmap to a region */
|
2014-10-08 17:20:33 +02:00
|
|
|
clientClip = BitmapToRegion(pScreen, (PixmapPtr) value);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!clientClip)
|
|
|
|
return BadAlloc;
|
|
|
|
(*pScreen->DestroyPixmap) ((PixmapPtr) value);
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
case CT_REGION:
|
2012-03-21 20:55:09 +01:00
|
|
|
clientClip = value;
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
case CT_NONE:
|
2012-03-21 20:55:09 +01:00
|
|
|
clientClip = 0;
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
default:
|
2014-10-08 17:20:33 +02:00
|
|
|
clientClip = RegionFromRects(n, (xRectangle *) value, type);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!clientClip)
|
|
|
|
return BadAlloc;
|
|
|
|
free(value);
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
(*ps->DestroyPictureClip) (pPicture);
|
|
|
|
pPicture->clientClip = clientClip;
|
|
|
|
pPicture->stateChanges |= CPClipMask;
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
miChangePicture(PicturePtr pPicture, Mask mask)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
miValidatePicture(PicturePtr pPicture, Mask mask)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
DrawablePtr pDrawable = pPicture->pDrawable;
|
|
|
|
|
|
|
|
if ((mask & (CPClipXOrigin | CPClipYOrigin | CPClipMask | CPSubwindowMode))
|
|
|
|
|| (pDrawable->serialNumber !=
|
|
|
|
(pPicture->serialNumber & DRAWABLE_SERIAL_BITS))) {
|
|
|
|
if (pDrawable->type == DRAWABLE_WINDOW) {
|
|
|
|
WindowPtr pWin = (WindowPtr) pDrawable;
|
|
|
|
RegionPtr pregWin;
|
|
|
|
Bool freeTmpClip, freeCompClip;
|
|
|
|
|
|
|
|
if (pPicture->subWindowMode == IncludeInferiors) {
|
|
|
|
pregWin = NotClippedByChildren(pWin);
|
|
|
|
freeTmpClip = TRUE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
pregWin = &pWin->clipList;
|
|
|
|
freeTmpClip = FALSE;
|
|
|
|
}
|
|
|
|
freeCompClip = pPicture->freeCompClip;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* if there is no client clip, we can get by with just keeping the
|
|
|
|
* pointer we got, and remembering whether or not should destroy
|
|
|
|
* (or maybe re-use) it later. this way, we avoid unnecessary
|
|
|
|
* copying of regions. (this wins especially if many clients clip
|
|
|
|
* by children and have no client clip.)
|
|
|
|
*/
|
2014-10-08 17:20:33 +02:00
|
|
|
if (!pPicture->clientClip) {
|
2012-03-21 20:55:09 +01:00
|
|
|
if (freeCompClip)
|
|
|
|
RegionDestroy(pPicture->pCompositeClip);
|
|
|
|
pPicture->pCompositeClip = pregWin;
|
|
|
|
pPicture->freeCompClip = freeTmpClip;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/*
|
|
|
|
* we need one 'real' region to put into the composite clip. if
|
|
|
|
* pregWin the current composite clip are real, we can get rid of
|
|
|
|
* one. if pregWin is real and the current composite clip isn't,
|
|
|
|
* use pregWin for the composite clip. if the current composite
|
|
|
|
* clip is real and pregWin isn't, use the current composite
|
|
|
|
* clip. if neither is real, create a new region.
|
|
|
|
*/
|
|
|
|
|
|
|
|
RegionTranslate(pPicture->clientClip,
|
|
|
|
pDrawable->x + pPicture->clipOrigin.x,
|
|
|
|
pDrawable->y + pPicture->clipOrigin.y);
|
|
|
|
|
|
|
|
if (freeCompClip) {
|
|
|
|
RegionIntersect(pPicture->pCompositeClip,
|
|
|
|
pregWin, pPicture->clientClip);
|
|
|
|
if (freeTmpClip)
|
|
|
|
RegionDestroy(pregWin);
|
|
|
|
}
|
|
|
|
else if (freeTmpClip) {
|
|
|
|
RegionIntersect(pregWin, pregWin, pPicture->clientClip);
|
|
|
|
pPicture->pCompositeClip = pregWin;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
pPicture->pCompositeClip = RegionCreate(NullBox, 0);
|
|
|
|
RegionIntersect(pPicture->pCompositeClip,
|
|
|
|
pregWin, pPicture->clientClip);
|
|
|
|
}
|
|
|
|
pPicture->freeCompClip = TRUE;
|
|
|
|
RegionTranslate(pPicture->clientClip,
|
|
|
|
-(pDrawable->x + pPicture->clipOrigin.x),
|
|
|
|
-(pDrawable->y + pPicture->clipOrigin.y));
|
|
|
|
}
|
|
|
|
} /* end of composite clip for a window */
|
|
|
|
else {
|
|
|
|
BoxRec pixbounds;
|
|
|
|
|
|
|
|
/* XXX should we translate by drawable.x/y here ? */
|
|
|
|
/* If you want pixmaps in offscreen memory, yes */
|
|
|
|
pixbounds.x1 = pDrawable->x;
|
|
|
|
pixbounds.y1 = pDrawable->y;
|
|
|
|
pixbounds.x2 = pDrawable->x + pDrawable->width;
|
|
|
|
pixbounds.y2 = pDrawable->y + pDrawable->height;
|
|
|
|
|
|
|
|
if (pPicture->freeCompClip) {
|
|
|
|
RegionReset(pPicture->pCompositeClip, &pixbounds);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
pPicture->freeCompClip = TRUE;
|
|
|
|
pPicture->pCompositeClip = RegionCreate(&pixbounds, 1);
|
|
|
|
}
|
|
|
|
|
2014-10-08 17:20:33 +02:00
|
|
|
if (pPicture->clientClip) {
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pDrawable->x || pDrawable->y) {
|
|
|
|
RegionTranslate(pPicture->clientClip,
|
|
|
|
pDrawable->x + pPicture->clipOrigin.x,
|
|
|
|
pDrawable->y + pPicture->clipOrigin.y);
|
|
|
|
RegionIntersect(pPicture->pCompositeClip,
|
|
|
|
pPicture->pCompositeClip,
|
|
|
|
pPicture->clientClip);
|
|
|
|
RegionTranslate(pPicture->clientClip,
|
|
|
|
-(pDrawable->x + pPicture->clipOrigin.x),
|
|
|
|
-(pDrawable->y + pPicture->clipOrigin.y));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
RegionTranslate(pPicture->pCompositeClip,
|
|
|
|
-pPicture->clipOrigin.x,
|
|
|
|
-pPicture->clipOrigin.y);
|
|
|
|
RegionIntersect(pPicture->pCompositeClip,
|
|
|
|
pPicture->pCompositeClip,
|
|
|
|
pPicture->clientClip);
|
|
|
|
RegionTranslate(pPicture->pCompositeClip,
|
|
|
|
pPicture->clipOrigin.x,
|
|
|
|
pPicture->clipOrigin.y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} /* end of composite clip for pixmap */
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
miChangePictureTransform(PicturePtr pPicture, PictTransform * transform)
|
2005-12-28 12:48:14 +01:00
|
|
|
{
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
miChangePictureFilter(PicturePtr pPicture,
|
|
|
|
int filter, xFixed * params, int nparams)
|
2005-12-28 12:48:14 +01:00
|
|
|
{
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
#define BOUND(v) (INT16) ((v) < MINSHORT ? MINSHORT : (v) > MAXSHORT ? MAXSHORT : (v))
|
|
|
|
|
2007-06-11 15:16:46 +02:00
|
|
|
static inline pixman_bool_t
|
2012-03-21 20:55:09 +01:00
|
|
|
miClipPictureReg(pixman_region16_t * pRegion,
|
|
|
|
pixman_region16_t * pClip, int dx, int dy)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2007-06-11 15:16:46 +02:00
|
|
|
if (pixman_region_n_rects(pRegion) == 1 &&
|
2012-03-21 20:55:09 +01:00
|
|
|
pixman_region_n_rects(pClip) == 1) {
|
|
|
|
pixman_box16_t *pRbox = pixman_region_rectangles(pRegion, NULL);
|
|
|
|
pixman_box16_t *pCbox = pixman_region_rectangles(pClip, NULL);
|
|
|
|
int v;
|
|
|
|
|
|
|
|
if (pRbox->x1 < (v = pCbox->x1 + dx))
|
|
|
|
pRbox->x1 = BOUND(v);
|
|
|
|
if (pRbox->x2 > (v = pCbox->x2 + dx))
|
|
|
|
pRbox->x2 = BOUND(v);
|
|
|
|
if (pRbox->y1 < (v = pCbox->y1 + dy))
|
|
|
|
pRbox->y1 = BOUND(v);
|
|
|
|
if (pRbox->y2 > (v = pCbox->y2 + dy))
|
|
|
|
pRbox->y2 = BOUND(v);
|
|
|
|
if (pRbox->x1 >= pRbox->x2 || pRbox->y1 >= pRbox->y2) {
|
|
|
|
pixman_region_init(pRegion);
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
else if (!pixman_region_not_empty(pClip))
|
|
|
|
return FALSE;
|
|
|
|
else {
|
|
|
|
if (dx || dy)
|
|
|
|
pixman_region_translate(pRegion, -dx, -dy);
|
|
|
|
if (!pixman_region_intersect(pRegion, pRegion, pClip))
|
|
|
|
return FALSE;
|
|
|
|
if (dx || dy)
|
|
|
|
pixman_region_translate(pRegion, dx, dy);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2007-06-11 15:16:46 +02:00
|
|
|
return pixman_region_not_empty(pRegion);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2007-06-11 15:16:46 +02:00
|
|
|
|
2011-06-05 14:53:08 +02:00
|
|
|
static inline Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
miClipPictureSrc(RegionPtr pRegion, PicturePtr pPicture, int dx, int dy)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2014-10-08 17:20:33 +02:00
|
|
|
if (pPicture->clientClip) {
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool result;
|
|
|
|
|
|
|
|
pixman_region_translate(pPicture->clientClip,
|
|
|
|
pPicture->clipOrigin.x + dx,
|
|
|
|
pPicture->clipOrigin.y + dy);
|
|
|
|
|
|
|
|
result = RegionIntersect(pRegion, pRegion, pPicture->clientClip);
|
|
|
|
|
|
|
|
pixman_region_translate(pPicture->clientClip,
|
|
|
|
-(pPicture->clipOrigin.x + dx),
|
|
|
|
-(pPicture->clipOrigin.y + dy));
|
|
|
|
|
|
|
|
if (!result)
|
|
|
|
return FALSE;
|
2004-08-13 10:16:14 +02:00
|
|
|
}
|
2009-06-13 16:55:04 +02:00
|
|
|
return TRUE;
|
2004-08-13 10:16:14 +02:00
|
|
|
}
|
|
|
|
|
Remove geometry arguments from miSourceValidate()
The only user of the geometry coordinates is the software sprite code,
which uses them to remove the pointer whenever the window beneath is
being used as a source. However, using Window pictures as a source is
extremely rare (let alone *partial* windows), so there is no harm done
in just validating all of the drawable.
Additionally, the miSourceValidate() function was buggy in at least
three respects:
(a) It added drawable->{x,y} before calling down, which is wrong since
the misprite code already adds them in its check. (Alternatively,
the misprite code is wrong, but there are actual users who would
notice if that code was broken).
(b) It didn't account for the width of the interpolation filter, so if
the Picture had a bilinear or convolution filter, the edges
surrounding the source area would not be validated.
(c) It didn't validate alpha maps.
Finally, computing the bounding box of the transform on every
composite request was a real performance issue in pixman, so
presumably it could be one here as well.
This patch changes miSourceValidate() to simply validate all of the
underlying drawable.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Soren Sandmann <ssp@redhat.com>
2011-03-09 19:57:25 +01:00
|
|
|
static void
|
2012-03-21 20:55:09 +01:00
|
|
|
SourceValidateOnePicture(PicturePtr pPicture)
|
2004-08-13 10:16:14 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
DrawablePtr pDrawable = pPicture->pDrawable;
|
|
|
|
ScreenPtr pScreen;
|
2005-07-01 12:05:43 +02:00
|
|
|
|
|
|
|
if (!pDrawable)
|
|
|
|
return;
|
|
|
|
|
|
|
|
pScreen = pDrawable->pScreen;
|
Remove geometry arguments from miSourceValidate()
The only user of the geometry coordinates is the software sprite code,
which uses them to remove the pointer whenever the window beneath is
being used as a source. However, using Window pictures as a source is
extremely rare (let alone *partial* windows), so there is no harm done
in just validating all of the drawable.
Additionally, the miSourceValidate() function was buggy in at least
three respects:
(a) It added drawable->{x,y} before calling down, which is wrong since
the misprite code already adds them in its check. (Alternatively,
the misprite code is wrong, but there are actual users who would
notice if that code was broken).
(b) It didn't account for the width of the interpolation filter, so if
the Picture had a bilinear or convolution filter, the edges
surrounding the source area would not be validated.
(c) It didn't validate alpha maps.
Finally, computing the bounding box of the transform on every
composite request was a real performance issue in pixman, so
presumably it could be one here as well.
This patch changes miSourceValidate() to simply validate all of the
underlying drawable.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Soren Sandmann <ssp@redhat.com>
2011-03-09 19:57:25 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pScreen->SourceValidate) {
|
|
|
|
pScreen->SourceValidate(pDrawable, 0, 0, pDrawable->width,
|
|
|
|
pDrawable->height, pPicture->subWindowMode);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Remove geometry arguments from miSourceValidate()
The only user of the geometry coordinates is the software sprite code,
which uses them to remove the pointer whenever the window beneath is
being used as a source. However, using Window pictures as a source is
extremely rare (let alone *partial* windows), so there is no harm done
in just validating all of the drawable.
Additionally, the miSourceValidate() function was buggy in at least
three respects:
(a) It added drawable->{x,y} before calling down, which is wrong since
the misprite code already adds them in its check. (Alternatively,
the misprite code is wrong, but there are actual users who would
notice if that code was broken).
(b) It didn't account for the width of the interpolation filter, so if
the Picture had a bilinear or convolution filter, the edges
surrounding the source area would not be validated.
(c) It didn't validate alpha maps.
Finally, computing the bounding box of the transform on every
composite request was a real performance issue in pixman, so
presumably it could be one here as well.
This patch changes miSourceValidate() to simply validate all of the
underlying drawable.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Soren Sandmann <ssp@redhat.com>
2011-03-09 19:57:25 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
miCompositeSourceValidate(PicturePtr pPicture)
|
Remove geometry arguments from miSourceValidate()
The only user of the geometry coordinates is the software sprite code,
which uses them to remove the pointer whenever the window beneath is
being used as a source. However, using Window pictures as a source is
extremely rare (let alone *partial* windows), so there is no harm done
in just validating all of the drawable.
Additionally, the miSourceValidate() function was buggy in at least
three respects:
(a) It added drawable->{x,y} before calling down, which is wrong since
the misprite code already adds them in its check. (Alternatively,
the misprite code is wrong, but there are actual users who would
notice if that code was broken).
(b) It didn't account for the width of the interpolation filter, so if
the Picture had a bilinear or convolution filter, the edges
surrounding the source area would not be validated.
(c) It didn't validate alpha maps.
Finally, computing the bounding box of the transform on every
composite request was a real performance issue in pixman, so
presumably it could be one here as well.
This patch changes miSourceValidate() to simply validate all of the
underlying drawable.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Soren Sandmann <ssp@redhat.com>
2011-03-09 19:57:25 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
SourceValidateOnePicture(pPicture);
|
Remove geometry arguments from miSourceValidate()
The only user of the geometry coordinates is the software sprite code,
which uses them to remove the pointer whenever the window beneath is
being used as a source. However, using Window pictures as a source is
extremely rare (let alone *partial* windows), so there is no harm done
in just validating all of the drawable.
Additionally, the miSourceValidate() function was buggy in at least
three respects:
(a) It added drawable->{x,y} before calling down, which is wrong since
the misprite code already adds them in its check. (Alternatively,
the misprite code is wrong, but there are actual users who would
notice if that code was broken).
(b) It didn't account for the width of the interpolation filter, so if
the Picture had a bilinear or convolution filter, the edges
surrounding the source area would not be validated.
(c) It didn't validate alpha maps.
Finally, computing the bounding box of the transform on every
composite request was a real performance issue in pixman, so
presumably it could be one here as well.
This patch changes miSourceValidate() to simply validate all of the
underlying drawable.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Soren Sandmann <ssp@redhat.com>
2011-03-09 19:57:25 +01:00
|
|
|
if (pPicture->alphaMap)
|
2012-03-21 20:55:09 +01:00
|
|
|
SourceValidateOnePicture(pPicture->alphaMap);
|
Remove geometry arguments from miSourceValidate()
The only user of the geometry coordinates is the software sprite code,
which uses them to remove the pointer whenever the window beneath is
being used as a source. However, using Window pictures as a source is
extremely rare (let alone *partial* windows), so there is no harm done
in just validating all of the drawable.
Additionally, the miSourceValidate() function was buggy in at least
three respects:
(a) It added drawable->{x,y} before calling down, which is wrong since
the misprite code already adds them in its check. (Alternatively,
the misprite code is wrong, but there are actual users who would
notice if that code was broken).
(b) It didn't account for the width of the interpolation filter, so if
the Picture had a bilinear or convolution filter, the edges
surrounding the source area would not be validated.
(c) It didn't validate alpha maps.
Finally, computing the bounding box of the transform on every
composite request was a real performance issue in pixman, so
presumably it could be one here as well.
This patch changes miSourceValidate() to simply validate all of the
underlying drawable.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Soren Sandmann <ssp@redhat.com>
2011-03-09 19:57:25 +01:00
|
|
|
}
|
|
|
|
|
2004-08-13 10:16:14 +02:00
|
|
|
/*
|
|
|
|
* returns FALSE if the final region is empty. Indistinguishable from
|
|
|
|
* an allocation failure, but rendering ignores those anyways.
|
|
|
|
*/
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
miComputeCompositeRegion(RegionPtr pRegion,
|
|
|
|
PicturePtr pSrc,
|
|
|
|
PicturePtr pMask,
|
|
|
|
PicturePtr pDst,
|
|
|
|
INT16 xSrc,
|
|
|
|
INT16 ySrc,
|
|
|
|
INT16 xMask,
|
|
|
|
INT16 yMask,
|
|
|
|
INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
int v;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
pRegion->extents.x1 = xDst;
|
|
|
|
v = xDst + width;
|
|
|
|
pRegion->extents.x2 = BOUND(v);
|
|
|
|
pRegion->extents.y1 = yDst;
|
|
|
|
v = yDst + height;
|
|
|
|
pRegion->extents.y2 = BOUND(v);
|
|
|
|
pRegion->data = 0;
|
|
|
|
/* Check for empty operation */
|
|
|
|
if (pRegion->extents.x1 >= pRegion->extents.x2 ||
|
2012-03-21 20:55:09 +01:00
|
|
|
pRegion->extents.y1 >= pRegion->extents.y2) {
|
|
|
|
pixman_region_init(pRegion);
|
|
|
|
return FALSE;
|
2004-08-13 10:16:14 +02:00
|
|
|
}
|
|
|
|
/* clip against dst */
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!miClipPictureReg(pRegion, pDst->pCompositeClip, 0, 0)) {
|
|
|
|
pixman_region_fini(pRegion);
|
|
|
|
return FALSE;
|
2004-08-13 10:16:14 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pDst->alphaMap) {
|
|
|
|
if (!miClipPictureReg(pRegion, pDst->alphaMap->pCompositeClip,
|
|
|
|
-pDst->alphaOrigin.x, -pDst->alphaOrigin.y)) {
|
|
|
|
pixman_region_fini(pRegion);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
/* clip against src */
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!miClipPictureSrc(pRegion, pSrc, xDst - xSrc, yDst - ySrc)) {
|
|
|
|
pixman_region_fini(pRegion);
|
|
|
|
return FALSE;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pSrc->alphaMap) {
|
|
|
|
if (!miClipPictureSrc(pRegion, pSrc->alphaMap,
|
|
|
|
xDst - (xSrc - pSrc->alphaOrigin.x),
|
|
|
|
yDst - (ySrc - pSrc->alphaOrigin.y))) {
|
|
|
|
pixman_region_fini(pRegion);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
/* clip against mask */
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pMask) {
|
|
|
|
if (!miClipPictureSrc(pRegion, pMask, xDst - xMask, yDst - yMask)) {
|
|
|
|
pixman_region_fini(pRegion);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (pMask->alphaMap) {
|
|
|
|
if (!miClipPictureSrc(pRegion, pMask->alphaMap,
|
|
|
|
xDst - (xMask - pMask->alphaOrigin.x),
|
|
|
|
yDst - (yMask - pMask->alphaOrigin.y))) {
|
|
|
|
pixman_region_fini(pRegion);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2007-06-11 15:16:46 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
miCompositeSourceValidate(pSrc);
|
2004-08-13 10:16:14 +02:00
|
|
|
if (pMask)
|
2012-03-21 20:55:09 +01:00
|
|
|
miCompositeSourceValidate(pMask);
|
2007-06-11 15:16:46 +02:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
miRenderColorToPixel(PictFormatPtr format, xRenderColor * color, CARD32 *pixel)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
CARD32 r, g, b, a;
|
|
|
|
miIndexedPtr pIndexed;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
switch (format->type) {
|
|
|
|
case PictTypeDirect:
|
2012-03-21 20:55:09 +01:00
|
|
|
r = color->red >> (16 - Ones(format->direct.redMask));
|
|
|
|
g = color->green >> (16 - Ones(format->direct.greenMask));
|
|
|
|
b = color->blue >> (16 - Ones(format->direct.blueMask));
|
|
|
|
a = color->alpha >> (16 - Ones(format->direct.alphaMask));
|
|
|
|
r = r << format->direct.red;
|
|
|
|
g = g << format->direct.green;
|
|
|
|
b = b << format->direct.blue;
|
|
|
|
a = a << format->direct.alpha;
|
|
|
|
*pixel = r | g | b | a;
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
case PictTypeIndexed:
|
2012-03-21 20:55:09 +01:00
|
|
|
pIndexed = (miIndexedPtr) (format->index.devPrivate);
|
|
|
|
if (pIndexed->color) {
|
|
|
|
r = color->red >> 11;
|
|
|
|
g = color->green >> 11;
|
|
|
|
b = color->blue >> 11;
|
|
|
|
*pixel = miIndexToEnt15(pIndexed, (r << 10) | (g << 5) | b);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
r = color->red >> 8;
|
|
|
|
g = color->green >> 8;
|
|
|
|
b = color->blue >> 8;
|
|
|
|
*pixel = miIndexToEntY24(pIndexed, (r << 16) | (g << 8) | b);
|
|
|
|
}
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static CARD16
|
2012-03-21 20:55:09 +01:00
|
|
|
miFillColor(CARD32 pixel, int bits)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
while (bits < 16) {
|
|
|
|
pixel |= pixel << bits;
|
|
|
|
bits <<= 1;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
return (CARD16) pixel;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
miIsSolidAlpha(PicturePtr pSrc)
|
2004-08-07 01:42:10 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
ScreenPtr pScreen;
|
|
|
|
char line[1];
|
2005-07-01 12:05:43 +02:00
|
|
|
|
|
|
|
if (!pSrc->pDrawable)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
pScreen = pSrc->pDrawable->pScreen;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2004-08-07 01:42:10 +02:00
|
|
|
/* Alpha-only */
|
2012-03-21 20:55:09 +01:00
|
|
|
if (PICT_FORMAT_TYPE(pSrc->format) != PICT_TYPE_A)
|
|
|
|
return FALSE;
|
2004-08-07 01:42:10 +02:00
|
|
|
/* repeat */
|
|
|
|
if (!pSrc->repeat)
|
2012-03-21 20:55:09 +01:00
|
|
|
return FALSE;
|
2004-08-07 01:42:10 +02:00
|
|
|
/* 1x1 */
|
|
|
|
if (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1)
|
2012-03-21 20:55:09 +01:00
|
|
|
return FALSE;
|
2004-08-07 01:42:10 +02:00
|
|
|
line[0] = 1;
|
|
|
|
(*pScreen->GetImage) (pSrc->pDrawable, 0, 0, 1, 1, ZPixmap, ~0L, line);
|
|
|
|
switch (pSrc->pDrawable->bitsPerPixel) {
|
|
|
|
case 1:
|
2012-03-21 20:55:09 +01:00
|
|
|
return (CARD8) line[0] == 1 || (CARD8) line[0] == 0x80;
|
2004-08-07 01:42:10 +02:00
|
|
|
case 4:
|
2012-03-21 20:55:09 +01:00
|
|
|
return (CARD8) line[0] == 0xf || (CARD8) line[0] == 0xf0;
|
2004-08-07 01:42:10 +02:00
|
|
|
case 8:
|
2012-03-21 20:55:09 +01:00
|
|
|
return (CARD8) line[0] == 0xff;
|
2004-08-07 01:42:10 +02:00
|
|
|
default:
|
2012-03-21 20:55:09 +01:00
|
|
|
return FALSE;
|
2004-08-07 01:42:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
miRenderPixelToColor(PictFormatPtr format, CARD32 pixel, xRenderColor * color)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
CARD32 r, g, b, a;
|
|
|
|
miIndexedPtr pIndexed;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
switch (format->type) {
|
|
|
|
case PictTypeDirect:
|
2012-03-21 20:55:09 +01:00
|
|
|
r = (pixel >> format->direct.red) & format->direct.redMask;
|
|
|
|
g = (pixel >> format->direct.green) & format->direct.greenMask;
|
|
|
|
b = (pixel >> format->direct.blue) & format->direct.blueMask;
|
|
|
|
a = (pixel >> format->direct.alpha) & format->direct.alphaMask;
|
|
|
|
color->red = miFillColor(r, Ones(format->direct.redMask));
|
|
|
|
color->green = miFillColor(g, Ones(format->direct.greenMask));
|
|
|
|
color->blue = miFillColor(b, Ones(format->direct.blueMask));
|
|
|
|
color->alpha = miFillColor(a, Ones(format->direct.alphaMask));
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
case PictTypeIndexed:
|
2012-03-21 20:55:09 +01:00
|
|
|
pIndexed = (miIndexedPtr) (format->index.devPrivate);
|
|
|
|
pixel = pIndexed->rgba[pixel & (MI_MAX_INDEXED - 1)];
|
|
|
|
r = (pixel >> 16) & 0xff;
|
|
|
|
g = (pixel >> 8) & 0xff;
|
|
|
|
b = (pixel) & 0xff;
|
|
|
|
color->red = miFillColor(r, 8);
|
|
|
|
color->green = miFillColor(g, 8);
|
|
|
|
color->blue = miFillColor(b, 8);
|
|
|
|
color->alpha = 0xffff;
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-04 18:34:08 +02:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
miTriStrip(CARD8 op,
|
|
|
|
PicturePtr pSrc,
|
|
|
|
PicturePtr pDst,
|
|
|
|
PictFormatPtr maskFormat,
|
|
|
|
INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points)
|
2011-09-04 18:34:08 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
xTriangle *tris, *tri;
|
|
|
|
int ntri;
|
2011-09-04 18:34:08 +02:00
|
|
|
|
|
|
|
ntri = npoints - 2;
|
2012-03-21 20:55:09 +01:00
|
|
|
tris = malloc(ntri * sizeof(xTriangle));
|
2011-09-04 18:34:08 +02:00
|
|
|
if (!tris)
|
|
|
|
return;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
for (tri = tris; npoints >= 3; npoints--, points++, tri++) {
|
2011-09-04 18:34:08 +02:00
|
|
|
tri->p1 = points[0];
|
|
|
|
tri->p2 = points[1];
|
|
|
|
tri->p3 = points[2];
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
CompositeTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
|
2011-09-04 18:34:08 +02:00
|
|
|
free(tris);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
miTriFan(CARD8 op,
|
|
|
|
PicturePtr pSrc,
|
|
|
|
PicturePtr pDst,
|
|
|
|
PictFormatPtr maskFormat,
|
|
|
|
INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points)
|
2011-09-04 18:34:08 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
xTriangle *tris, *tri;
|
|
|
|
xPointFixed *first;
|
|
|
|
int ntri;
|
2011-09-04 18:34:08 +02:00
|
|
|
|
|
|
|
ntri = npoints - 2;
|
2012-03-21 20:55:09 +01:00
|
|
|
tris = malloc(ntri * sizeof(xTriangle));
|
2011-09-04 18:34:08 +02:00
|
|
|
if (!tris)
|
2012-03-21 20:55:09 +01:00
|
|
|
return;
|
2011-09-04 18:34:08 +02:00
|
|
|
|
|
|
|
first = points++;
|
2012-03-21 20:55:09 +01:00
|
|
|
for (tri = tris; npoints >= 3; npoints--, points++, tri++) {
|
|
|
|
tri->p1 = *first;
|
|
|
|
tri->p2 = points[0];
|
|
|
|
tri->p3 = points[1];
|
2011-09-04 18:34:08 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
CompositeTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
|
2011-09-04 18:34:08 +02:00
|
|
|
free(tris);
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
miPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PictureScreenPtr ps;
|
|
|
|
|
|
|
|
if (!PictureInit(pScreen, formats, nformats))
|
|
|
|
return FALSE;
|
2003-11-14 17:48:57 +01:00
|
|
|
ps = GetPictureScreen(pScreen);
|
|
|
|
ps->CreatePicture = miCreatePicture;
|
|
|
|
ps->DestroyPicture = miDestroyPicture;
|
|
|
|
ps->ChangePictureClip = miChangePictureClip;
|
|
|
|
ps->DestroyPictureClip = miDestroyPictureClip;
|
|
|
|
ps->ChangePicture = miChangePicture;
|
|
|
|
ps->ValidatePicture = miValidatePicture;
|
|
|
|
ps->InitIndexed = miInitIndexed;
|
|
|
|
ps->CloseIndexed = miCloseIndexed;
|
|
|
|
ps->UpdateIndexed = miUpdateIndexed;
|
2005-12-28 12:48:14 +01:00
|
|
|
ps->ChangePictureTransform = miChangePictureTransform;
|
|
|
|
ps->ChangePictureFilter = miChangePictureFilter;
|
2006-01-03 23:06:23 +01:00
|
|
|
ps->RealizeGlyph = miRealizeGlyph;
|
|
|
|
ps->UnrealizeGlyph = miUnrealizeGlyph;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
/* MI rendering routines */
|
2012-03-21 20:55:09 +01:00
|
|
|
ps->Composite = 0; /* requires DDX support */
|
|
|
|
ps->Glyphs = miGlyphs;
|
|
|
|
ps->CompositeRects = miCompositeRects;
|
|
|
|
ps->Trapezoids = 0;
|
|
|
|
ps->Triangles = 0;
|
|
|
|
|
|
|
|
ps->RasterizeTrapezoid = 0; /* requires DDX support */
|
|
|
|
ps->AddTraps = 0; /* requires DDX support */
|
|
|
|
ps->AddTriangles = 0; /* requires DDX support */
|
|
|
|
|
|
|
|
ps->TriStrip = miTriStrip; /* converts call to CompositeTriangles */
|
|
|
|
ps->TriFan = miTriFan;
|
2011-09-04 18:34:08 +02:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|