~ubuntu-branches/ubuntu/edgy/xorg-server/edgy-updates

« back to all changes in this revision

Viewing changes to iplan2p4/ipltegblt.c

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Parra Novo
  • Date: 2006-07-25 20:06:28 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060725200628-gjmmd9gxfxdc4ejs
Tags: 1:1.1.1-0ubuntu1
* New Upstream version
* Changed Build-Depends from mesa-swrast-source to mesa-swx11-source,
  following Debian package nomenclature
* Re-did 12_security_policy_in_etc.diff for 1.1.1
* Dropped 15_security_allocate_local.diff (applied upstream)
* Dropped 16_SECURITY_setuid.diff (applied upstream)
* Dropped 000_ubuntu_fix_read_kernel_mapping.patch (applied upstream)
* Dropped 002_ubuntu_fix_for_certain_intel_chipsets.patch (applied upstream)
* Updated versioned Build-Depends on mesa-swx11-source to version
  6.5.0.cvs.20060725-0ubuntu1
* Added arrayobj.c, arrayobj.h, bitset.h & rbadaptors.h to
  GL/symlink-mesa.sh (linked from mesa-swx11-source)
* Added arrayobj.c to default build target on GL/mesa/main

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $XFree86$ */
2
 
/* $XConsortium: ipltegblt.c,v 5.9 94/04/17 20:29:03 dpw Exp $ */
3
 
/***********************************************************
4
 
 
5
 
Copyright (c) 1987  X Consortium
6
 
 
7
 
Permission is hereby granted, free of charge, to any person obtaining a copy
8
 
of this software and associated documentation files (the "Software"), to deal
9
 
in the Software without restriction, including without limitation the rights
10
 
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
 
copies of the Software, and to permit persons to whom the Software is
12
 
furnished to do so, subject to the following conditions:
13
 
 
14
 
The above copyright notice and this permission notice shall be included in
15
 
all copies or substantial portions of the Software.
16
 
 
17
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
20
 
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21
 
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
 
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
 
 
24
 
Except as contained in this notice, the name of the X Consortium shall not be
25
 
used in advertising or otherwise to promote the sale, use or other dealings
26
 
in this Software without prior written authorization from the X Consortium.
27
 
 
28
 
 
29
 
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
30
 
 
31
 
                        All Rights Reserved
32
 
 
33
 
Permission to use, copy, modify, and distribute this software and its 
34
 
documentation for any purpose and without fee is hereby granted, 
35
 
provided that the above copyright notice appear in all copies and that
36
 
both that copyright notice and this permission notice appear in 
37
 
supporting documentation, and that the name of Digital not be
38
 
used in advertising or publicity pertaining to distribution of the
39
 
software without specific, written prior permission.  
40
 
 
41
 
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
42
 
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
43
 
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
44
 
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
45
 
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
46
 
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
47
 
SOFTWARE.
48
 
 
49
 
******************************************************************/
50
 
 
51
 
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
52
 
interleaved planes */
53
 
 
54
 
#ifdef HAVE_DIX_CONFIG_H
55
 
#include <dix-config.h>
56
 
#endif
57
 
 
58
 
#include        <X11/X.h>
59
 
#include        <X11/Xmd.h>
60
 
#include        <X11/Xproto.h>
61
 
#include        "ipl.h"
62
 
#include        <X11/fonts/fontstruct.h>
63
 
#include        "dixfontstr.h"
64
 
#include        "gcstruct.h"
65
 
#include        "windowstr.h"
66
 
#include        "scrnintstr.h"
67
 
#include        "pixmapstr.h"
68
 
#include        "regionstr.h"
69
 
#include        "mi.h"
70
 
#define MFB_CONSTS_ONLY
71
 
#include        "maskbits.h"
72
 
 
73
 
#include        "iplmskbits.h"
74
 
 
75
 
/*
76
 
    this works for fonts with glyphs <= 32 bits wide, on an
77
 
    arbitrarily deep display.  Use iplTEGlyphBlt8 for 8 bit displays.
78
 
 
79
 
    This should be called only with a terminal-emulator font;
80
 
this means that the FIXED_METRICS flag is set, and that
81
 
glyphbounds == charbounds.
82
 
 
83
 
    in theory, this goes faster; even if it doesn't, it reduces the
84
 
flicker caused by writing a string over itself with image text (since
85
 
the background gets repainted per character instead of per string.)
86
 
this seems to be important for some converted X10 applications.
87
 
 
88
 
    Image text looks at the bits in the glyph and the fg and bg in the
89
 
GC.  it paints a rectangle, as defined in the protocol dcoument,
90
 
and the paints the characters.
91
 
 
92
 
*/
93
 
 
94
 
void
95
 
iplTEGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
96
 
    DrawablePtr pDrawable;
97
 
    GC          *pGC;
98
 
    int         x, y;
99
 
    unsigned int nglyph;
100
 
    CharInfoPtr *ppci;          /* array of character info */
101
 
    pointer     pglyphBase;     /* start of array of glyphs */
102
 
{
103
 
    FontPtr     pfont = pGC->font;
104
 
    int widthDst;
105
 
    INTER_DECLAREG(*pdstBase);  /* pointer to group with top row 
106
 
                                   of current glyph */
107
 
 
108
 
    int w;                      /* width of glyph and char */
109
 
    int h;                      /* height of glyph and char */
110
 
    register int xpos=x;        /* current x%32  */
111
 
    int ypos=y;                 /* current y%32 */
112
 
    register unsigned char *pglyph;
113
 
    int widthGlyph;
114
 
 
115
 
    INTER_DECLAREG(*pdst);      /* pointer to current group in dst */
116
 
    int hTmp;                   /* counter for height */
117
 
    BoxRec bbox;                /* for clipping */
118
 
 
119
 
    register int wtmp,xtemp,width;
120
 
    INTER_DECLAREGP(bgfill);
121
 
    INTER_DECLAREGP(fgfill);
122
 
    unsigned long *ptemp;
123
 
    INTER_DECLAREGP(tmpDst1);
124
 
    INTER_DECLAREGP(tmpDst2);
125
 
    INTER_DECLAREG(*pdtmp);
126
 
    int tmpx;
127
 
 
128
 
    xpos += pDrawable->x;
129
 
    ypos += pDrawable->y;
130
 
 
131
 
    iplGetGroupWidthAndPointer (pDrawable, widthDst, pdstBase)
132
 
 
133
 
    wtmp = FONTMAXBOUNDS(pfont,characterWidth);
134
 
    h = FONTASCENT(pfont) + FONTDESCENT(pfont);
135
 
    widthGlyph = GLYPHWIDTHBYTESPADDED(*ppci);
136
 
 
137
 
    xpos += FONTMAXBOUNDS(pfont,leftSideBearing);
138
 
    ypos -= FONTASCENT(pfont);
139
 
 
140
 
    bbox.x1 = xpos;
141
 
    bbox.x2 = xpos + (wtmp * nglyph);
142
 
    bbox.y1 = ypos;
143
 
    bbox.y2 = ypos + h;
144
 
 
145
 
    INTER_PFILL(pGC->fgPixel, fgfill);
146
 
    INTER_PFILL(pGC->bgPixel, bgfill);
147
 
 
148
 
    switch (RECT_IN_REGION(pGC->pScreen,  iplGetCompositeClip(pGC), &bbox))
149
 
    {
150
 
      case rgnOUT:
151
 
        break;
152
 
      case rgnPART:
153
 
        /* this is the WRONG thing to do, but it works.
154
 
           calling the non-terminal text is easy, but slow, given
155
 
           what we know about the font.
156
 
 
157
 
           the right thing to do is something like:
158
 
            for each clip rectangle
159
 
                compute at which row the glyph starts to be in it,
160
 
                   and at which row the glyph ceases to be in it
161
 
                compute which is the first glyph inside the left
162
 
                    edge, and the last one inside the right edge
163
 
                draw a fractional first glyph, using only
164
 
                    the rows we know are in
165
 
                draw all the whole glyphs, using the appropriate rows
166
 
                draw any pieces of the last glyph, using the right rows
167
 
 
168
 
           this way, the code would take advantage of knowing that
169
 
           all glyphs are the same height and don't overlap.
170
 
 
171
 
           one day...
172
 
        */
173
 
#if 1
174
 
        miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
175
 
#endif
176
 
        break;
177
 
      case rgnIN:
178
 
 
179
 
        pdtmp = pdstBase + (widthDst * ypos);
180
 
        while(nglyph--)
181
 
        {
182
 
 
183
 
            pglyph = FONTGLYPHBITS(pglyphBase, *ppci++);
184
 
            pdst = pdtmp;
185
 
            hTmp = h;
186
 
 
187
 
            while (hTmp--)
188
 
            {
189
 
                x = xpos;
190
 
                width = wtmp;
191
 
                xtemp = 0;
192
 
 
193
 
                while (width > 0)
194
 
                {
195
 
                    tmpx = x & INTER_PIM;
196
 
                    w = min(width, INTER_PPG - tmpx);
197
 
                    /* w = min(w, (PGSZ - xtemp)); */
198
 
 
199
 
                    ptemp = (unsigned long *)(pglyph + (xtemp >> MFB_PWSH));
200
 
#if 1
201
 
                    INTER_getstipplepixelsb(ptemp,xtemp,w,bgfill,fgfill,tmpDst1);
202
 
#endif
203
 
                    {
204
 
                        INTER_DECLAREG(*pdsttmp) =
205
 
                                pdst + (x >> INTER_PGSH) * INTER_PLANES;
206
 
#if 1
207
 
                        INTER_putbits(tmpDst1,tmpx,w,pdsttmp,pGC->planemask);
208
 
#endif
209
 
                    }
210
 
                    x += w;
211
 
                    xtemp += w;
212
 
                    width -= w;
213
 
                }
214
 
                pglyph += widthGlyph;
215
 
                pdst += widthDst;
216
 
            }
217
 
            xpos += wtmp;
218
 
        }     
219
 
        break;
220
 
    }
221
 
}