updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / xorg-server-dev / revert-trapezoids.patch
blob0dc8fd5081b4e665dc28491c9e6bae5509cb9a00
1 diff -ru a/fb/fbpict.c b/fb/fbpict.c
2 --- a/fb/fbpict.c 2011-08-01 01:44:24.000000000 +0200
3 +++ b/fb/fbpict.c 2011-10-05 22:45:29.000000000 +0200
4 @@ -364,7 +364,7 @@
5 ps->Glyphs = miGlyphs;
6 ps->CompositeRects = miCompositeRects;
7 ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
8 - ps->Trapezoids = fbTrapezoids;
9 + ps->Trapezoids = miTrapezoids;
10 ps->AddTraps = fbAddTraps;
11 ps->AddTriangles = fbAddTriangles;
12 ps->Triangles = fbTriangles;
13 diff -ru a/render/mipict.c b/render/mipict.c
14 --- a/render/mipict.c 2011-04-04 05:19:50.000000000 +0200
15 +++ b/render/mipict.c 2011-10-05 22:02:53.000000000 +0200
16 @@ -573,6 +573,67 @@
20 +void
21 +miTrapezoids (CARD8 op,
22 + PicturePtr pSrc,
23 + PicturePtr pDst,
24 + PictFormatPtr maskFormat,
25 + INT16 xSrc,
26 + INT16 ySrc,
27 + int ntrap,
28 + xTrapezoid *traps)
30 + ScreenPtr pScreen = pDst->pDrawable->pScreen;
31 + PictureScreenPtr ps = GetPictureScreen(pScreen);
33 + /*
34 + * Check for solid alpha add
35 + */
36 + if (op == PictOpAdd && miIsSolidAlpha (pSrc))
37 + {
38 + for (; ntrap; ntrap--, traps++)
39 + (*ps->RasterizeTrapezoid) (pDst, traps, 0, 0);
40 + }
41 + else if (maskFormat)
42 + {
43 + PicturePtr pPicture;
44 + BoxRec bounds;
45 + INT16 xDst, yDst;
46 + INT16 xRel, yRel;
48 + xDst = traps[0].left.p1.x >> 16;
49 + yDst = traps[0].left.p1.y >> 16;
51 + miTrapezoidBounds (ntrap, traps, &bounds);
52 + if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
53 + return;
54 + pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,
55 + bounds.x2 - bounds.x1,
56 + bounds.y2 - bounds.y1);
57 + if (!pPicture)
58 + return;
59 + for (; ntrap; ntrap--, traps++)
60 + (*ps->RasterizeTrapezoid) (pPicture, traps,
61 + -bounds.x1, -bounds.y1);
62 + xRel = bounds.x1 + xSrc - xDst;
63 + yRel = bounds.y1 + ySrc - yDst;
64 + CompositePicture (op, pSrc, pPicture, pDst,
65 + xRel, yRel, 0, 0, bounds.x1, bounds.y1,
66 + bounds.x2 - bounds.x1,
67 + bounds.y2 - bounds.y1);
68 + FreePicture (pPicture, 0);
69 + }
70 + else
71 + {
72 + if (pDst->polyEdge == PolyEdgeSharp)
73 + maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
74 + else
75 + maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
76 + for (; ntrap; ntrap--, traps++)
77 + miTrapezoids (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps);
78 + }
81 Bool
82 miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
84 @@ -599,7 +660,7 @@
85 ps->Composite = 0; /* requires DDX support */
86 ps->Glyphs = miGlyphs;
87 ps->CompositeRects = miCompositeRects;
88 - ps->Trapezoids = 0;
89 + ps->Trapezoids = miTrapezoids;
90 ps->Triangles = 0;
92 ps->RasterizeTrapezoid = 0; /* requires DDX support */
93 diff -ru a/render/mipict.h b/render/mipict.h
94 --- a/render/mipict.h 2011-04-04 05:19:50.000000000 +0200
95 +++ b/render/mipict.h 2011-10-05 22:06:19.000000000 +0200
96 @@ -129,6 +129,23 @@
97 CARD32 pixel,
98 xRenderColor *color);
100 +extern _X_EXPORT PicturePtr
101 +miCreateAlphaPicture (ScreenPtr pScreen,
102 + PicturePtr pDst,
103 + PictFormatPtr pPictFormat,
104 + CARD16 width,
105 + CARD16 height);
107 +extern _X_EXPORT void
108 +miTrapezoids (CARD8 op,
109 + PicturePtr pSrc,
110 + PicturePtr pDst,
111 + PictFormatPtr maskFormat,
112 + INT16 xSrc,
113 + INT16 ySrc,
114 + int ntrap,
115 + xTrapezoid *traps);
117 extern _X_EXPORT Bool
118 miIsSolidAlpha (PicturePtr pSrc);
120 diff -ru a/render/mitrap.c b/render/mitrap.c
121 --- a/render/mitrap.c 2011-04-04 05:19:50.000000000 +0200
122 +++ b/render/mitrap.c 2011-10-05 22:05:29.000000000 +0200
123 @@ -34,6 +34,55 @@
124 #include "picturestr.h"
125 #include "mipict.h"
127 +PicturePtr
128 +miCreateAlphaPicture (ScreenPtr pScreen,
129 + PicturePtr pDst,
130 + PictFormatPtr pPictFormat,
131 + CARD16 width,
132 + CARD16 height)
134 + PixmapPtr pPixmap;
135 + PicturePtr pPicture;
136 + GCPtr pGC;
137 + int error;
138 + xRectangle rect;
140 + if (width > 32767 || height > 32767)
141 + return 0;
143 + if (!pPictFormat)
145 + if (pDst->polyEdge == PolyEdgeSharp)
146 + pPictFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
147 + else
148 + pPictFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
149 + if (!pPictFormat)
150 + return 0;
153 + pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
154 + pPictFormat->depth, 0);
155 + if (!pPixmap)
156 + return 0;
157 + pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
158 + if (!pGC)
160 + (*pScreen->DestroyPixmap) (pPixmap);
161 + return 0;
163 + ValidateGC (&pPixmap->drawable, pGC);
164 + rect.x = 0;
165 + rect.y = 0;
166 + rect.width = width;
167 + rect.height = height;
168 + (*pGC->ops->PolyFillRect)(&pPixmap->drawable, pGC, 1, &rect);
169 + FreeScratchGC (pGC);
170 + pPicture = CreatePicture (0, &pPixmap->drawable, pPictFormat,
171 + 0, 0, serverClient, &error);
172 + (*pScreen->DestroyPixmap) (pPixmap);
173 + return pPicture;
176 static xFixed
177 miLineFixedX (xLineFixed *l, xFixed y, Bool ceil)