Add i830_transform_is_affine and i830_get_transformed_coordinates_3d.

These are needed to deal with projective transforms in the composite
operation.
This commit is contained in:
Keith Packard 2008-03-18 14:06:47 -07:00
parent a55974b435
commit f699389818
2 changed files with 46 additions and 0 deletions

View File

@ -790,6 +790,9 @@ Bool i830_check_composite(int op, PicturePtr pSrc, PicturePtr pMask,
Bool i830_prepare_composite(int op, PicturePtr pSrc, PicturePtr pMask,
PicturePtr pDst, PixmapPtr pSrcPixmap,
PixmapPtr pMaskPixmap, PixmapPtr pDstPixmap);
Bool
i830_transform_is_affine (PictTransformPtr t);
void i830_composite(PixmapPtr pDst, int srcX, int srcY,
int maskX, int maskY, int dstX, int dstY, int w, int h);
void i830_done_composite(PixmapPtr pDst);
@ -812,6 +815,10 @@ void
i830_get_transformed_coordinates(int x, int y, PictTransformPtr transform,
float *x_out, float *y_out);
void
i830_get_transformed_coordinates_3d(int x, int y, PictTransformPtr transform,
float *x_out, float *y_out, float *z_out);
void i830_enter_render(ScrnInfoPtr);
static inline int i830_fb_compression_supported(I830Ptr pI830)

View File

@ -363,6 +363,45 @@ i830_get_transformed_coordinates(int x, int y, PictTransformPtr transform,
}
}
**
* Returns the un-normalized floating-point coordinates transformed by the given transform.
*
* transform may be null.
*/
void
i830_get_transformed_coordinates_3d(int x, int y, PictTransformPtr transform,
float *x_out, float *y_out, float *w_out)
{
if (transform == NULL) {
*x_out = x;
*y_out = y;
*w_out = 1;
} else {
PictVector v;
v.vector[0] = IntToxFixed(x);
v.vector[1] = IntToxFixed(y);
v.vector[2] = xFixed1;
PictureTransformPoint3d(transform, &v);
*x_out = xFixedToFloat(v.vector[0]);
*y_out = xFixedToFloat(v.vector[1]);
*w_out = xFixedToFloat(v.vector[2]);
}
}
/**
* Returns whether the provided transform is affine.
*
* transform may be null.
*/
Bool
i830_transform_is_affine (PictTransformPtr t)
{
if (t == NULL)
return TRUE;
return t->matrix[2][0] == 0 && t->matrix[2][1] == 0;
}
/*
* TODO:
* - Dual head?