summaryrefslogtreecommitdiff
path: root/hw/xfree86/xaa/xaaLineMisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xfree86/xaa/xaaLineMisc.c')
-rw-r--r--hw/xfree86/xaa/xaaLineMisc.c149
1 files changed, 0 insertions, 149 deletions
diff --git a/hw/xfree86/xaa/xaaLineMisc.c b/hw/xfree86/xaa/xaaLineMisc.c
deleted file mode 100644
index 4379778f6..000000000
--- a/hw/xfree86/xaa/xaaLineMisc.c
+++ /dev/null
@@ -1,149 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "misc.h"
7#include "xf86.h"
8#include "xf86_OSproc.h"
9
10#include <X11/X.h>
11#include "scrnintstr.h"
12#include "miline.h"
13#include "xf86str.h"
14#include "xaa.h"
15#include "xaalocal.h"
16
17void
18XAASolidHorVertLineAsRects(ScrnInfoPtr pScrn, int x, int y, int len, int dir)
19{
20 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
21
22 if (dir == DEGREES_0)
23 (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, len, 1);
24 else
25 (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, 1, len);
26}
27
28void
29XAASolidHorVertLineAsTwoPoint(ScrnInfoPtr pScrn, int x, int y, int len, int dir)
30{
31 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
32
33 len--;
34
35 if (dir == DEGREES_0)
36 (*infoRec->SubsequentSolidTwoPointLine) (pScrn, x, y, x + len, y, 0);
37 else
38 (*infoRec->SubsequentSolidTwoPointLine) (pScrn, x, y, x, y + len, 0);
39}
40
41void
42XAASolidHorVertLineAsBresenham(ScrnInfoPtr pScrn,
43 int x, int y, int len, int dir)
44{
45 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
46
47 if (dir == DEGREES_0)
48 (*infoRec->SubsequentSolidBresenhamLine) (pScrn, x, y, len << 1, 0,
49 -len, len, 0);
50 else
51 (*infoRec->SubsequentSolidBresenhamLine) (pScrn, x, y, len << 1, 0,
52 -len, len, YMAJOR);
53}
54
55void
56XAAComputeDash(GCPtr pGC)
57{
58 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
59 XAAGCPtr pGCPriv = (XAAGCPtr) dixLookupPrivate(&pGC->devPrivates,
60 XAAGetGCKey());
61 Bool EvenDash = (pGC->numInDashList & 0x01) ? FALSE : TRUE;
62 int PatternLength = 0;
63 unsigned char *DashPtr = (unsigned char *) pGC->dash;
64 CARD32 *ptr;
65 int count = pGC->numInDashList;
66 int shift, value, direction;
67 Bool set;
68
69 free(pGCPriv->DashPattern);
70
71 pGCPriv->DashPattern = NULL;
72 pGCPriv->DashLength = 0;
73
74 while (count--)
75 PatternLength += *(DashPtr++);
76
77 if (!EvenDash)
78 PatternLength <<= 1;
79
80 if (PatternLength > infoRec->DashPatternMaxLength)
81 return;
82
83 if ((infoRec->DashedLineFlags & LINE_PATTERN_POWER_OF_2_ONLY) &&
84 (PatternLength & (PatternLength - 1)))
85 return;
86
87 pGCPriv->DashPattern = calloc((PatternLength + 31) >> 5, 4);
88 if (!pGCPriv->DashPattern)
89 return;
90 pGCPriv->DashLength = PatternLength;
91
92 if (infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
93 LINE_PATTERN_LSBFIRST_LSBJUSTIFIED)) {
94 direction = 1;
95 set = TRUE;
96 DashPtr = (unsigned char *) pGC->dash;
97 }
98 else {
99 direction = -1;
100 set = FALSE;
101 DashPtr = (unsigned char *) pGC->dash + pGC->numInDashList - 1;
102 }
103
104 if (infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
105 LINE_PATTERN_MSBFIRST_MSBJUSTIFIED))
106 shift = 32 - (PatternLength & 31);
107 else
108 shift = 0;
109
110 ptr = (CARD32 *) (pGCPriv->DashPattern);
111
112 CONCATENATE:
113
114 count = pGC->numInDashList;
115
116 while (count--) {
117 value = *DashPtr;
118 DashPtr += direction;
119 while (value) {
120 if (value < (32 - shift)) {
121 if (set)
122 *ptr |= XAAShiftMasks[value] << shift;
123 shift += value;
124 break;
125 }
126 else {
127 if (set)
128 *ptr |= ~0L << shift;
129 value -= (32 - shift);
130 shift = 0;
131 ptr++;
132 }
133 }
134 if (set)
135 set = FALSE;
136 else
137 set = TRUE;
138 }
139
140 if (!EvenDash) {
141 EvenDash = TRUE;
142 if (infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
143 LINE_PATTERN_LSBFIRST_LSBJUSTIFIED))
144 DashPtr = (unsigned char *) pGC->dash;
145 else
146 DashPtr = (unsigned char *) pGC->dash + pGC->numInDashList;
147 goto CONCATENATE;
148 }
149}