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 "pixmapstr.h" 13#include "xf86str.h" 14#include "xaa.h" 15#include "xaalocal.h" 16 17/* 18 Much of this file based on code by 19 Harm Hanemaayer (H.Hanemaayer@inter.nl.net). 20*/ 21 22 23void 24XAAPolyRectangleThinSolid( 25 DrawablePtr pDrawable, 26 GCPtr pGC, 27 int nRectsInit, 28 xRectangle *pRectsInit ) 29{ 30 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); 31 int nClipRects; /* number of clip rectangles */ 32 BoxPtr pClipRects; /* points to the list of clip rects */ 33 int xOrigin; /* Drawables x origin */ 34 int yOrigin; /* Drawables x origin */ 35 xRectangle *pRect; /* list of rects */ 36 int nRects; /* running count of number of rects */ 37 int origX1, origY1; /* original rectangle's U/L corner */ 38 int origX2, origY2; /* original rectangle's L/R corner */ 39 int clippedX1; /* clipped rectangle's left x */ 40 int clippedY1; /* clipped rectangle's top y */ 41 int clippedX2; /* clipped rectangle's right x */ 42 int clippedY2; /* clipped rectangle's bottom y */ 43 int clipXMin; /* upper left corner of clip rect */ 44 int clipYMin; /* upper left corner of clip rect */ 45 int clipXMax; /* lower right corner of clip rect */ 46 int clipYMax; /* lower right corner of clip rect */ 47 int width, height; /* width and height of rect */ 48 49 nClipRects = RegionNumRects(pGC->pCompositeClip); 50 pClipRects = RegionRects(pGC->pCompositeClip); 51 52 if(!nClipRects) return; 53 54 xOrigin = pDrawable->x; 55 yOrigin = pDrawable->y; 56 57 58 (*infoRec->SetupForSolidLine)(infoRec->pScrn, 59 pGC->fgPixel, pGC->alu, pGC->planemask); 60 61 62 for ( ; nClipRects > 0; 63 nClipRects--, pClipRects++ ) 64 { 65 clipYMin = pClipRects->y1; 66 clipYMax = pClipRects->y2 - 1; 67 clipXMin = pClipRects->x1; 68 clipXMax = pClipRects->x2 - 1; 69 70 for (pRect = pRectsInit, nRects = nRectsInit; 71 nRects > 0; 72 nRects--, pRect++ ) 73 { 74 /* translate rectangle data over to the drawable */ 75 origX1 = pRect->x + xOrigin; 76 origY1 = pRect->y + yOrigin; 77 origX2 = origX1 + pRect->width; 78 origY2 = origY1 + pRect->height; 79 80 /* reject entire rectangle if completely outside clip rect */ 81 if ((origX1 > clipXMax) || (origX2 < clipXMin) || 82 (origY1 > clipYMax) || (origY2 < clipYMin)) 83 continue; 84 85 /* clip the rectangle */ 86 clippedX1 = max (origX1, clipXMin); 87 clippedX2 = min (origX2, clipXMax); 88 clippedY1 = max (origY1, clipYMin); 89 clippedY2 = min (origY2, clipYMax); 90 91 width = clippedX2 - clippedX1 + 1; 92 93 if (origY1 >= clipYMin) { 94 (*infoRec->SubsequentSolidHorVertLine)(infoRec->pScrn, 95 clippedX1, clippedY1, width, DEGREES_0); 96 97 /* don't overwrite corner */ 98 clippedY1++; 99 } 100 101 if ((origY2 <= clipYMax) && (origY1 != origY2)) { 102 (*infoRec->SubsequentSolidHorVertLine)(infoRec->pScrn, 103 clippedX1, clippedY2, width, DEGREES_0); 104 105 /* don't overwrite corner */ 106 clippedY2--; 107 } 108 109 if (clippedY2 < clippedY1) continue; 110 111 height = clippedY2 - clippedY1 + 1; 112 113 /* draw vertical edges using lines if not clipped out */ 114 if (origX1 >= clipXMin) 115 (*infoRec->SubsequentSolidHorVertLine)(infoRec->pScrn, 116 clippedX1, clippedY1, height, DEGREES_270); 117 118 if ((origX2 <= clipXMax) && (origX2 != origX1)) 119 (*infoRec->SubsequentSolidHorVertLine)(infoRec->pScrn, 120 clippedX2, clippedY1, height, DEGREES_270); 121 } 122 } 123 124 SET_SYNC_FLAG(infoRec); 125} 126 127 128 129 130 131 132 133 134 135 136 137