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
|
#ifndef PIXMAPUTIL_H
#define PIXMAPUTIL_H
#include <X11/Xdefs.h>
#include "list.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "utils.h"
char *drawable_desc(DrawablePtr pDraw, char *str, size_t n);
CARD32 get_first_pixel(DrawablePtr pDraw);
static inline PixmapPtr drawable_pixmap(DrawablePtr pDrawable)
{
if (OnScreenDrawable(pDrawable->type)) {
WindowPtr pWin;
pWin = container_of(pDrawable, struct _Window, drawable);
return pDrawable->pScreen->GetWindowPixmap(pWin);
} else {
return container_of(pDrawable, struct _Pixmap, drawable);
}
}
PixmapPtr drawable_pixmap_offset(DrawablePtr pDrawable, xPoint *offset);
/*
* drawable_contains: returns true if x,y,w,h is contained entirely
* within the drawable
*/
static inline Bool drawable_contains(DrawablePtr drawable,
int x, int y, int w, int h)
{
if (x < 0 ||
y < 0 ||
x + w > drawable->width ||
y + h > drawable->height)
return FALSE;
return TRUE;
}
static inline Bool drawable_contains_box(DrawablePtr drawable, const BoxRec *box)
{
return box->x1 >= 0 && box->y1 >= 0 &&
box->x2 <= drawable->width &&
box->y2 <= drawable->height;
}
#endif
|