2
* $XFree86: xc/programs/Xserver/render/mirect.c,v 1.3 2000/12/08 07:52:05 keithp Exp $
4
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
6
* Permission to use, copy, modify, distribute, and sell this software and its
7
* documentation for any purpose is hereby granted without fee, provided that
8
* the above copyright notice appear in all copies and that both that
9
* copyright notice and this permission notice appear in supporting
10
* documentation, and that the name of Keith Packard not be used in
11
* advertising or publicity pertaining to distribution of the software without
12
* specific, written prior permission. Keith Packard makes no
13
* representations about the suitability of this software for any purpose. It
14
* is provided "as is" without express or implied warranty.
16
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
* PERFORMANCE OF THIS SOFTWARE.
25
#ifdef HAVE_DIX_CONFIG_H
26
#include <dix-config.h>
29
#include "scrnintstr.h"
31
#include "pixmapstr.h"
32
#include "windowstr.h"
34
#include "picturestr.h"
38
miColorRects (PicturePtr pDst,
46
ScreenPtr pScreen = pDst->pDrawable->pScreen;
53
miRenderColorToPixel (pDst->pFormat, color, &pixel);
55
pGC = GetScratchGC (pDst->pDrawable->depth, pScreen);
60
tmpval[2] = pDst->subWindowMode;
61
mask = GCFunction | GCForeground | GCSubwindowMode;
62
if (pClipPict->clientClipType == CT_REGION)
64
tmpval[3] = pDst->clipOrigin.x - xoff;
65
tmpval[4] = pDst->clipOrigin.y - yoff;
66
mask |= GCClipXOrigin|GCClipYOrigin;
68
pClip = REGION_CREATE (pScreen, NULL, 1);
69
REGION_COPY (pScreen, pClip,
70
(RegionPtr) pClipPict->clientClip);
71
(*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0);
74
ChangeGC (pGC, mask, tmpval);
75
ValidateGC (pDst->pDrawable, pGC);
79
for (i = 0; i < nRect; i++)
85
(*pGC->ops->PolyFillRect) (pDst->pDrawable, pGC, nRect, rects);
89
for (i = 0; i < nRect; i++)
99
miCompositeRects (CARD8 op,
105
ScreenPtr pScreen = pDst->pDrawable->pScreen;
107
if (color->alpha == 0xffff)
109
if (op == PictOpOver)
112
if (op == PictOpClear)
113
color->red = color->green = color->blue = color->alpha = 0;
115
if (op == PictOpSrc || op == PictOpClear)
117
miColorRects (pDst, pDst, color, nRect, rects, 0, 0);
119
miColorRects (pDst->alphaMap, pDst,
122
pDst->alphaOrigin.y);
126
PictFormatPtr rgbaFormat;
135
rgbaFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
139
pPixmap = (*pScreen->CreatePixmap) (pScreen, 1, 1,
144
miRenderColorToPixel (rgbaFormat, color, &pixel);
146
pGC = GetScratchGC (rgbaFormat->depth, pScreen);
152
ChangeGC (pGC, GCFunction | GCForeground, tmpval);
153
ValidateGC (&pPixmap->drawable, pGC);
158
(*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &one);
161
pSrc = CreatePicture (0, &pPixmap->drawable, rgbaFormat,
162
CPRepeat, tmpval, 0, &error);
169
CompositePicture (op, pSrc, 0, pDst, 0, 0, 0, 0,
177
FreePicture ((pointer) pSrc, 0);
181
(*pScreen->DestroyPixmap) (pPixmap);