summaryrefslogtreecommitdiff
path: root/glamor/glamor_render_fallback.c
blob: ae559307466e243419c4c97777f633e0b6fcd072 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
 * Copyright © 2014 Keith Packard
 *
 * 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 the copyright holders not be used in advertising or
 * publicity pertaining to distribution of the software without specific,
 * written prior permission.  The copyright holders make no representations
 * about the suitability of this software for any purpose.  It is provided "as
 * is" without express or implied warranty.
 *
 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 * EVENT SHALL THE COPYRIGHT HOLDERS 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.
 */

#include "glamor_priv.h"
#include "glamor_render_fallback.h"

void
glamor_composite_fallback(CARD8 op,
                          PicturePtr source,
                          PicturePtr mask,
                          PicturePtr dest,
                          INT16 x_source, INT16 y_source,
                          INT16 x_mask, INT16 y_mask,
                          INT16 x_dest, INT16 y_dest,
                          CARD16 width, CARD16 height)
{
    miCompositeSourceValidate(source);
    if (mask)
        miCompositeSourceValidate(mask);

    if (glamor_prepare_access_picture(dest, GLAMOR_ACCESS_RW) &&
        glamor_prepare_access_picture(source, GLAMOR_ACCESS_RO) &&
        glamor_prepare_access_picture(mask, GLAMOR_ACCESS_RO))
    {
        fbComposite(op,
                    source, mask, dest,
                    x_source, y_source,
                    x_mask, y_mask, x_dest, y_dest, width, height);
    }
    glamor_finish_access_picture(mask);
    glamor_finish_access_picture(source);
    glamor_finish_access_picture(dest);
}

void
glamor_trapezoids_fallback(CARD8 op,
                           PicturePtr src,
                           PicturePtr dst,
                           PictFormatPtr mask_format,
                           INT16 x_src, INT16 y_src,
                           int ntrap, xTrapezoid * traps)
{
    if (glamor_prepare_access_picture(dst, GLAMOR_ACCESS_RW) &&
        glamor_prepare_access_picture(src, GLAMOR_ACCESS_RO))
    {
        fbTrapezoids(op,
                     src, dst, mask_format,
                     x_src, y_src, ntrap, traps);
    }
    glamor_finish_access_picture(src);
    glamor_finish_access_picture(dst);
}

void
glamor_triangles_fallback(CARD8 op,
                          PicturePtr src,
                          PicturePtr dst,
                          PictFormatPtr mask_format,
                          INT16 x_src, INT16 y_src,
                          int ntri, xTriangle * tris)
{
    if (glamor_prepare_access_picture(dst, GLAMOR_ACCESS_RW) &&
        glamor_prepare_access_picture(src, GLAMOR_ACCESS_RO))
    {
        fbTriangles(op,
                    src, dst, mask_format,
                    x_src, y_src, ntri, tris);
    }
    glamor_finish_access_picture(src);
    glamor_finish_access_picture(dst);
}

void
glamor_add_traps_fallback(PicturePtr picture,
                          INT16 x_off, INT16 y_off,
                          int ntrap, xTrap * traps)
{
    if (glamor_prepare_access_picture(picture, GLAMOR_ACCESS_RW))
        fbAddTraps(picture, x_off, y_off, ntrap, traps);
    glamor_finish_access_picture(picture);
}

void
glamor_glyphs_fallback(CARD8 op,
                       PicturePtr src,
                       PicturePtr dst,
                       PictFormatPtr mask_format,
                       INT16 x_src, INT16 y_src,
                       int nlist, GlyphListPtr list,
                       GlyphPtr * glyphs)
{
    if (glamor_prepare_access_picture(dst, GLAMOR_ACCESS_RW) &&
        glamor_prepare_access_picture(src, GLAMOR_ACCESS_RO))
    {
        fbGlyphs(op, src, dst, mask_format,
                 x_src, y_src,
                 nlist, list, glyphs);
    }
    glamor_finish_access_picture(src);
    glamor_finish_access_picture(dst);
}

void
glamor_glyph_unrealize_fallback(ScreenPtr screen,
                                GlyphPtr glyph)
{
    fbUnrealizeGlyph(screen, glyph);
}