diff options
author | Keith Packard <keithp@keithp.com> | 2008-03-13 21:30:18 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2008-11-24 13:24:36 -0800 |
commit | ff9d1cd843a9b0aba69a3d788b21d5f6af702590 (patch) | |
tree | daba5d492fd44e30a24db3e265a9da97f400996b | |
parent | c2f254da694731ea573aa8bbc2707c083743f2d4 (diff) |
Add funcs to convert between protocol and pixman matrices
-rw-r--r-- | render/matrix.c | 36 | ||||
-rw-r--r-- | render/picturestr.h | 11 |
2 files changed, 43 insertions, 4 deletions
diff --git a/render/matrix.c b/render/matrix.c index bd584cbd6..a97630473 100644 --- a/render/matrix.c +++ b/render/matrix.c @@ -222,7 +222,7 @@ PictureTransformTranslate (PictTransformPtr forward, PictureTransformInitTranslate (&t, tx, ty); if (!PictureTransformMultiply (forward, &t, forward)) return FALSE; - + PictureTransformInitTranslate (&t, -tx, -ty); if (!PictureTransformMultiply (reverse, reverse, &t)) return FALSE; @@ -349,3 +349,37 @@ PictureTransformIsInverse (PictTransform *a, PictTransform *b) return PictureTransformIsIdentity (&t); } +_X_EXPORT void +PictTransform_from_xRenderTransform (PictTransformPtr pict, + xRenderTransform *render) +{ + pict->matrix[0][0] = render->matrix11; + pict->matrix[0][1] = render->matrix12; + pict->matrix[0][2] = render->matrix13; + + pict->matrix[1][0] = render->matrix21; + pict->matrix[1][1] = render->matrix22; + pict->matrix[1][2] = render->matrix23; + + pict->matrix[2][0] = render->matrix31; + pict->matrix[2][1] = render->matrix32; + pict->matrix[2][2] = render->matrix33; +} + +void +xRenderTransform_from_PictTransform (xRenderTransform *render, + PictTransformPtr pict) +{ + render->matrix11 = pict->matrix[0][0]; + render->matrix12 = pict->matrix[0][1]; + render->matrix13 = pict->matrix[0][2]; + + render->matrix21 = pict->matrix[1][0]; + render->matrix22 = pict->matrix[1][1]; + render->matrix23 = pict->matrix[1][2]; + + render->matrix31 = pict->matrix[2][0]; + render->matrix32 = pict->matrix[2][1]; + render->matrix33 = pict->matrix[2][2]; +} + diff --git a/render/picturestr.h b/render/picturestr.h index f7a066459..93d86bd47 100644 --- a/render/picturestr.h +++ b/render/picturestr.h @@ -720,12 +720,17 @@ Bool PictureTransformIsScale(PictTransform *t); Bool -PictureTransformIsScale(PictTransform *t); - -Bool PictureTransformIsTranslate (PictTransform *t); Bool PictureTransformIsInverse(PictTransform *t, PictTransform *i); +void +PictTransform_from_xRenderTransform (PictTransformPtr pict, + xRenderTransform *render); + +void +xRenderTransform_from_PictTransform (xRenderTransform *render, + PictTransformPtr pict); + #endif /* _PICTURESTR_H_ */ |