2 #ifdef HAVE_XORG_CONFIG_H
3 #include <xorg-config.h>
8 #include "xf86_OSproc.h"
11 #include "scrnintstr.h"
19 XAASolidHorVertLineAsRects(
21 int x
, int y
, int len
, int dir
23 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn
);
26 (*infoRec
->SubsequentSolidFillRect
)(pScrn
, x
, y
, len
, 1);
28 (*infoRec
->SubsequentSolidFillRect
)(pScrn
, x
, y
, 1, len
);
33 XAASolidHorVertLineAsTwoPoint(
35 int x
, int y
, int len
, int dir
37 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn
);
42 (*infoRec
->SubsequentSolidTwoPointLine
)(pScrn
, x
, y
, x
+ len
, y
, 0);
44 (*infoRec
->SubsequentSolidTwoPointLine
)(pScrn
, x
, y
, x
, y
+ len
, 0);
48 XAASolidHorVertLineAsBresenham(
50 int x
, int y
, int len
, int dir
52 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn
);
55 (*infoRec
->SubsequentSolidBresenhamLine
)(
56 pScrn
, x
, y
, len
<< 1, 0, -len
, len
, 0);
58 (*infoRec
->SubsequentSolidBresenhamLine
)(
59 pScrn
, x
, y
, len
<< 1, 0, -len
, len
, YMAJOR
);
64 XAAComputeDash(GCPtr pGC
)
66 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_GC(pGC
);
67 XAAGCPtr pGCPriv
= (XAAGCPtr
) (pGC
)->devPrivates
[XAAGetGCIndex()].ptr
;
68 Bool EvenDash
= (pGC
->numInDashList
& 0x01) ? FALSE
: TRUE
;
69 int PatternLength
= 0;
70 unsigned char* DashPtr
= (unsigned char*)pGC
->dash
;
72 int count
= pGC
->numInDashList
;
73 int shift
, value
, direction
;
76 if(pGCPriv
->DashPattern
)
77 xfree(pGCPriv
->DashPattern
);
79 pGCPriv
->DashPattern
= NULL
;
80 pGCPriv
->DashLength
= 0;
83 PatternLength
+= *(DashPtr
++);
88 if(PatternLength
> infoRec
->DashPatternMaxLength
)
91 if((infoRec
->DashedLineFlags
& LINE_PATTERN_POWER_OF_2_ONLY
) &&
92 (PatternLength
& (PatternLength
- 1)))
95 pGCPriv
->DashPattern
= xcalloc((PatternLength
+ 31) >> 5, 4);
96 if(!pGCPriv
->DashPattern
) return;
97 pGCPriv
->DashLength
= PatternLength
;
99 if(infoRec
->DashedLineFlags
& (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED
|
100 LINE_PATTERN_LSBFIRST_LSBJUSTIFIED
)) {
103 DashPtr
= (unsigned char*)pGC
->dash
;
107 DashPtr
= (unsigned char*)pGC
->dash
+ pGC
->numInDashList
- 1;
110 if(infoRec
->DashedLineFlags
& (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED
|
111 LINE_PATTERN_MSBFIRST_MSBJUSTIFIED
))
112 shift
= 32 - (PatternLength
& 31);
116 ptr
= (CARD32
*)(pGCPriv
->DashPattern
);
120 count
= pGC
->numInDashList
;
124 DashPtr
+= direction
;
126 if(value
< (32 - shift
)) {
127 if(set
) *ptr
|= XAAShiftMasks
[value
] << shift
;
131 if(set
) *ptr
|= ~0L << shift
;
132 value
-= (32 - shift
);
143 if(infoRec
->DashedLineFlags
& (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED
|
144 LINE_PATTERN_LSBFIRST_LSBJUSTIFIED
))
145 DashPtr
= (unsigned char*)pGC
->dash
;
147 DashPtr
= (unsigned char*)pGC
->dash
+ pGC
->numInDashList
;