3 * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
5 * Permission to use, copy, modify, distribute, and sell this software and its
6 * documentation for any purpose is hereby granted without fee, provided that
7 * the above copyright notice appear in all copies and that both that
8 * copyright notice and this permission notice appear in supporting
9 * documentation, and that the name of Keith Packard not be used in
10 * advertising or publicity pertaining to distribution of the software without
11 * specific, written prior permission. Keith Packard makes no
12 * representations about the suitability of this software for any purpose. It
13 * is provided "as is" without express or implied warranty.
15 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21 * PERFORMANCE OF THIS SOFTWARE.
24 #ifdef HAVE_DIX_CONFIG_H
25 #include <dix-config.h>
28 #include "scrnintstr.h"
30 #include "pixmapstr.h"
31 #include "windowstr.h"
33 #include "picturestr.h"
37 miColorRects (PicturePtr pDst
,
45 ScreenPtr pScreen
= pDst
->pDrawable
->pScreen
;
52 miRenderColorToPixel (pDst
->pFormat
, color
, &pixel
);
54 pGC
= GetScratchGC (pDst
->pDrawable
->depth
, pScreen
);
59 tmpval
[2] = pDst
->subWindowMode
;
60 mask
= GCFunction
| GCForeground
| GCSubwindowMode
;
61 if (pClipPict
->clientClipType
== CT_REGION
)
63 tmpval
[3] = pDst
->clipOrigin
.x
- xoff
;
64 tmpval
[4] = pDst
->clipOrigin
.y
- yoff
;
65 mask
|= GCClipXOrigin
|GCClipYOrigin
;
67 pClip
= REGION_CREATE (pScreen
, NULL
, 1);
68 REGION_COPY (pScreen
, pClip
,
69 (RegionPtr
) pClipPict
->clientClip
);
70 (*pGC
->funcs
->ChangeClip
) (pGC
, CT_REGION
, pClip
, 0);
73 ChangeGC (pGC
, mask
, tmpval
);
74 ValidateGC (pDst
->pDrawable
, pGC
);
78 for (i
= 0; i
< nRect
; i
++)
84 (*pGC
->ops
->PolyFillRect
) (pDst
->pDrawable
, pGC
, nRect
, rects
);
88 for (i
= 0; i
< nRect
; i
++)
98 miCompositeRects (CARD8 op
,
104 ScreenPtr pScreen
= pDst
->pDrawable
->pScreen
;
106 if (color
->alpha
== 0xffff)
108 if (op
== PictOpOver
)
111 if (op
== PictOpClear
)
112 color
->red
= color
->green
= color
->blue
= color
->alpha
= 0;
114 if (op
== PictOpSrc
|| op
== PictOpClear
)
116 miColorRects (pDst
, pDst
, color
, nRect
, rects
, 0, 0);
118 miColorRects (pDst
->alphaMap
, pDst
,
121 pDst
->alphaOrigin
.y
);
125 PictFormatPtr rgbaFormat
;
134 rgbaFormat
= PictureMatchFormat (pScreen
, 32, PICT_a8r8g8b8
);
138 pPixmap
= (*pScreen
->CreatePixmap
) (pScreen
, 1, 1,
143 miRenderColorToPixel (rgbaFormat
, color
, &pixel
);
145 pGC
= GetScratchGC (rgbaFormat
->depth
, pScreen
);
151 ChangeGC (pGC
, GCFunction
| GCForeground
, tmpval
);
152 ValidateGC (&pPixmap
->drawable
, pGC
);
157 (*pGC
->ops
->PolyFillRect
) (&pPixmap
->drawable
, pGC
, 1, &one
);
160 pSrc
= CreatePicture (0, &pPixmap
->drawable
, rgbaFormat
,
161 CPRepeat
, tmpval
, 0, &error
);
168 CompositePicture (op
, pSrc
, 0, pDst
, 0, 0, 0, 0,
176 FreePicture ((pointer
) pSrc
, 0);
180 (*pScreen
->DestroyPixmap
) (pPixmap
);