|
|
1.1 root 1: /* $Header: mfbpntwin.c,v 1.1 87/09/02 00:29:09 toddb Exp $ */
2: /***********************************************************
3: Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
4: and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
5:
6: All Rights Reserved
7:
8: Permission to use, copy, modify, and distribute this software and its
9: documentation for any purpose and without fee is hereby granted,
10: provided that the above copyright notice appear in all copies and that
11: both that copyright notice and this permission notice appear in
12: supporting documentation, and that the names of Digital or MIT not be
13: used in advertising or publicity pertaining to distribution of the
14: software without specific, written prior permission.
15:
16: DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
17: ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
18: DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
19: ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20: WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21: ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
22: SOFTWARE.
23:
24: ******************************************************************/
25:
26: #include "X.h"
27:
28: #include "windowstr.h"
29: #include "regionstr.h"
30: #include "pixmapstr.h"
31: #include "scrnintstr.h"
32:
33: #include "mfb.h"
34: #include "maskbits.h"
35: /*
36: NOTE
37: PaintArea32() doesn't need to rotate the tile, since
38: mfbPositionWIndow() and mfbChangeWIndowAttributes() do it.
39: */
40:
41: /* Paint Window None -- just return */
42: void
43: mfbPaintWindowNone(pWin, pRegion, what)
44: WindowPtr pWin;
45: RegionPtr pRegion;
46: int what;
47: {
48: }
49:
50: /* Paint Window Parent Relative -- Find first ancestor which isn't parent
51: * relative and paint as it would, but with this region */
52: void
53: mfbPaintWindowPR(pWin, pRegion, what)
54: WindowPtr pWin;
55: RegionPtr pRegion;
56: int what;
57: {
58: WindowPtr pParent;
59:
60: pParent = pWin->parent;
61: while(pParent->backgroundTile == (PixmapPtr)ParentRelative)
62: pParent = pParent->parent;
63:
64: if(what == PW_BORDER)
65: (*pParent->PaintWindowBorder)(pParent, pRegion, what);
66: else
67: (*pParent->PaintWindowBackground)(pParent, pRegion, what);
68: }
69:
70: void
71: mfbPaintWindowSolid(pWin, pRegion, what)
72: WindowPtr pWin;
73: RegionPtr pRegion;
74: int what;
75: {
76: if (what == PW_BACKGROUND)
77: {
78: if (pWin->backgroundPixel)
79: mfbSolidWhiteArea(pWin, pRegion->numRects, pRegion->rects,
80: GXset, NullPixmap);
81: else
82: mfbSolidBlackArea(pWin, pRegion->numRects, pRegion->rects,
83: GXclear, NullPixmap);
84: }
85: else
86: {
87: if (pWin->borderPixel)
88: mfbSolidWhiteArea(pWin, pRegion->numRects, pRegion->rects,
89: GXset, NullPixmap);
90: else
91: mfbSolidBlackArea(pWin, pRegion->numRects, pRegion->rects,
92: GXclear, NullPixmap);
93: }
94: }
95:
96:
97: /* Tile Window with a 32 bit wide tile
98: this could call mfbTileArea32, but that has to do a switch on the
99: rasterop, which seems expensive.
100: */
101: void
102: mfbPaintWindow32(pWin, pRegion, what)
103: WindowPtr pWin;
104: RegionPtr pRegion;
105: int what;
106: {
107: int nbox; /* number of boxes to fill */
108: register BoxPtr pbox; /* pointer to list of boxes to fill */
109: int *psrc; /* pointer to bits in tile */
110: int tileHeight; /* height of the tile */
111: register int srcpix; /* current row from tile */
112:
113: PixmapPtr pPixmap;
114: int nlwScreen; /* width in longwords of the screen's pixmap */
115: int w; /* width of current box */
116: register int h; /* height of current box */
117: register int startmask;
118: int endmask; /* masks for reggedy bits at either end of line */
119: int nlwMiddle; /* number of longwords between sides of boxes */
120: int nlwExtra; /* to get from right of box to left of next span */
121:
122: register int nlw; /* loop version of nlwMiddle */
123: register unsigned int *p; /* pointer to bits we're writing */
124: int y; /* current scan line */
125:
126: unsigned int *pbits; /* pointer to start of screen */
127: mfbPrivWin *pPrivWin;
128:
129: pPrivWin = (mfbPrivWin *)(pWin->devPrivate);
130:
131: if (what == PW_BACKGROUND)
132: {
133: tileHeight = pWin->backgroundTile->height;
134: psrc = (int *)(pPrivWin->pRotatedBackground->devPrivate);
135: }
136: else
137: {
138: tileHeight = pWin->borderTile->height;
139: psrc = (int *)(pPrivWin->pRotatedBorder->devPrivate);
140: }
141:
142: pPixmap = (PixmapPtr)(pWin->drawable.pScreen->devPrivate);
143: pbits = (unsigned int *)pPixmap->devPrivate;
144: nlwScreen = (pPixmap->devKind) >> 2;
145: nbox = pRegion->numRects;
146: pbox = pRegion->rects;
147:
148: while (nbox--)
149: {
150: w = pbox->x2 - pbox->x1;
151: h = pbox->y2 - pbox->y1;
152: y = pbox->y1;
153: p = pbits + (pbox->y1 * nlwScreen) + (pbox->x1 >> 5);
154:
155: if ( ((pbox->x1 & 0x1f) + w) < 32)
156: {
157: maskpartialbits(pbox->x1, w, startmask);
158: nlwExtra = nlwScreen;
159: while (h--)
160: {
161: srcpix = psrc[y%tileHeight];
162: y++;
163: *p = (*p & ~startmask) | (srcpix & startmask);
164: p += nlwExtra;
165: }
166: }
167: else
168: {
169: maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
170: nlwExtra = nlwScreen - nlwMiddle;
171:
172: if (startmask && endmask)
173: {
174: nlwExtra -= 1;
175: while (h--)
176: {
177: srcpix = psrc[y%tileHeight];
178: y++;
179: nlw = nlwMiddle;
180: *p = (*p & ~startmask) | (srcpix & startmask);
181: p++;
182: while (nlw--)
183: *p++ = srcpix;
184: *p = (*p & ~endmask) | (srcpix & endmask);
185: p += nlwExtra;
186: }
187: }
188: else if (startmask && !endmask)
189: {
190: nlwExtra -= 1;
191: while (h--)
192: {
193: srcpix = psrc[y%tileHeight];
194: y++;
195: nlw = nlwMiddle;
196: *p = (*p & ~startmask) | (srcpix & startmask);
197: p++;
198: while (nlw--)
199: *p++ = srcpix;
200: p += nlwExtra;
201: }
202: }
203: else if (!startmask && endmask)
204: {
205: while (h--)
206: {
207: srcpix = psrc[y%tileHeight];
208: y++;
209: nlw = nlwMiddle;
210: while (nlw--)
211: *p++ = srcpix;
212: *p = (*p & ~endmask) | (srcpix & endmask);
213: p += nlwExtra;
214: }
215: }
216: else /* no ragged bits at either end */
217: {
218: while (h--)
219: {
220: srcpix = psrc[y%tileHeight];
221: y++;
222: nlw = nlwMiddle;
223: while (nlw--)
224: *p++ = srcpix;
225: p += nlwExtra;
226: }
227: }
228: }
229: pbox++;
230: }
231: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.