1/*
2 * Copyright © 2007 Keith Packard
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission.  The copyright holders make no representations
11 * about the suitability of this software for any purpose.  It is provided "as
12 * is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THIS SOFTWARE.
21 */
22
23#ifdef HAVE_DIX_CONFIG_H
24#include <dix-config.h>
25#endif
26
27#include "misc.h"
28#include "scrnintstr.h"
29#include "os.h"
30#include "regionstr.h"
31#include "validate.h"
32#include "windowstr.h"
33#include "input.h"
34#include "resource.h"
35#include "colormapst.h"
36#include "cursorstr.h"
37#include "dixstruct.h"
38#include "gcstruct.h"
39#include "servermd.h"
40#include "picturestr.h"
41
42void
43PictTransform_from_xRenderTransform(PictTransformPtr pict,
44                                    xRenderTransform * render)
45{
46    pict->matrix[0][0] = render->matrix11;
47    pict->matrix[0][1] = render->matrix12;
48    pict->matrix[0][2] = render->matrix13;
49
50    pict->matrix[1][0] = render->matrix21;
51    pict->matrix[1][1] = render->matrix22;
52    pict->matrix[1][2] = render->matrix23;
53
54    pict->matrix[2][0] = render->matrix31;
55    pict->matrix[2][1] = render->matrix32;
56    pict->matrix[2][2] = render->matrix33;
57}
58
59void
60xRenderTransform_from_PictTransform(xRenderTransform * render,
61                                    PictTransformPtr pict)
62{
63    render->matrix11 = pict->matrix[0][0];
64    render->matrix12 = pict->matrix[0][1];
65    render->matrix13 = pict->matrix[0][2];
66
67    render->matrix21 = pict->matrix[1][0];
68    render->matrix22 = pict->matrix[1][1];
69    render->matrix23 = pict->matrix[1][2];
70
71    render->matrix31 = pict->matrix[2][0];
72    render->matrix32 = pict->matrix[2][1];
73    render->matrix33 = pict->matrix[2][2];
74}
75
76Bool
77PictureTransformPoint(PictTransformPtr transform, PictVectorPtr vector)
78{
79    return pixman_transform_point(transform, vector);
80}
81
82Bool
83PictureTransformPoint3d(PictTransformPtr transform, PictVectorPtr vector)
84{
85    return pixman_transform_point_3d(transform, vector);
86}
87