Move matrix operations from X server to pixman 0.13.2
pixman 0.13.2 now holds all of the matrix operations. This leaves the protocol conversion routines and some ABI stubs in place Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
c4b9ab6bf5
commit
9ffc671939
10
configure.ac
10
configure.ac
|
@ -665,7 +665,7 @@ XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
|
||||||
|
|
||||||
dnl Core modules for most extensions, et al.
|
dnl Core modules for most extensions, et al.
|
||||||
REQUIRED_MODULES="[randrproto >= 1.2] [renderproto >= 0.9.3] [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto [xextproto >= 7.0.3] [xproto >= 7.0.13] [xtrans >= 1.2.2] bigreqsproto resourceproto fontsproto [inputproto >= 1.9.99.6] [kbproto >= 1.0.3]"
|
REQUIRED_MODULES="[randrproto >= 1.2] [renderproto >= 0.9.3] [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto [xextproto >= 7.0.3] [xproto >= 7.0.13] [xtrans >= 1.2.2] bigreqsproto resourceproto fontsproto [inputproto >= 1.9.99.6] [kbproto >= 1.0.3]"
|
||||||
REQUIRED_LIBS="xfont xau fontenc [pixman-1 >= 0.9.5]"
|
REQUIRED_LIBS="xfont xau fontenc [pixman-1 >= 0.13.2]"
|
||||||
|
|
||||||
dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
|
dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
|
||||||
dnl CONFIG_DBUS_API is true if we want to enable the D-Bus config
|
dnl CONFIG_DBUS_API is true if we want to enable the D-Bus config
|
||||||
|
@ -1181,7 +1181,7 @@ AC_MSG_RESULT([$XVFB])
|
||||||
AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
|
AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
|
||||||
|
|
||||||
if test "x$XVFB" = xyes; then
|
if test "x$XVFB" = xyes; then
|
||||||
XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB"
|
XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB"
|
||||||
XVFB_SYS_LIBS="$XVFBMODULES_LIBS $GLX_SYS_LIBS"
|
XVFB_SYS_LIBS="$XVFBMODULES_LIBS $GLX_SYS_LIBS"
|
||||||
AC_SUBST([XVFB_LIBS])
|
AC_SUBST([XVFB_LIBS])
|
||||||
AC_SUBST([XVFB_SYS_LIBS])
|
AC_SUBST([XVFB_SYS_LIBS])
|
||||||
|
@ -1228,7 +1228,7 @@ if test "x$XORG" = xyes; then
|
||||||
XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
|
XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
|
||||||
XORG_INCS="$XORG_DDXINCS $XORG_OSINCS"
|
XORG_INCS="$XORG_DDXINCS $XORG_OSINCS"
|
||||||
XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
|
XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
|
||||||
XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $SELINUX_LIB"
|
XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $SELINUX_LIB"
|
||||||
|
|
||||||
PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
|
PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
|
||||||
SAVE_LIBS=$LIBS
|
SAVE_LIBS=$LIBS
|
||||||
|
@ -1536,7 +1536,7 @@ if test "x$XQUARTZ" = xyes; then
|
||||||
AC_DEFINE(XQUARTZ,1,[Have Quartz])
|
AC_DEFINE(XQUARTZ,1,[Have Quartz])
|
||||||
AC_DEFINE(ROOTLESS,1,[Build Rootless code])
|
AC_DEFINE(ROOTLESS,1,[Build Rootless code])
|
||||||
|
|
||||||
DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $RECORD_LIB $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB"
|
DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB"
|
||||||
AC_SUBST([DARWIN_LIBS])
|
AC_SUBST([DARWIN_LIBS])
|
||||||
|
|
||||||
AC_CHECK_LIB([Xplugin],[xp_init],[:])
|
AC_CHECK_LIB([Xplugin],[xp_init],[:])
|
||||||
|
@ -1714,7 +1714,7 @@ if test "$KDRIVE" = yes; then
|
||||||
|
|
||||||
KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
|
KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
|
||||||
|
|
||||||
KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
|
KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
|
||||||
KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a'
|
KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a'
|
||||||
case $host_os in
|
case $host_os in
|
||||||
*linux*)
|
*linux*)
|
||||||
|
|
|
@ -103,9 +103,9 @@ xf86CrtcCreate (ScrnInfoPtr scrn,
|
||||||
#endif
|
#endif
|
||||||
crtc->rotation = RR_Rotate_0;
|
crtc->rotation = RR_Rotate_0;
|
||||||
crtc->desiredRotation = RR_Rotate_0;
|
crtc->desiredRotation = RR_Rotate_0;
|
||||||
PictureTransformInitIdentity (&crtc->crtc_to_framebuffer);
|
pixman_transform_init_identity (&crtc->crtc_to_framebuffer);
|
||||||
pict_f_transform_init_identity (&crtc->f_crtc_to_framebuffer);
|
pixman_f_transform_init_identity (&crtc->f_crtc_to_framebuffer);
|
||||||
pict_f_transform_init_identity (&crtc->f_framebuffer_to_crtc);
|
pixman_f_transform_init_identity (&crtc->f_framebuffer_to_crtc);
|
||||||
crtc->filter = NULL;
|
crtc->filter = NULL;
|
||||||
crtc->params = NULL;
|
crtc->params = NULL;
|
||||||
crtc->nparams = 0;
|
crtc->nparams = 0;
|
||||||
|
|
|
@ -329,7 +329,7 @@ xf86_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
|
||||||
struct pict_f_vector v;
|
struct pict_f_vector v;
|
||||||
|
|
||||||
v.v[0] = x + ScreenPriv->HotX; v.v[1] = y + ScreenPriv->HotY; v.v[2] = 1;
|
v.v[0] = x + ScreenPriv->HotX; v.v[1] = y + ScreenPriv->HotY; v.v[2] = 1;
|
||||||
pict_f_transform_point (&crtc->f_framebuffer_to_crtc, &v);
|
pixman_f_transform_point (&crtc->f_framebuffer_to_crtc, &v);
|
||||||
x = floor (v.v[0] + 0.5);
|
x = floor (v.v[0] + 0.5);
|
||||||
y = floor (v.v[1] + 0.5);
|
y = floor (v.v[1] + 0.5);
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -122,7 +122,7 @@ xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr region)
|
||||||
dst_box.x2 += crtc->filter_width >> 1;
|
dst_box.x2 += crtc->filter_width >> 1;
|
||||||
dst_box.y1 -= crtc->filter_height >> 1;
|
dst_box.y1 -= crtc->filter_height >> 1;
|
||||||
dst_box.y2 += crtc->filter_height >> 1;
|
dst_box.y2 += crtc->filter_height >> 1;
|
||||||
pict_f_transform_bounds (&crtc->f_framebuffer_to_crtc, &dst_box);
|
pixman_f_transform_bounds (&crtc->f_framebuffer_to_crtc, &dst_box);
|
||||||
CompositePicture (PictOpSrc,
|
CompositePicture (PictOpSrc,
|
||||||
src, NULL, dst,
|
src, NULL, dst,
|
||||||
dst_box.x1, dst_box.y1, 0, 0, dst_box.x1, dst_box.y1,
|
dst_box.x1, dst_box.y1, 0, 0, dst_box.x1, dst_box.y1,
|
||||||
|
@ -177,7 +177,7 @@ xf86CrtcDamageShadow (xf86CrtcPtr crtc)
|
||||||
damage_box.x2 = crtc->mode.HDisplay;
|
damage_box.x2 = crtc->mode.HDisplay;
|
||||||
damage_box.y1 = 0;
|
damage_box.y1 = 0;
|
||||||
damage_box.y2 = crtc->mode.VDisplay;
|
damage_box.y2 = crtc->mode.VDisplay;
|
||||||
if (!PictureTransformBounds (&damage_box, &crtc->crtc_to_framebuffer))
|
if (!pixman_transform_bounds (&crtc->crtc_to_framebuffer, &damage_box))
|
||||||
{
|
{
|
||||||
damage_box.x1 = 0;
|
damage_box.x1 = 0;
|
||||||
damage_box.y1 = 0;
|
damage_box.y1 = 0;
|
||||||
|
@ -375,7 +375,7 @@ xf86CrtcFitsScreen (xf86CrtcPtr crtc, struct pict_f_transform *crtc_to_fb)
|
||||||
b.x2 = crtc->mode.HDisplay;
|
b.x2 = crtc->mode.HDisplay;
|
||||||
b.y2 = crtc->mode.VDisplay;
|
b.y2 = crtc->mode.VDisplay;
|
||||||
if (crtc_to_fb)
|
if (crtc_to_fb)
|
||||||
pict_f_transform_bounds (crtc_to_fb, &b);
|
pixman_f_transform_bounds (crtc_to_fb, &b);
|
||||||
else {
|
else {
|
||||||
b.x1 += crtc->x;
|
b.x1 += crtc->x;
|
||||||
b.y1 += crtc->y;
|
b.y1 += crtc->y;
|
||||||
|
@ -532,7 +532,7 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
|
||||||
crtc->bounds.x2 = crtc->mode.HDisplay;
|
crtc->bounds.x2 = crtc->mode.HDisplay;
|
||||||
crtc->bounds.y1 = 0;
|
crtc->bounds.y1 = 0;
|
||||||
crtc->bounds.y2 = crtc->mode.VDisplay;
|
crtc->bounds.y2 = crtc->mode.VDisplay;
|
||||||
pict_f_transform_bounds (&f_crtc_to_fb, &crtc->bounds);
|
pixman_f_transform_bounds (&f_crtc_to_fb, &crtc->bounds);
|
||||||
|
|
||||||
/* All done */
|
/* All done */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -91,9 +91,9 @@ RRCrtcCreate (ScreenPtr pScreen, void *devPrivate)
|
||||||
crtc->devPrivate = devPrivate;
|
crtc->devPrivate = devPrivate;
|
||||||
RRTransformInit (&crtc->client_pending_transform);
|
RRTransformInit (&crtc->client_pending_transform);
|
||||||
RRTransformInit (&crtc->client_current_transform);
|
RRTransformInit (&crtc->client_current_transform);
|
||||||
PictureTransformInitIdentity (&crtc->transform);
|
pixman_transform_init_identity (&crtc->transform);
|
||||||
pict_f_transform_init_identity (&crtc->f_transform);
|
pixman_f_transform_init_identity (&crtc->f_transform);
|
||||||
pict_f_transform_init_identity (&crtc->f_inverse);
|
pixman_f_transform_init_identity (&crtc->f_inverse);
|
||||||
|
|
||||||
if (!AddResource (crtc->id, RRCrtcType, (pointer) crtc))
|
if (!AddResource (crtc->id, RRCrtcType, (pointer) crtc))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -395,7 +395,7 @@ RRCrtcGetTransform (RRCrtcPtr crtc)
|
||||||
{
|
{
|
||||||
RRTransformPtr transform = &crtc->client_pending_transform;
|
RRTransformPtr transform = &crtc->client_pending_transform;
|
||||||
|
|
||||||
if (PictureTransformIsIdentity (&transform->transform))
|
if (pixman_transform_is_identity (&transform->transform))
|
||||||
return NULL;
|
return NULL;
|
||||||
return transform;
|
return transform;
|
||||||
}
|
}
|
||||||
|
@ -508,7 +508,7 @@ RRModeGetScanoutSize (RRModePtr mode, PictTransformPtr transform,
|
||||||
box.x2 = mode->mode.width;
|
box.x2 = mode->mode.width;
|
||||||
box.y2 = mode->mode.height;
|
box.y2 = mode->mode.height;
|
||||||
|
|
||||||
PictureTransformBounds (&box, transform);
|
pixman_transform_bounds (transform, &box);
|
||||||
*width = box.x2 - box.x1;
|
*width = box.x2 - box.x1;
|
||||||
*height = box.y2 - box.y1;
|
*height = box.y2 - box.y1;
|
||||||
}
|
}
|
||||||
|
@ -558,8 +558,8 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc,
|
||||||
int
|
int
|
||||||
RRCrtcTransformSet (RRCrtcPtr crtc,
|
RRCrtcTransformSet (RRCrtcPtr crtc,
|
||||||
PictTransformPtr transform,
|
PictTransformPtr transform,
|
||||||
struct pict_f_transform *f_transform,
|
struct pixman_f_transform *f_transform,
|
||||||
struct pict_f_transform *f_inverse,
|
struct pixman_f_transform *f_inverse,
|
||||||
char *filter_name,
|
char *filter_name,
|
||||||
int filter_len,
|
int filter_len,
|
||||||
xFixed *params,
|
xFixed *params,
|
||||||
|
@ -909,7 +909,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
|
||||||
int source_width;
|
int source_width;
|
||||||
int source_height;
|
int source_height;
|
||||||
PictTransform transform;
|
PictTransform transform;
|
||||||
struct pict_f_transform f_transform, f_inverse;
|
struct pixman_f_transform f_transform, f_inverse;
|
||||||
|
|
||||||
RRTransformCompute (stuff->x, stuff->y,
|
RRTransformCompute (stuff->x, stuff->y,
|
||||||
mode->mode.width, mode->mode.height,
|
mode->mode.width, mode->mode.height,
|
||||||
|
@ -1011,7 +1011,7 @@ ProcRRGetCrtcGamma (ClientPtr client)
|
||||||
RRCrtcPtr crtc;
|
RRCrtcPtr crtc;
|
||||||
int n;
|
int n;
|
||||||
unsigned long len;
|
unsigned long len;
|
||||||
char *extra;
|
char *extra = NULL;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
|
REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
|
||||||
crtc = LookupCrtc (client, stuff->crtc, DixReadAccess);
|
crtc = LookupCrtc (client, stuff->crtc, DixReadAccess);
|
||||||
|
@ -1083,7 +1083,7 @@ ProcRRSetCrtcTransform (ClientPtr client)
|
||||||
REQUEST(xRRSetCrtcTransformReq);
|
REQUEST(xRRSetCrtcTransformReq);
|
||||||
RRCrtcPtr crtc;
|
RRCrtcPtr crtc;
|
||||||
PictTransform transform;
|
PictTransform transform;
|
||||||
struct pict_f_transform f_transform, f_inverse;
|
struct pixman_f_transform f_transform, f_inverse;
|
||||||
char *filter;
|
char *filter;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
xFixed *params;
|
xFixed *params;
|
||||||
|
@ -1095,8 +1095,8 @@ ProcRRSetCrtcTransform (ClientPtr client)
|
||||||
return RRErrorBase + BadRRCrtc;
|
return RRErrorBase + BadRRCrtc;
|
||||||
|
|
||||||
PictTransform_from_xRenderTransform (&transform, &stuff->transform);
|
PictTransform_from_xRenderTransform (&transform, &stuff->transform);
|
||||||
pict_f_transform_from_pixman_transform (&f_transform, &transform);
|
pixman_f_transform_from_pixman_transform (&f_transform, &transform);
|
||||||
if (!pict_f_transform_invert (&f_inverse, &f_transform))
|
if (!pixman_f_transform_invert (&f_inverse, &f_transform))
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
|
|
||||||
filter = (char *) (stuff + 1);
|
filter = (char *) (stuff + 1);
|
||||||
|
|
|
@ -461,7 +461,7 @@ ProcRRQueryOutputProperty (ClientPtr client)
|
||||||
xRRQueryOutputPropertyReply rep;
|
xRRQueryOutputPropertyReply rep;
|
||||||
RROutputPtr output;
|
RROutputPtr output;
|
||||||
RRPropertyPtr prop;
|
RRPropertyPtr prop;
|
||||||
char *extra;
|
char *extra = NULL;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq);
|
REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq);
|
||||||
|
|
||||||
|
@ -613,7 +613,7 @@ ProcRRGetOutputProperty (ClientPtr client)
|
||||||
unsigned long n, len, ind;
|
unsigned long n, len, ind;
|
||||||
RROutputPtr output;
|
RROutputPtr output;
|
||||||
xRRGetOutputPropertyReply reply;
|
xRRGetOutputPropertyReply reply;
|
||||||
char *extra;
|
char *extra = NULL;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq);
|
REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq);
|
||||||
if (stuff->delete)
|
if (stuff->delete)
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
void
|
void
|
||||||
RRTransformInit (RRTransformPtr transform)
|
RRTransformInit (RRTransformPtr transform)
|
||||||
{
|
{
|
||||||
PictureTransformInitIdentity (&transform->transform);
|
pixman_transform_init_identity (&transform->transform);
|
||||||
pict_f_transform_init_identity (&transform->f_transform);
|
pixman_f_transform_init_identity (&transform->f_transform);
|
||||||
pict_f_transform_init_identity (&transform->f_inverse);
|
pixman_f_transform_init_identity (&transform->f_inverse);
|
||||||
transform->filter = NULL;
|
transform->filter = NULL;
|
||||||
transform->params = NULL;
|
transform->params = NULL;
|
||||||
transform->nparams = 0;
|
transform->nparams = 0;
|
||||||
|
@ -44,9 +44,9 @@ RRTransformFini (RRTransformPtr transform)
|
||||||
Bool
|
Bool
|
||||||
RRTransformEqual (RRTransformPtr a, RRTransformPtr b)
|
RRTransformEqual (RRTransformPtr a, RRTransformPtr b)
|
||||||
{
|
{
|
||||||
if (a && PictureTransformIsIdentity (&a->transform))
|
if (a && pixman_transform_is_identity (&a->transform))
|
||||||
a = NULL;
|
a = NULL;
|
||||||
if (b && PictureTransformIsIdentity (&b->transform))
|
if (b && pixman_transform_is_identity (&b->transform))
|
||||||
b = NULL;
|
b = NULL;
|
||||||
if (a == NULL && b == NULL)
|
if (a == NULL && b == NULL)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -95,7 +95,7 @@ RRTransformSetFilter (RRTransformPtr dst,
|
||||||
Bool
|
Bool
|
||||||
RRTransformCopy (RRTransformPtr dst, RRTransformPtr src)
|
RRTransformCopy (RRTransformPtr dst, RRTransformPtr src)
|
||||||
{
|
{
|
||||||
if (src && PictureTransformIsIdentity (&src->transform))
|
if (src && pixman_transform_is_identity (&src->transform))
|
||||||
src = NULL;
|
src = NULL;
|
||||||
|
|
||||||
if (src)
|
if (src)
|
||||||
|
@ -111,9 +111,9 @@ RRTransformCopy (RRTransformPtr dst, RRTransformPtr src)
|
||||||
{
|
{
|
||||||
if (!RRTransformSetFilter (dst, NULL, NULL, 0, 0, 0))
|
if (!RRTransformSetFilter (dst, NULL, NULL, 0, 0, 0))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
PictureTransformInitIdentity (&dst->transform);
|
pixman_transform_init_identity (&dst->transform);
|
||||||
pict_f_transform_init_identity (&dst->f_transform);
|
pixman_f_transform_init_identity (&dst->f_transform);
|
||||||
pict_f_transform_init_identity (&dst->f_inverse);
|
pixman_f_transform_init_identity (&dst->f_inverse);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -136,20 +136,20 @@ RRTransformCompute (int x,
|
||||||
RRTransformPtr rr_transform,
|
RRTransformPtr rr_transform,
|
||||||
|
|
||||||
PictTransformPtr transform,
|
PictTransformPtr transform,
|
||||||
struct pict_f_transform *f_transform,
|
struct pixman_f_transform *f_transform,
|
||||||
struct pict_f_transform *f_inverse)
|
struct pixman_f_transform *f_inverse)
|
||||||
{
|
{
|
||||||
PictTransform t_transform, inverse;
|
PictTransform t_transform, inverse;
|
||||||
struct pict_f_transform tf_transform, tf_inverse;
|
struct pixman_f_transform tf_transform, tf_inverse;
|
||||||
|
|
||||||
if (!transform) transform = &t_transform;
|
if (!transform) transform = &t_transform;
|
||||||
if (!f_transform) f_transform = &tf_transform;
|
if (!f_transform) f_transform = &tf_transform;
|
||||||
if (!f_inverse) f_inverse = &tf_inverse;
|
if (!f_inverse) f_inverse = &tf_inverse;
|
||||||
|
|
||||||
PictureTransformInitIdentity (transform);
|
pixman_transform_init_identity (transform);
|
||||||
PictureTransformInitIdentity (&inverse);
|
pixman_transform_init_identity (&inverse);
|
||||||
pict_f_transform_init_identity (f_transform);
|
pixman_f_transform_init_identity (f_transform);
|
||||||
pict_f_transform_init_identity (f_inverse);
|
pixman_f_transform_init_identity (f_inverse);
|
||||||
if (rotation != RR_Rotate_0)
|
if (rotation != RR_Rotate_0)
|
||||||
{
|
{
|
||||||
double f_rot_cos, f_rot_sin, f_rot_dx, f_rot_dy;
|
double f_rot_cos, f_rot_sin, f_rot_dx, f_rot_dy;
|
||||||
|
@ -186,10 +186,10 @@ RRTransformCompute (int x,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
PictureTransformRotate (transform, &inverse, rot_cos, rot_sin);
|
pixman_transform_rotate (transform, &inverse, rot_cos, rot_sin);
|
||||||
PictureTransformTranslate (transform, &inverse, rot_dx, rot_dy);
|
pixman_transform_translate (transform, &inverse, rot_dx, rot_dy);
|
||||||
pict_f_transform_rotate (f_transform, f_inverse, f_rot_cos, f_rot_sin);
|
pixman_f_transform_rotate (f_transform, f_inverse, f_rot_cos, f_rot_sin);
|
||||||
pict_f_transform_translate (f_transform, f_inverse, f_rot_dx, f_rot_dy);
|
pixman_f_transform_translate (f_transform, f_inverse, f_rot_dx, f_rot_dy);
|
||||||
|
|
||||||
/* reflection */
|
/* reflection */
|
||||||
f_scale_x = 1;
|
f_scale_x = 1;
|
||||||
|
@ -225,35 +225,35 @@ RRTransformCompute (int x,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PictureTransformScale (transform, &inverse, scale_x, scale_y);
|
pixman_transform_scale (transform, &inverse, scale_x, scale_y);
|
||||||
pict_f_transform_scale (f_transform, f_inverse, f_scale_x, f_scale_y);
|
pixman_f_transform_scale (f_transform, f_inverse, f_scale_x, f_scale_y);
|
||||||
PictureTransformTranslate (transform, &inverse, scale_dx, scale_dy);
|
pixman_transform_translate (transform, &inverse, scale_dx, scale_dy);
|
||||||
pict_f_transform_translate (f_transform, f_inverse, f_scale_dx, f_scale_dy);
|
pixman_f_transform_translate (f_transform, f_inverse, f_scale_dx, f_scale_dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RANDR_12_INTERFACE
|
#ifdef RANDR_12_INTERFACE
|
||||||
if (rr_transform)
|
if (rr_transform)
|
||||||
{
|
{
|
||||||
PictureTransformMultiply (transform, transform, &rr_transform->transform);
|
pixman_transform_multiply (transform, transform, &rr_transform->transform);
|
||||||
pict_f_transform_multiply (f_transform, f_transform, &rr_transform->f_transform);
|
pixman_f_transform_multiply (f_transform, f_transform, &rr_transform->f_transform);
|
||||||
pict_f_transform_multiply (f_inverse, &rr_transform->f_inverse, f_inverse);
|
pixman_f_transform_multiply (f_inverse, &rr_transform->f_inverse, f_inverse);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* Compute the class of the resulting transform
|
* Compute the class of the resulting transform
|
||||||
*/
|
*/
|
||||||
if (PictureTransformIsIdentity (transform))
|
if (pixman_transform_is_identity (transform))
|
||||||
{
|
{
|
||||||
PictureTransformInitTranslate (transform, F ( x), F ( y));
|
pixman_transform_init_translate (transform, F ( x), F ( y));
|
||||||
|
|
||||||
pict_f_transform_init_translate (f_transform, F( x), F( y));
|
pixman_f_transform_init_translate (f_transform, F( x), F( y));
|
||||||
pict_f_transform_init_translate (f_inverse, F(-x), F(-y));
|
pixman_f_transform_init_translate (f_inverse, F(-x), F(-y));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PictureTransformTranslate (&inverse, transform, x, y);
|
pixman_transform_translate (&inverse, transform, x, y);
|
||||||
pict_f_transform_translate (f_inverse, f_transform, x, y);
|
pixman_f_transform_translate (f_inverse, f_transform, x, y);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
559
render/matrix.c
559
render/matrix.c
|
@ -39,314 +39,6 @@
|
||||||
#include "servermd.h"
|
#include "servermd.h"
|
||||||
#include "picturestr.h"
|
#include "picturestr.h"
|
||||||
|
|
||||||
#define F(x) IntToxFixed(x)
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
PictureTransformInitIdentity (PictTransformPtr matrix)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
memset (matrix, '\0', sizeof (PictTransform));
|
|
||||||
for (i = 0; i < 3; i++)
|
|
||||||
matrix->matrix[i][i] = F(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef xFixed_32_32 xFixed_34_30;
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
PictureTransformPoint3d (PictTransformPtr transform,
|
|
||||||
PictVectorPtr vector)
|
|
||||||
{
|
|
||||||
PictVector result;
|
|
||||||
int i, j;
|
|
||||||
xFixed_32_32 partial;
|
|
||||||
xFixed_48_16 v;
|
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
|
||||||
{
|
|
||||||
v = 0;
|
|
||||||
for (i = 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
partial = ((xFixed_48_16) transform->matrix[j][i] *
|
|
||||||
(xFixed_48_16) vector->vector[i]);
|
|
||||||
v += partial >> 16;
|
|
||||||
}
|
|
||||||
if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16)
|
|
||||||
return FALSE;
|
|
||||||
result.vector[j] = (xFixed) v;
|
|
||||||
}
|
|
||||||
*vector = result;
|
|
||||||
if (!result.vector[2])
|
|
||||||
return FALSE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
PictureTransformPoint (PictTransformPtr transform,
|
|
||||||
PictVectorPtr vector)
|
|
||||||
{
|
|
||||||
int i, j;
|
|
||||||
xFixed_32_32 partial;
|
|
||||||
xFixed_34_30 v[3];
|
|
||||||
xFixed_48_16 quo;
|
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
|
||||||
{
|
|
||||||
v[j] = 0;
|
|
||||||
for (i = 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
partial = ((xFixed_32_32) transform->matrix[j][i] *
|
|
||||||
(xFixed_32_32) vector->vector[i]);
|
|
||||||
v[j] += partial >> 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!v[2])
|
|
||||||
return FALSE;
|
|
||||||
for (j = 0; j < 2; j++)
|
|
||||||
{
|
|
||||||
quo = v[j] / (v[2] >> 16);
|
|
||||||
if (quo > MAX_FIXED_48_16 || quo < MIN_FIXED_48_16)
|
|
||||||
return FALSE;
|
|
||||||
vector->vector[j] = (xFixed) quo;
|
|
||||||
}
|
|
||||||
vector->vector[2] = xFixed1;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
PictureTransformMultiply (PictTransformPtr dst, PictTransformPtr l, PictTransformPtr r)
|
|
||||||
{
|
|
||||||
PictTransform d;
|
|
||||||
int dx, dy;
|
|
||||||
int o;
|
|
||||||
|
|
||||||
for (dy = 0; dy < 3; dy++)
|
|
||||||
for (dx = 0; dx < 3; dx++)
|
|
||||||
{
|
|
||||||
xFixed_48_16 v;
|
|
||||||
xFixed_32_32 partial;
|
|
||||||
v = 0;
|
|
||||||
for (o = 0; o < 3; o++)
|
|
||||||
{
|
|
||||||
partial = (xFixed_32_32) l->matrix[dy][o] * (xFixed_32_32) r->matrix[o][dx];
|
|
||||||
v += partial >> 16;
|
|
||||||
}
|
|
||||||
if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16)
|
|
||||||
return FALSE;
|
|
||||||
d.matrix[dy][dx] = (xFixed) v;
|
|
||||||
}
|
|
||||||
*dst = d;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
PictureTransformInitScale (PictTransformPtr t, xFixed sx, xFixed sy)
|
|
||||||
{
|
|
||||||
memset (t, '\0', sizeof (PictTransform));
|
|
||||||
t->matrix[0][0] = sx;
|
|
||||||
t->matrix[1][1] = sy;
|
|
||||||
t->matrix[2][2] = F (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static xFixed
|
|
||||||
fixed_inverse (xFixed x)
|
|
||||||
{
|
|
||||||
return (xFixed) ((((xFixed_48_16) F(1)) * F(1)) / x);
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
PictureTransformScale (PictTransformPtr forward,
|
|
||||||
PictTransformPtr reverse,
|
|
||||||
xFixed sx, xFixed sy)
|
|
||||||
{
|
|
||||||
PictTransform t;
|
|
||||||
|
|
||||||
if (sx == 0 || sy == 0)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
PictureTransformInitScale (&t, sx, sy);
|
|
||||||
if (!PictureTransformMultiply (forward, &t, forward))
|
|
||||||
return FALSE;
|
|
||||||
PictureTransformInitScale (&t, fixed_inverse (sx), fixed_inverse (sy));
|
|
||||||
if (!PictureTransformMultiply (reverse, reverse, &t))
|
|
||||||
return FALSE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
PictureTransformInitRotate (PictTransformPtr t, xFixed c, xFixed s)
|
|
||||||
{
|
|
||||||
memset (t, '\0', sizeof (PictTransform));
|
|
||||||
t->matrix[0][0] = c;
|
|
||||||
t->matrix[0][1] = -s;
|
|
||||||
t->matrix[1][0] = s;
|
|
||||||
t->matrix[1][1] = c;
|
|
||||||
t->matrix[2][2] = F (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
PictureTransformRotate (PictTransformPtr forward,
|
|
||||||
PictTransformPtr reverse,
|
|
||||||
xFixed c, xFixed s)
|
|
||||||
{
|
|
||||||
PictTransform t;
|
|
||||||
PictureTransformInitRotate (&t, c, s);
|
|
||||||
if (!PictureTransformMultiply (forward, &t, forward))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
PictureTransformInitRotate (&t, c, -s);
|
|
||||||
if (!PictureTransformMultiply (reverse, reverse, &t))
|
|
||||||
return FALSE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
PictureTransformInitTranslate (PictTransformPtr t, xFixed tx, xFixed ty)
|
|
||||||
{
|
|
||||||
memset (t, '\0', sizeof (PictTransform));
|
|
||||||
t->matrix[0][0] = F (1);
|
|
||||||
t->matrix[0][2] = tx;
|
|
||||||
t->matrix[1][1] = F (1);
|
|
||||||
t->matrix[1][2] = ty;
|
|
||||||
t->matrix[2][2] = F (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
PictureTransformTranslate (PictTransformPtr forward,
|
|
||||||
PictTransformPtr reverse,
|
|
||||||
xFixed tx, xFixed ty)
|
|
||||||
{
|
|
||||||
PictTransform t;
|
|
||||||
PictureTransformInitTranslate (&t, tx, ty);
|
|
||||||
if (!PictureTransformMultiply (forward, &t, forward))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
PictureTransformInitTranslate (&t, -tx, -ty);
|
|
||||||
if (!PictureTransformMultiply (reverse, reverse, &t))
|
|
||||||
return FALSE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
PictureTransformBounds (BoxPtr b, PictTransformPtr matrix)
|
|
||||||
{
|
|
||||||
PictVector v[4];
|
|
||||||
int i;
|
|
||||||
int x1, y1, x2, y2;
|
|
||||||
|
|
||||||
v[0].vector[0] = F (b->x1); v[0].vector[1] = F (b->y1); v[0].vector[2] = F(1);
|
|
||||||
v[1].vector[0] = F (b->x2); v[1].vector[1] = F (b->y1); v[1].vector[2] = F(1);
|
|
||||||
v[2].vector[0] = F (b->x2); v[2].vector[1] = F (b->y2); v[2].vector[2] = F(1);
|
|
||||||
v[3].vector[0] = F (b->x1); v[3].vector[1] = F (b->y2); v[3].vector[2] = F(1);
|
|
||||||
for (i = 0; i < 4; i++)
|
|
||||||
{
|
|
||||||
if (!PictureTransformPoint (matrix, &v[i]))
|
|
||||||
return FALSE;
|
|
||||||
x1 = xFixedToInt (v[i].vector[0]);
|
|
||||||
y1 = xFixedToInt (v[i].vector[1]);
|
|
||||||
x2 = xFixedToInt (xFixedCeil (v[i].vector[0]));
|
|
||||||
y2 = xFixedToInt (xFixedCeil (v[i].vector[1]));
|
|
||||||
if (i == 0)
|
|
||||||
{
|
|
||||||
b->x1 = x1; b->y1 = y1;
|
|
||||||
b->x2 = x2; b->y2 = y2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (x1 < b->x1) b->x1 = x1;
|
|
||||||
if (y1 < b->y1) b->y1 = y1;
|
|
||||||
if (x2 > b->x2) b->x2 = x2;
|
|
||||||
if (y2 > b->y2) b->y2 = y2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
PictureTransformInvert (PictTransformPtr dst, const PictTransformPtr src)
|
|
||||||
{
|
|
||||||
struct pict_f_transform m, r;
|
|
||||||
|
|
||||||
pict_f_transform_from_pixman_transform (&m, src);
|
|
||||||
if (!pict_f_transform_invert (&r, &m))
|
|
||||||
return FALSE;
|
|
||||||
if (!pixman_transform_from_pict_f_transform (dst, &r))
|
|
||||||
return FALSE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
within_epsilon (xFixed a, xFixed b, xFixed epsilon)
|
|
||||||
{
|
|
||||||
xFixed t = a - b;
|
|
||||||
if (t < 0) t = -t;
|
|
||||||
return t <= epsilon;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define epsilon (xFixed) (2)
|
|
||||||
|
|
||||||
#define IsSame(a,b) (within_epsilon (a, b, epsilon))
|
|
||||||
#define IsZero(a) (within_epsilon (a, 0, epsilon))
|
|
||||||
#define IsOne(a) (within_epsilon (a, F(1), epsilon))
|
|
||||||
#define IsUnit(a) (within_epsilon (a, F( 1), epsilon) || \
|
|
||||||
within_epsilon (a, F(-1), epsilon) || \
|
|
||||||
IsZero (a))
|
|
||||||
#define IsInt(a) (IsZero (xFixedFrac(a)))
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
PictureTransformIsIdentity(PictTransform *t)
|
|
||||||
{
|
|
||||||
return (IsSame (t->matrix[0][0], t->matrix[1][1]) &&
|
|
||||||
IsSame (t->matrix[0][0], t->matrix[2][2]) &&
|
|
||||||
!IsZero (t->matrix[0][0]) &&
|
|
||||||
IsZero (t->matrix[0][1]) &&
|
|
||||||
IsZero (t->matrix[0][2]) &&
|
|
||||||
IsZero (t->matrix[1][0]) &&
|
|
||||||
IsZero (t->matrix[1][2]) &&
|
|
||||||
IsZero (t->matrix[2][0]) &&
|
|
||||||
IsZero (t->matrix[2][1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
PictureTransformIsScale(PictTransform *t)
|
|
||||||
{
|
|
||||||
return (!IsZero (t->matrix[0][0]) &&
|
|
||||||
IsZero (t->matrix[0][1]) &&
|
|
||||||
IsZero (t->matrix[0][2]) &&
|
|
||||||
|
|
||||||
IsZero (t->matrix[1][0]) &&
|
|
||||||
!IsZero (t->matrix[1][1]) &&
|
|
||||||
IsZero (t->matrix[1][2]) &&
|
|
||||||
|
|
||||||
IsZero (t->matrix[2][0]) &&
|
|
||||||
IsZero (t->matrix[2][1]) &&
|
|
||||||
!IsZero (t->matrix[2][2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
PictureTransformIsIntTranslate(PictTransform *t)
|
|
||||||
{
|
|
||||||
return ( IsOne (t->matrix[0][0]) &&
|
|
||||||
IsZero (t->matrix[0][1]) &&
|
|
||||||
IsInt (t->matrix[0][2]) &&
|
|
||||||
|
|
||||||
IsZero (t->matrix[1][0]) &&
|
|
||||||
IsOne (t->matrix[1][1]) &&
|
|
||||||
IsInt (t->matrix[1][2]) &&
|
|
||||||
|
|
||||||
IsZero (t->matrix[2][0]) &&
|
|
||||||
IsZero (t->matrix[2][1]) &&
|
|
||||||
IsOne (t->matrix[2][2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
PictureTransformIsInverse (PictTransform *a, PictTransform *b)
|
|
||||||
{
|
|
||||||
PictTransform t;
|
|
||||||
|
|
||||||
PictureTransformMultiply (&t, a, b);
|
|
||||||
return PictureTransformIsIdentity (&t);
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
PictTransform_from_xRenderTransform (PictTransformPtr pict,
|
PictTransform_from_xRenderTransform (PictTransformPtr pict,
|
||||||
xRenderTransform *render)
|
xRenderTransform *render)
|
||||||
|
@ -364,7 +56,7 @@ PictTransform_from_xRenderTransform (PictTransformPtr pict,
|
||||||
pict->matrix[2][2] = render->matrix33;
|
pict->matrix[2][2] = render->matrix33;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
_X_EXPORT void
|
||||||
xRenderTransform_from_PictTransform (xRenderTransform *render,
|
xRenderTransform_from_PictTransform (xRenderTransform *render,
|
||||||
PictTransformPtr pict)
|
PictTransformPtr pict)
|
||||||
{
|
{
|
||||||
|
@ -381,251 +73,16 @@ xRenderTransform_from_PictTransform (xRenderTransform *render,
|
||||||
render->matrix33 = pict->matrix[2][2];
|
render->matrix33 = pict->matrix[2][2];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
_X_EXPORT Bool
|
||||||
* Floating point matrix interfaces
|
PictureTransformPoint (PictTransformPtr transform,
|
||||||
*/
|
PictVectorPtr vector)
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
pict_f_transform_from_pixman_transform (struct pict_f_transform *ft,
|
|
||||||
struct pixman_transform *t)
|
|
||||||
{
|
{
|
||||||
int i, j;
|
return pixman_transform_point(transform, vector);
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
|
||||||
for (i = 0; i < 3; i++)
|
|
||||||
ft->m[j][i] = pixman_fixed_to_double (t->matrix[j][i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT Bool
|
_X_EXPORT Bool
|
||||||
pixman_transform_from_pict_f_transform (struct pixman_transform *t,
|
PictureTransformPoint3d (PictTransformPtr transform,
|
||||||
struct pict_f_transform *ft)
|
PictVectorPtr vector)
|
||||||
{
|
{
|
||||||
int i, j;
|
return pixman_transform_point_3d(transform, vector);
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
|
||||||
for (i = 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
double d = ft->m[j][i];
|
|
||||||
if (d < -32767.0 || d > 32767.0)
|
|
||||||
return FALSE;
|
|
||||||
d = d * 65536.0 + 0.5;
|
|
||||||
t->matrix[j][i] = (xFixed) floor (d);
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const int a[3] = { 3, 3, 2 };
|
|
||||||
static const int b[3] = { 2, 1, 1 };
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
pict_f_transform_invert (struct pict_f_transform *r,
|
|
||||||
struct pict_f_transform *m)
|
|
||||||
{
|
|
||||||
double det;
|
|
||||||
int i, j;
|
|
||||||
static int a[3] = { 2, 2, 1 };
|
|
||||||
static int b[3] = { 1, 0, 0 };
|
|
||||||
|
|
||||||
det = 0;
|
|
||||||
for (i = 0; i < 3; i++) {
|
|
||||||
double p;
|
|
||||||
int ai = a[i];
|
|
||||||
int bi = b[i];
|
|
||||||
p = m->m[i][0] * (m->m[ai][2] * m->m[bi][1] - m->m[ai][1] * m->m[bi][2]);
|
|
||||||
if (i == 1)
|
|
||||||
p = -p;
|
|
||||||
det += p;
|
|
||||||
}
|
|
||||||
if (det == 0)
|
|
||||||
return FALSE;
|
|
||||||
det = 1/det;
|
|
||||||
for (j = 0; j < 3; j++) {
|
|
||||||
for (i = 0; i < 3; i++) {
|
|
||||||
double p;
|
|
||||||
int ai = a[i];
|
|
||||||
int aj = a[j];
|
|
||||||
int bi = b[i];
|
|
||||||
int bj = b[j];
|
|
||||||
|
|
||||||
p = m->m[ai][aj] * m->m[bi][bj] - m->m[ai][bj] * m->m[bi][aj];
|
|
||||||
if (((i + j) & 1) != 0)
|
|
||||||
p = -p;
|
|
||||||
r->m[j][i] = det * p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
pict_f_transform_point (struct pict_f_transform *t,
|
|
||||||
struct pict_f_vector *v)
|
|
||||||
{
|
|
||||||
struct pict_f_vector result;
|
|
||||||
int i, j;
|
|
||||||
double a;
|
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
|
||||||
{
|
|
||||||
a = 0;
|
|
||||||
for (i = 0; i < 3; i++)
|
|
||||||
a += t->m[j][i] * v->v[i];
|
|
||||||
result.v[j] = a;
|
|
||||||
}
|
|
||||||
if (!result.v[2])
|
|
||||||
return FALSE;
|
|
||||||
for (j = 0; j < 2; j++)
|
|
||||||
v->v[j] = result.v[j] / result.v[2];
|
|
||||||
v->v[2] = 1;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
pict_f_transform_point_3d (struct pict_f_transform *t,
|
|
||||||
struct pict_f_vector *v)
|
|
||||||
{
|
|
||||||
struct pict_f_vector result;
|
|
||||||
int i, j;
|
|
||||||
double a;
|
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
|
||||||
{
|
|
||||||
a = 0;
|
|
||||||
for (i = 0; i < 3; i++)
|
|
||||||
a += t->m[j][i] * v->v[i];
|
|
||||||
result.v[j] = a;
|
|
||||||
}
|
|
||||||
*v = result;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
pict_f_transform_multiply (struct pict_f_transform *dst,
|
|
||||||
struct pict_f_transform *l, struct pict_f_transform *r)
|
|
||||||
{
|
|
||||||
struct pict_f_transform d;
|
|
||||||
int dx, dy;
|
|
||||||
int o;
|
|
||||||
|
|
||||||
for (dy = 0; dy < 3; dy++)
|
|
||||||
for (dx = 0; dx < 3; dx++)
|
|
||||||
{
|
|
||||||
double v = 0;
|
|
||||||
for (o = 0; o < 3; o++)
|
|
||||||
v += l->m[dy][o] * r->m[o][dx];
|
|
||||||
d.m[dy][dx] = v;
|
|
||||||
}
|
|
||||||
*dst = d;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
pict_f_transform_init_scale (struct pict_f_transform *t, double sx, double sy)
|
|
||||||
{
|
|
||||||
t->m[0][0] = sx; t->m[0][1] = 0; t->m[0][2] = 0;
|
|
||||||
t->m[1][0] = 0; t->m[1][1] = sy; t->m[1][2] = 0;
|
|
||||||
t->m[2][0] = 0; t->m[2][1] = 0; t->m[2][2] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
pict_f_transform_scale (struct pict_f_transform *forward,
|
|
||||||
struct pict_f_transform *reverse,
|
|
||||||
double sx, double sy)
|
|
||||||
{
|
|
||||||
struct pict_f_transform t;
|
|
||||||
|
|
||||||
if (sx == 0 || sy == 0)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
pict_f_transform_init_scale (&t, sx, sy);
|
|
||||||
pict_f_transform_multiply (forward, &t, forward);
|
|
||||||
pict_f_transform_init_scale (&t, 1/sx, 1/sy);
|
|
||||||
pict_f_transform_multiply (reverse, reverse, &t);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
pict_f_transform_init_rotate (struct pict_f_transform *t, double c, double s)
|
|
||||||
{
|
|
||||||
t->m[0][0] = c; t->m[0][1] = -s; t->m[0][2] = 0;
|
|
||||||
t->m[1][0] = s; t->m[1][1] = c; t->m[1][2] = 0;
|
|
||||||
t->m[2][0] = 0; t->m[2][1] = 0; t->m[2][2] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
pict_f_transform_rotate (struct pict_f_transform *forward,
|
|
||||||
struct pict_f_transform *reverse,
|
|
||||||
double c, double s)
|
|
||||||
{
|
|
||||||
struct pict_f_transform t;
|
|
||||||
|
|
||||||
pict_f_transform_init_rotate (&t, c, s);
|
|
||||||
pict_f_transform_multiply (forward, &t, forward);
|
|
||||||
pict_f_transform_init_rotate (&t, c, -s);
|
|
||||||
pict_f_transform_multiply (reverse, reverse, &t);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
pict_f_transform_init_translate (struct pict_f_transform *t, double tx, double ty)
|
|
||||||
{
|
|
||||||
t->m[0][0] = 1; t->m[0][1] = 0; t->m[0][2] = tx;
|
|
||||||
t->m[1][0] = 0; t->m[1][1] = 1; t->m[1][2] = ty;
|
|
||||||
t->m[2][0] = 0; t->m[2][1] = 0; t->m[2][2] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
pict_f_transform_translate (struct pict_f_transform *forward,
|
|
||||||
struct pict_f_transform *reverse,
|
|
||||||
double tx, double ty)
|
|
||||||
{
|
|
||||||
struct pict_f_transform t;
|
|
||||||
|
|
||||||
pict_f_transform_init_translate (&t, tx, ty);
|
|
||||||
pict_f_transform_multiply (forward, &t, forward);
|
|
||||||
pict_f_transform_init_translate (&t, -tx, -ty);
|
|
||||||
pict_f_transform_multiply (reverse, reverse, &t);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
pict_f_transform_bounds (struct pict_f_transform *t, BoxPtr b)
|
|
||||||
{
|
|
||||||
struct pict_f_vector v[4];
|
|
||||||
int i;
|
|
||||||
int x1, y1, x2, y2;
|
|
||||||
|
|
||||||
v[0].v[0] = b->x1; v[0].v[1] = b->y1; v[0].v[2] = 1;
|
|
||||||
v[1].v[0] = b->x2; v[1].v[1] = b->y1; v[1].v[2] = 1;
|
|
||||||
v[2].v[0] = b->x2; v[2].v[1] = b->y2; v[2].v[2] = 1;
|
|
||||||
v[3].v[0] = b->x1; v[3].v[1] = b->y2; v[3].v[2] = 1;
|
|
||||||
for (i = 0; i < 4; i++)
|
|
||||||
{
|
|
||||||
if (!pict_f_transform_point (t, &v[i]))
|
|
||||||
return FALSE;
|
|
||||||
x1 = floor (v[i].v[0]);
|
|
||||||
y1 = floor (v[i].v[1]);
|
|
||||||
x2 = ceil (v[i].v[0]);
|
|
||||||
y2 = ceil (v[i].v[1]);
|
|
||||||
if (i == 0)
|
|
||||||
{
|
|
||||||
b->x1 = x1; b->y1 = y1;
|
|
||||||
b->x2 = x2; b->y2 = y2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (x1 < b->x1) b->x1 = x1;
|
|
||||||
if (y1 < b->y1) b->y1 = y1;
|
|
||||||
if (x2 > b->x2) b->x2 = x2;
|
|
||||||
if (y2 > b->y2) b->y2 = y2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
pict_f_transform_init_identity (struct pict_f_transform *t)
|
|
||||||
{
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
|
||||||
for (i = 0; i < 3; i++)
|
|
||||||
t->m[j][i] = i == j ? 1 : 0;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,7 +379,7 @@ miCompositeSourceValidate (PicturePtr pPicture,
|
||||||
t.vector[0] = IntToxFixed (points[i].x);
|
t.vector[0] = IntToxFixed (points[i].x);
|
||||||
t.vector[1] = IntToxFixed (points[i].y);
|
t.vector[1] = IntToxFixed (points[i].y);
|
||||||
t.vector[2] = xFixed1;
|
t.vector[2] = xFixed1;
|
||||||
if (PictureTransformPoint (pPicture->transform, &t))
|
if (pixman_transform_point (pPicture->transform, &t))
|
||||||
{
|
{
|
||||||
int tx = xFixedToInt (t.vector[0]);
|
int tx = xFixedToInt (t.vector[0]);
|
||||||
int ty = xFixedToInt (t.vector[1]);
|
int ty = xFixedToInt (t.vector[1]);
|
||||||
|
|
|
@ -56,13 +56,8 @@ typedef struct _PictFormat {
|
||||||
typedef struct pixman_vector PictVector, *PictVectorPtr;
|
typedef struct pixman_vector PictVector, *PictVectorPtr;
|
||||||
typedef struct pixman_transform PictTransform, *PictTransformPtr;
|
typedef struct pixman_transform PictTransform, *PictTransformPtr;
|
||||||
|
|
||||||
struct pict_f_vector {
|
#define pict_f_vector pixman_f_vector
|
||||||
double v[3];
|
#define pict_f_transform pixman_f_transform
|
||||||
};
|
|
||||||
|
|
||||||
struct pict_f_transform {
|
|
||||||
double m[3][3];
|
|
||||||
};
|
|
||||||
|
|
||||||
#define PICT_GRADIENT_STOPTABLE_SIZE 1024
|
#define PICT_GRADIENT_STOPTABLE_SIZE 1024
|
||||||
#define SourcePictTypeSolidFill 0
|
#define SourcePictTypeSolidFill 0
|
||||||
|
@ -685,62 +680,6 @@ void PanoramiXRenderReset (void);
|
||||||
/*
|
/*
|
||||||
* matrix.c
|
* matrix.c
|
||||||
*/
|
*/
|
||||||
void
|
|
||||||
PictureTransformInitIdentity (PictTransformPtr matrix);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
PictureTransformPoint3d (PictTransformPtr transform,
|
|
||||||
PictVectorPtr vector);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
PictureTransformPoint (PictTransformPtr transform,
|
|
||||||
PictVectorPtr vector);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
PictureTransformMultiply (PictTransformPtr dst,
|
|
||||||
PictTransformPtr l, PictTransformPtr r);
|
|
||||||
|
|
||||||
void
|
|
||||||
PictureTransformInitScale (PictTransformPtr t, xFixed sx, xFixed sy);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
PictureTransformScale (PictTransformPtr forward,
|
|
||||||
PictTransformPtr reverse,
|
|
||||||
xFixed sx, xFixed sy);
|
|
||||||
|
|
||||||
void
|
|
||||||
PictureTransformInitRotate (PictTransformPtr t, xFixed c, xFixed s);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
PictureTransformRotate (PictTransformPtr forward,
|
|
||||||
PictTransformPtr reverse,
|
|
||||||
xFixed c, xFixed s);
|
|
||||||
|
|
||||||
void
|
|
||||||
PictureTransformInitTranslate (PictTransformPtr t, xFixed tx, xFixed ty);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
PictureTransformTranslate (PictTransformPtr forward,
|
|
||||||
PictTransformPtr reverse,
|
|
||||||
xFixed tx, xFixed ty);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
PictureTransformBounds (BoxPtr b, PictTransformPtr matrix);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
PictureTransformInvert (PictTransformPtr dst, const PictTransformPtr src);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
PictureTransformIsIdentity(PictTransform *t);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
PictureTransformIsScale(PictTransform *t);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
PictureTransformIsIntTranslate (PictTransform *t);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
PictureTransformIsInverse(PictTransform *t, PictTransform *i);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PictTransform_from_xRenderTransform (PictTransformPtr pict,
|
PictTransform_from_xRenderTransform (PictTransformPtr pict,
|
||||||
|
@ -750,59 +689,12 @@ void
|
||||||
xRenderTransform_from_PictTransform (xRenderTransform *render,
|
xRenderTransform_from_PictTransform (xRenderTransform *render,
|
||||||
PictTransformPtr pict);
|
PictTransformPtr pict);
|
||||||
|
|
||||||
void
|
Bool
|
||||||
pict_f_transform_from_pixman_transform (struct pict_f_transform *ft,
|
PictureTransformPoint (PictTransformPtr transform,
|
||||||
struct pixman_transform *t);
|
PictVectorPtr vector);
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
pixman_transform_from_pict_f_transform (struct pixman_transform *t,
|
PictureTransformPoint3d (PictTransformPtr transform,
|
||||||
struct pict_f_transform *ft);
|
PictVectorPtr vector);
|
||||||
|
|
||||||
Bool
|
|
||||||
pict_f_transform_invert (struct pict_f_transform *r,
|
|
||||||
struct pict_f_transform *m);
|
|
||||||
|
|
||||||
|
|
||||||
Bool
|
|
||||||
pict_f_transform_point (struct pict_f_transform *t,
|
|
||||||
struct pict_f_vector *v);
|
|
||||||
|
|
||||||
void
|
|
||||||
pict_f_transform_point_3d (struct pict_f_transform *t,
|
|
||||||
struct pict_f_vector *v);
|
|
||||||
|
|
||||||
void
|
|
||||||
pict_f_transform_multiply (struct pict_f_transform *dst,
|
|
||||||
struct pict_f_transform *l, struct pict_f_transform *r);
|
|
||||||
|
|
||||||
void
|
|
||||||
pict_f_transform_init_scale (struct pict_f_transform *t, double sx, double sy);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
pict_f_transform_scale (struct pict_f_transform *forward,
|
|
||||||
struct pict_f_transform *reverse,
|
|
||||||
double sx, double sy);
|
|
||||||
|
|
||||||
void
|
|
||||||
pict_f_transform_init_rotate (struct pict_f_transform *t, double c, double s);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
pict_f_transform_rotate (struct pict_f_transform *forward,
|
|
||||||
struct pict_f_transform *reverse,
|
|
||||||
double c, double s);
|
|
||||||
|
|
||||||
void
|
|
||||||
pict_f_transform_init_translate (struct pict_f_transform *t, double tx, double ty);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
pict_f_transform_translate (struct pict_f_transform *forward,
|
|
||||||
struct pict_f_transform *reverse,
|
|
||||||
double tx, double ty);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
pict_f_transform_bounds (struct pict_f_transform *t, BoxPtr b);
|
|
||||||
|
|
||||||
void
|
|
||||||
pict_f_transform_init_identity (struct pict_f_transform *t);
|
|
||||||
|
|
||||||
#endif /* _PICTURESTR_H_ */
|
#endif /* _PICTURESTR_H_ */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user