pixmapstr.h revision 1b5d61b8
1/***********************************************************
2
3Copyright 1987, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
26
27                        All Rights Reserved
28
29Permission to use, copy, modify, and distribute this software and its
30documentation for any purpose and without fee is hereby granted,
31provided that the above copyright notice appear in all copies and that
32both that copyright notice and this permission notice appear in
33supporting documentation, and that the name of Digital not be
34used in advertising or publicity pertaining to distribution of the
35software without specific, written prior permission.
36
37DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
38ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
39DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
40ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
41WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
42ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
43SOFTWARE.
44
45******************************************************************/
46
47#ifndef PIXMAPSTRUCT_H
48#define PIXMAPSTRUCT_H
49#include "pixmap.h"
50#include "screenint.h"
51#include "regionstr.h"
52#include "privates.h"
53#include "damage.h"
54#include <X11/extensions/randr.h>
55#include "picturestr.h"
56
57typedef struct _Drawable {
58    unsigned char type;         /* DRAWABLE_<type> */
59    unsigned char class;        /* specific to type */
60    unsigned char depth;
61    unsigned char bitsPerPixel;
62    XID id;                     /* resource id */
63    short x;                    /* window: screen absolute, pixmap: 0 */
64    short y;                    /* window: screen absolute, pixmap: 0 */
65    unsigned short width;
66    unsigned short height;
67    ScreenPtr pScreen;
68    unsigned long serialNumber;
69} DrawableRec;
70
71/*
72 * PIXMAP -- device dependent
73 */
74
75typedef struct _Pixmap {
76    DrawableRec drawable;
77    PrivateRec *devPrivates;
78    int refcnt;
79    int devKind;                /* This is the pitch of the pixmap, typically width*bpp/8. */
80    DevUnion devPrivate;        /* When !NULL, devPrivate.ptr points to the raw pixel data. */
81#ifdef COMPOSITE
82    short screen_x;
83    short screen_y;
84#endif
85    unsigned usage_hint;        /* see CREATE_PIXMAP_USAGE_* */
86
87    PixmapPtr master_pixmap;    /* pointer to master copy of pixmap for pixmap sharing */
88} PixmapRec;
89
90typedef struct _PixmapDirtyUpdate {
91    DrawablePtr src;            /* Root window / shared pixmap */
92    PixmapPtr slave_dst;        /* Shared / scanout pixmap */
93    int x, y;
94    DamagePtr damage;
95    struct xorg_list ent;
96    int dst_x, dst_y;
97    Rotation rotation;
98    PictTransform transform;
99    struct pixman_f_transform f_transform, f_inverse;
100} PixmapDirtyUpdateRec;
101
102static inline void
103PixmapBox(BoxPtr box, PixmapPtr pixmap)
104{
105    box->x1 = 0;
106    box->x2 = pixmap->drawable.width;
107
108    box->y1 = 0;
109    box->y2 = pixmap->drawable.height;
110}
111
112
113static inline void
114PixmapRegionInit(RegionPtr region, PixmapPtr pixmap)
115{
116    BoxRec box;
117
118    PixmapBox(&box, pixmap);
119    RegionInit(region, &box, 1);
120}
121
122#endif                          /* PIXMAPSTRUCT_H */
123