blob: 88e23ab05f462ee2d2f9ced0165daa694bcd425f (
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
|
#include "picturestr.h"
#include "pixmapstr.h"
#include "pictureutil.h"
#include "pixmaputil.h"
/*
* Returns TRUE and the pixel value in COLOUR if the picture
* represents a solid surface of constant colour.
*/
Bool picture_is_solid(PicturePtr pict, CARD32 *colour)
{
if (pict->pDrawable) {
DrawablePtr pDraw = pict->pDrawable;
if (pDraw->width == 1 && pDraw->height == 1 && pict->repeat) {
if (colour)
*colour = get_first_pixel(pDraw);
return TRUE;
}
} else {
SourcePict *sp = pict->pSourcePict;
if (sp->type == SourcePictTypeSolidFill) {
if (colour)
*colour = sp->solidFill.color;
return TRUE;
}
}
return FALSE;
}
|