2
* $XFree86: xc/programs/Xserver/render/miglyph.c,v 1.4 2000/11/20 07:13:13 keithp Exp $
4
* Copyright Ā© 2000 SuSE, 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 SuSE not be used in advertising or
11
* publicity pertaining to distribution of the software without specific,
12
* written prior permission. SuSE makes no representations about the
13
* suitability of this software for any purpose. It is provided "as is"
14
* without express or implied warranty.
16
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
17
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
18
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
* Author: Keith Packard, SuSE, Inc.
26
#ifdef HAVE_DIX_CONFIG_H
27
#include <dix-config.h>
30
#include "scrnintstr.h"
32
#include "pixmapstr.h"
33
#include "windowstr.h"
35
#include "picturestr.h"
39
miRealizeGlyph (ScreenPtr pScreen,
46
miUnrealizeGlyph (ScreenPtr pScreen,
52
miGlyphExtents (int nlist,
64
extents->x1 = MAXSHORT;
65
extents->x2 = MINSHORT;
66
extents->y1 = MAXSHORT;
67
extents->y2 = MINSHORT;
77
x1 = x - glyph->info.x;
80
y1 = y - glyph->info.y;
83
x2 = x1 + glyph->info.width;
86
y2 = y1 + glyph->info.height;
97
x += glyph->info.xOff;
98
y += glyph->info.yOff;
103
#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
109
PictFormatPtr maskFormat,
116
PixmapPtr pPixmap = 0;
118
PixmapPtr pMaskPixmap = 0;
120
ScreenPtr pScreen = pDst->pDrawable->pScreen;
121
int width = 0, height = 0;
123
int xDst = list->xOff, yDst = list->yOff;
128
CARD32 component_alpha;
135
miGlyphExtents (nlist, list, glyphs, &extents);
137
if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
139
width = extents.x2 - extents.x1;
140
height = extents.y2 - extents.y1;
141
pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, maskFormat->depth);
144
component_alpha = NeedsComponent(maskFormat->format);
145
pMask = CreatePicture (0, &pMaskPixmap->drawable,
146
maskFormat, CPComponentAlpha, &component_alpha,
147
serverClient, &error);
150
(*pScreen->DestroyPixmap) (pMaskPixmap);
153
pGC = GetScratchGC (pMaskPixmap->drawable.depth, pScreen);
154
ValidateGC (&pMaskPixmap->drawable, pGC);
158
rect.height = height;
159
(*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect);
181
pPixmap = GetScratchPixmapHeader (pScreen, glyph->info.width, glyph->info.height,
184
0, (pointer) (glyph + 1));
187
component_alpha = NeedsComponent(list->format->format);
188
pPicture = CreatePicture (0, &pPixmap->drawable, list->format,
189
CPComponentAlpha, &component_alpha,
190
serverClient, &error);
193
FreeScratchPixmapHeader (pPixmap);
197
(*pScreen->ModifyPixmapHeader) (pPixmap,
198
glyph->info.width, glyph->info.height,
199
0, 0, -1, (pointer) (glyph + 1));
200
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
203
CompositePicture (PictOpAdd,
216
CompositePicture (op,
220
xSrc + (x - glyph->info.x) - xDst,
221
ySrc + (y - glyph->info.y) - yDst,
228
x += glyph->info.xOff;
229
y += glyph->info.yOff;
234
FreeScratchPixmapHeader (pPixmap);
235
FreePicture ((pointer) pPicture, 0);
244
CompositePicture (op,
253
FreePicture ((pointer) pMask, (XID) 0);
254
(*pScreen->DestroyPixmap) (pMaskPixmap);