2 #ifdef HAVE_XORG_CONFIG_H
3 #include <xorg-config.h>
8 #include "xf86_OSproc.h"
11 #include "scrnintstr.h"
12 #include <X11/fonts/fontstruct.h>
13 #include "dixfontstr.h"
20 #include "pixmapstr.h"
25 unsigned long changes
,
28 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_GC(pGC
);
30 if(infoRec
->CopyArea
&&
31 CHECK_PLANEMASK(pGC
,infoRec
->CopyAreaFlags
) &&
32 CHECK_ROP(pGC
,infoRec
->CopyAreaFlags
) &&
33 CHECK_ROPSRC(pGC
,infoRec
->CopyAreaFlags
)
35 pGC
->ops
->CopyArea
= infoRec
->CopyArea
;
37 pGC
->ops
->CopyArea
= XAAFallbackOps
.CopyArea
;
43 unsigned long changes
,
46 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_GC(pGC
);
48 if(infoRec
->PutImage
&&
49 CHECK_PLANEMASK(pGC
,infoRec
->PutImageFlags
) &&
50 CHECK_ROP(pGC
,infoRec
->PutImageFlags
) &&
51 CHECK_ROPSRC(pGC
,infoRec
->PutImageFlags
) &&
52 CHECK_COLORS(pGC
,infoRec
->PutImageFlags
)
54 pGC
->ops
->PutImage
= infoRec
->PutImage
;
56 pGC
->ops
->PutImage
= XAAFallbackOps
.PutImage
;
62 unsigned long changes
,
65 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_GC(pGC
);
67 if(infoRec
->CopyPlane
&&
68 CHECK_PLANEMASK(pGC
,infoRec
->CopyPlaneFlags
) &&
69 CHECK_ROP(pGC
,infoRec
->CopyPlaneFlags
) &&
70 CHECK_ROPSRC(pGC
,infoRec
->CopyPlaneFlags
) &&
71 CHECK_COLORS(pGC
,infoRec
->CopyPlaneFlags
)
73 pGC
->ops
->CopyPlane
= infoRec
->CopyPlane
;
75 pGC
->ops
->CopyPlane
= XAAFallbackOps
.CopyPlane
;
79 XAAValidatePushPixels(
81 unsigned long changes
,
84 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_GC(pGC
);
86 if(infoRec
->PushPixelsSolid
&&
87 (pGC
->fillStyle
== FillSolid
) &&
88 CHECK_PLANEMASK(pGC
,infoRec
->PushPixelsFlags
) &&
89 CHECK_ROP(pGC
,infoRec
->PushPixelsFlags
) &&
90 CHECK_ROPSRC(pGC
,infoRec
->PushPixelsFlags
) &&
91 CHECK_FG(pGC
,infoRec
->PushPixelsFlags
) &&
92 (!(infoRec
->PushPixelsFlags
& TRANSPARENCY_GXCOPY_ONLY
) ||
95 pGC
->ops
->PushPixels
= infoRec
->PushPixelsSolid
;
97 pGC
->ops
->PushPixels
= XAAFallbackOps
.PushPixels
;
102 /* We make the assumption that the FillSpans, PolyFillRect, FillPolygon
103 and PolyFillArc functions are linked in a way that they all have
104 the same rop/color/planemask restrictions. If the driver provides
105 a GC level replacement for these, it will need to supply a new
106 Validate functions if it breaks this assumption */
110 XAAValidateFillSpans(
112 unsigned long changes
,
115 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_GC(pGC
);
117 if(pGC
->fillStyle
!= FillTiled
) changes
&= ~GCTile
;
118 if((pGC
->fillStyle
== FillTiled
) || (pGC
->fillStyle
== FillSolid
))
119 changes
&= ~GCStipple
;
123 pGC
->ops
->FillSpans
= XAAFallbackOps
.FillSpans
;
124 pGC
->ops
->PolyFillRect
= XAAFallbackOps
.PolyFillRect
;
125 pGC
->ops
->FillPolygon
= XAAFallbackOps
.FillPolygon
;
126 pGC
->ops
->PolyFillArc
= XAAFallbackOps
.PolyFillArc
;
128 switch(pGC
->fillStyle
){
130 if(infoRec
->FillSpansSolid
&&
131 CHECK_PLANEMASK(pGC
,infoRec
->FillSpansSolidFlags
) &&
132 CHECK_ROP(pGC
,infoRec
->FillSpansSolidFlags
) &&
133 CHECK_ROPSRC(pGC
,infoRec
->FillSpansSolidFlags
) &&
134 CHECK_FG(pGC
,infoRec
->FillSpansSolidFlags
)
136 pGC
->ops
->FillSpans
= infoRec
->FillSpansSolid
;
137 pGC
->ops
->PolyFillRect
= infoRec
->PolyFillRectSolid
;
138 pGC
->ops
->FillPolygon
= infoRec
->FillPolygonSolid
;
139 pGC
->ops
->PolyFillArc
= infoRec
->PolyFillArcSolid
;
142 /* The [Stippled/OpaqueStippled/Tiled]FillChooser
143 functions do the validating */
145 if(infoRec
->FillSpansStippled
) {
146 pGC
->ops
->FillSpans
= infoRec
->FillSpansStippled
;
147 pGC
->ops
->PolyFillRect
= infoRec
->PolyFillRectStippled
;
148 if(infoRec
->FillPolygonStippled
)
149 pGC
->ops
->FillPolygon
= infoRec
->FillPolygonStippled
;
150 else pGC
->ops
->FillPolygon
= miFillPolygon
;
151 pGC
->ops
->PolyFillArc
= miPolyFillArc
;
154 case FillOpaqueStippled
:
155 if(infoRec
->FillSpansOpaqueStippled
) {
156 pGC
->ops
->FillSpans
= infoRec
->FillSpansOpaqueStippled
;
157 pGC
->ops
->PolyFillRect
= infoRec
->PolyFillRectOpaqueStippled
;
158 if(infoRec
->FillPolygonOpaqueStippled
)
159 pGC
->ops
->FillPolygon
= infoRec
->FillPolygonOpaqueStippled
;
160 else pGC
->ops
->FillPolygon
= miFillPolygon
;
161 pGC
->ops
->PolyFillArc
= miPolyFillArc
;
165 if(infoRec
->FillSpansTiled
) {
166 pGC
->ops
->FillSpans
= infoRec
->FillSpansTiled
;
167 pGC
->ops
->PolyFillRect
= infoRec
->PolyFillRectTiled
;
168 if(infoRec
->FillPolygonTiled
)
169 pGC
->ops
->FillPolygon
= infoRec
->FillPolygonTiled
;
170 else pGC
->ops
->FillPolygon
= miFillPolygon
;
171 pGC
->ops
->PolyFillArc
= miPolyFillArc
;
179 /* We make the assumption that these Text8/16 and GlyphBlt functions
180 are linked in a way that they all have the same rop/color/planemask
181 restrictions. If the driver provides a GC level replacement for
182 these, it will need to supply a new Validate functions if it breaks
186 XAAValidatePolyGlyphBlt(
188 unsigned long changes
,
191 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_GC(pGC
);
192 Bool BigFont
= FALSE
;
194 pGC
->ops
->PolyText8
= XAAFallbackOps
.PolyText8
;
195 pGC
->ops
->PolyText16
= XAAFallbackOps
.PolyText16
;
196 pGC
->ops
->PolyGlyphBlt
= XAAFallbackOps
.PolyGlyphBlt
;
198 if(!pGC
->font
) return;
199 if(pGC
->fillStyle
!= FillSolid
) return;
201 if((FONTMAXBOUNDS(pGC
->font
, rightSideBearing
) -
202 FONTMINBOUNDS(pGC
->font
, leftSideBearing
) > 32))
205 /* no funny business */
206 if((FONTMINBOUNDS(pGC
->font
, characterWidth
) <= 0) ||
207 ((FONTASCENT(pGC
->font
) + FONTDESCENT(pGC
->font
)) <= 0))
210 /* Check for TE Fonts */
211 if(!TERMINALFONT(pGC
->font
) || BigFont
) {
212 if(infoRec
->PolyGlyphBltNonTE
&&
213 CHECK_PLANEMASK(pGC
,infoRec
->PolyGlyphBltNonTEFlags
) &&
214 CHECK_ROP(pGC
,infoRec
->PolyGlyphBltNonTEFlags
) &&
215 CHECK_ROPSRC(pGC
,infoRec
->PolyGlyphBltNonTEFlags
) &&
216 CHECK_FG(pGC
,infoRec
->PolyGlyphBltNonTEFlags
) &&
217 (!(infoRec
->PolyGlyphBltNonTEFlags
& TRANSPARENCY_GXCOPY_ONLY
) ||
218 (pGC
->alu
== GXcopy
))
220 pGC
->ops
->PolyText8
= infoRec
->PolyText8NonTE
;
221 pGC
->ops
->PolyText16
= infoRec
->PolyText16NonTE
;
222 pGC
->ops
->PolyGlyphBlt
= infoRec
->PolyGlyphBltNonTE
;
225 if(infoRec
->PolyGlyphBltTE
&&
226 CHECK_PLANEMASK(pGC
,infoRec
->PolyGlyphBltTEFlags
) &&
227 CHECK_ROP(pGC
,infoRec
->PolyGlyphBltTEFlags
) &&
228 CHECK_ROPSRC(pGC
,infoRec
->PolyGlyphBltNonTEFlags
) &&
229 CHECK_FG(pGC
,infoRec
->PolyGlyphBltTEFlags
) &&
230 (!(infoRec
->PolyGlyphBltTEFlags
& TRANSPARENCY_GXCOPY_ONLY
) ||
231 (pGC
->alu
== GXcopy
))
233 pGC
->ops
->PolyText8
= infoRec
->PolyText8TE
;
234 pGC
->ops
->PolyText16
= infoRec
->PolyText16TE
;
235 pGC
->ops
->PolyGlyphBlt
= infoRec
->PolyGlyphBltTE
;
241 XAAValidateImageGlyphBlt(
243 unsigned long changes
,
246 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_GC(pGC
);
247 Bool BigFont
= FALSE
;
249 pGC
->ops
->ImageText8
= XAAFallbackOps
.ImageText8
;
250 pGC
->ops
->ImageText16
= XAAFallbackOps
.ImageText16
;
251 pGC
->ops
->ImageGlyphBlt
= XAAFallbackOps
.ImageGlyphBlt
;
253 if(!pGC
->font
) return;
255 if((FONTMAXBOUNDS(pGC
->font
, rightSideBearing
) -
256 FONTMINBOUNDS(pGC
->font
, leftSideBearing
) > 32))
259 /* no funny business */
260 if((FONTMINBOUNDS(pGC
->font
, characterWidth
) <= 0) ||
261 ((FONTASCENT(pGC
->font
) + FONTDESCENT(pGC
->font
)) <= 0))
265 /* Check for TE Fonts */
266 if(!TERMINALFONT(pGC
->font
) || BigFont
|| (pGC
->depth
== 32)) {
267 if(infoRec
->ImageGlyphBltNonTE
&&
268 CHECK_PLANEMASK(pGC
,infoRec
->ImageGlyphBltNonTEFlags
) &&
269 CHECK_FG(pGC
,infoRec
->ImageGlyphBltNonTEFlags
) &&
270 infoRec
->SetupForSolidFill
&&
271 CHECK_PLANEMASK(pGC
,infoRec
->SolidFillFlags
) &&
272 CHECK_BG(pGC
,infoRec
->SolidFillFlags
))
274 pGC
->ops
->ImageText8
= infoRec
->ImageText8NonTE
;
275 pGC
->ops
->ImageText16
= infoRec
->ImageText16NonTE
;
276 pGC
->ops
->ImageGlyphBlt
= infoRec
->ImageGlyphBltNonTE
;
278 } else if(infoRec
->ImageGlyphBltTE
&&
279 CHECK_PLANEMASK(pGC
,infoRec
->ImageGlyphBltTEFlags
)){
280 if(!(infoRec
->ImageGlyphBltTEFlags
& TRANSPARENCY_ONLY
) &&
281 CHECK_COLORS(pGC
,infoRec
->ImageGlyphBltTEFlags
))
283 pGC
->ops
->ImageText8
= infoRec
->ImageText8TE
;
284 pGC
->ops
->ImageText16
= infoRec
->ImageText16TE
;
285 pGC
->ops
->ImageGlyphBlt
= infoRec
->ImageGlyphBltTE
;
287 if(CHECK_FG(pGC
,infoRec
->ImageGlyphBltTEFlags
) &&
288 infoRec
->SetupForSolidFill
&&
289 CHECK_PLANEMASK(pGC
,infoRec
->SolidFillFlags
) &&
290 CHECK_BG(pGC
,infoRec
->SolidFillFlags
))
292 pGC
->ops
->ImageText8
= infoRec
->ImageText8TE
;
293 pGC
->ops
->ImageText16
= infoRec
->ImageText16TE
;
294 pGC
->ops
->ImageGlyphBlt
= infoRec
->ImageGlyphBltTE
;
302 XAAValidatePolylines(
304 unsigned long changes
,
307 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_GC(pGC
);
308 XAAGCPtr pGCPriv
= (XAAGCPtr
) (pGC
)->devPrivates
[XAAGetGCIndex()].ptr
;
310 if(pGC
->lineStyle
== LineSolid
) changes
&= ~GCDashList
;
313 pGC
->ops
->PolySegment
= XAAFallbackOps
.PolySegment
;
314 pGC
->ops
->Polylines
= XAAFallbackOps
.Polylines
;
315 pGC
->ops
->PolyRectangle
= XAAFallbackOps
.PolyRectangle
;
316 pGC
->ops
->PolyArc
= XAAFallbackOps
.PolyArc
;
318 if((pGC
->ops
->FillSpans
!= XAAFallbackOps
.FillSpans
) &&
319 (pGC
->lineWidth
> 0)){
321 pGC
->ops
->PolyArc
= miPolyArc
;
322 pGC
->ops
->PolySegment
= miPolySegment
;
323 pGC
->ops
->PolyRectangle
= miPolyRectangle
;
324 if(pGC
->lineStyle
== LineSolid
)
325 pGC
->ops
->Polylines
= miWideLine
;
327 pGC
->ops
->Polylines
= miWideDash
;
330 if((pGC
->lineWidth
== 0) && (pGC
->fillStyle
== FillSolid
)) {
332 if(pGC
->lineStyle
== LineSolid
) {
334 if(infoRec
->PolyRectangleThinSolid
&&
335 CHECK_PLANEMASK(pGC
,infoRec
->PolyRectangleThinSolidFlags
) &&
336 CHECK_ROP(pGC
,infoRec
->PolyRectangleThinSolidFlags
) &&
337 CHECK_ROPSRC(pGC
,infoRec
->PolyRectangleThinSolidFlags
) &&
338 CHECK_FG(pGC
,infoRec
->PolyRectangleThinSolidFlags
)) {
340 pGC
->ops
->PolyRectangle
= infoRec
->PolyRectangleThinSolid
;
343 if(infoRec
->PolySegmentThinSolid
&&
344 CHECK_PLANEMASK(pGC
,infoRec
->PolySegmentThinSolidFlags
) &&
345 CHECK_ROP(pGC
,infoRec
->PolySegmentThinSolidFlags
) &&
346 CHECK_ROPSRC(pGC
,infoRec
->PolySegmentThinSolidFlags
) &&
347 CHECK_FG(pGC
,infoRec
->PolySegmentThinSolidFlags
)) {
349 pGC
->ops
->PolySegment
= infoRec
->PolySegmentThinSolid
;
352 if(infoRec
->PolylinesThinSolid
&&
353 CHECK_PLANEMASK(pGC
,infoRec
->PolylinesThinSolidFlags
) &&
354 CHECK_ROP(pGC
,infoRec
->PolylinesThinSolidFlags
) &&
355 CHECK_ROPSRC(pGC
,infoRec
->PolylinesThinSolidFlags
) &&
356 CHECK_FG(pGC
,infoRec
->PolylinesThinSolidFlags
)) {
358 pGC
->ops
->Polylines
= infoRec
->PolylinesThinSolid
;
360 } else if((pGC
->lineStyle
== LineOnOffDash
) && pGCPriv
->DashPattern
){
362 if(infoRec
->PolySegmentThinDashed
&&
363 !(infoRec
->PolySegmentThinDashedFlags
& NO_TRANSPARENCY
) &&
364 ((pGC
->alu
== GXcopy
) || !(infoRec
->PolySegmentThinDashedFlags
&
365 TRANSPARENCY_GXCOPY_ONLY
)) &&
366 CHECK_PLANEMASK(pGC
,infoRec
->PolySegmentThinDashedFlags
) &&
367 CHECK_ROP(pGC
,infoRec
->PolySegmentThinDashedFlags
) &&
368 CHECK_ROPSRC(pGC
,infoRec
->PolySegmentThinDashedFlags
) &&
369 CHECK_FG(pGC
,infoRec
->PolySegmentThinDashedFlags
)) {
371 pGC
->ops
->PolySegment
= infoRec
->PolySegmentThinDashed
;
374 if(infoRec
->PolylinesThinDashed
&&
375 !(infoRec
->PolylinesThinDashedFlags
& NO_TRANSPARENCY
) &&
376 ((pGC
->alu
== GXcopy
) || !(infoRec
->PolylinesThinDashedFlags
&
377 TRANSPARENCY_GXCOPY_ONLY
)) &&
378 CHECK_PLANEMASK(pGC
,infoRec
->PolylinesThinDashedFlags
) &&
379 CHECK_ROP(pGC
,infoRec
->PolylinesThinDashedFlags
) &&
380 CHECK_ROPSRC(pGC
,infoRec
->PolylinesThinDashedFlags
) &&
381 CHECK_FG(pGC
,infoRec
->PolylinesThinDashedFlags
)) {
383 pGC
->ops
->Polylines
= infoRec
->PolylinesThinDashed
;
386 if(pGC
->ops
->Polylines
!= XAAFallbackOps
.Polylines
)
387 pGC
->ops
->PolyRectangle
= miPolyRectangle
;
389 } else if(pGCPriv
->DashPattern
&& (pGC
->depth
!= 32)) {
391 if(infoRec
->PolySegmentThinDashed
&&
392 !(infoRec
->PolySegmentThinDashedFlags
& TRANSPARENCY_ONLY
) &&
393 CHECK_PLANEMASK(pGC
,infoRec
->PolySegmentThinDashedFlags
) &&
394 CHECK_ROP(pGC
,infoRec
->PolySegmentThinDashedFlags
) &&
395 CHECK_ROPSRC(pGC
,infoRec
->PolySegmentThinDashedFlags
) &&
396 CHECK_COLORS(pGC
,infoRec
->PolySegmentThinDashedFlags
)) {
398 pGC
->ops
->PolySegment
= infoRec
->PolySegmentThinDashed
;
401 if(infoRec
->PolylinesThinDashed
&&
402 !(infoRec
->PolylinesThinDashedFlags
& TRANSPARENCY_ONLY
) &&
403 CHECK_PLANEMASK(pGC
,infoRec
->PolylinesThinDashedFlags
) &&
404 CHECK_ROP(pGC
,infoRec
->PolylinesThinDashedFlags
) &&
405 CHECK_ROPSRC(pGC
,infoRec
->PolylinesThinDashedFlags
) &&
406 CHECK_COLORS(pGC
,infoRec
->PolylinesThinDashedFlags
)) {
408 pGC
->ops
->Polylines
= infoRec
->PolylinesThinDashed
;
411 if(pGC
->ops
->Polylines
!= XAAFallbackOps
.Polylines
)
412 pGC
->ops
->PolyRectangle
= miPolyRectangle
;
417 if(infoRec
->PolylinesWideSolid
&&
418 (pGC
->lineWidth
> 0) &&
419 (pGC
->fillStyle
== FillSolid
) &&
420 (pGC
->lineStyle
== LineSolid
) &&
421 CHECK_PLANEMASK(pGC
,infoRec
->PolylinesWideSolidFlags
) &&
422 CHECK_ROP(pGC
,infoRec
->PolylinesWideSolidFlags
) &&
423 CHECK_ROPSRC(pGC
,infoRec
->PolylinesWideSolidFlags
) &&
424 CHECK_FG(pGC
,infoRec
->PolylinesWideSolidFlags
)) {
426 pGC
->ops
->Polylines
= infoRec
->PolylinesWideSolid
;