summaryrefslogtreecommitdiff
path: root/fb
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2011-01-11 09:46:46 -0500
committerSøren Sandmann Pedersen <ssp@l3000.localdomain>2011-02-26 13:58:53 -0500
commit788ccb9a8bcf6a4fb4054c507111eec3338fb969 (patch)
treef9e50cf3c2c75fa1411ef51dc69662b97f9aa6ec /fb
parent197df069a4037d6faa2723c31ffba09c95d71166 (diff)
Move miTrapezoids() into fb as fbTrapezoids()
The main consumer of trapezoids, cairo, is using the Trapezoids request, which is currently implemented in the miTrapezoids() function. That function splits the request into smaller bits and calls lower level functions such as AddTrap. By moving the implementation of the whole request into fb, we can instead call pixman_composite_trapezoids() to do the whole request in one step. There are no callers of miTrapezoids in any of the open source drivers, although exa and uxa have their own copies of the function. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Søren Sandmann <ssp@redhat.com>
Diffstat (limited to 'fb')
-rw-r--r--fb/fbpict.c1
-rw-r--r--fb/fbpict.h10
-rw-r--r--fb/fbtrap.c83
3 files changed, 91 insertions, 3 deletions
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 7636040c6..6e66db844 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -364,6 +364,7 @@ fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
ps->Glyphs = miGlyphs;
ps->CompositeRects = miCompositeRects;
ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
+ ps->Trapezoids = fbTrapezoids;
ps->AddTraps = fbAddTraps;
ps->AddTriangles = fbAddTriangles;
diff --git a/fb/fbpict.h b/fb/fbpict.h
index 9abced17f..03d266589 100644
--- a/fb/fbpict.h
+++ b/fb/fbpict.h
@@ -65,4 +65,14 @@ fbAddTriangles (PicturePtr pPicture,
int ntri,
xTriangle *tris);
+extern _X_EXPORT void
+fbTrapezoids (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int ntrap,
+ xTrapezoid *traps);
+
#endif /* _FBPICT_H_ */
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index c309ceb27..687de5527 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -123,9 +123,9 @@ fbAddTriangles (PicturePtr pPicture,
* / \ / \
* / \ / \
* / + + \
- * / -- -- \
- * / -- -- \
- * / --- --- \
+ * / -- -- \
+ * / -- -- \
+ * / --- --- \
* +-- --+
*/
@@ -157,3 +157,80 @@ fbAddTriangles (PicturePtr pPicture,
}
}
+
+void
+fbTrapezoids (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int ntrap,
+ xTrapezoid *traps)
+{
+ pixman_image_t *src, *dst;
+ int src_xoff, src_yoff;
+ int dst_xoff, dst_yoff;
+
+ if (ntrap == 0)
+ return;
+
+ src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
+ dst = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
+
+ if (src && dst)
+ {
+ pixman_format_code_t format;
+ int x_dst, y_dst;
+ int i;
+
+ x_dst = traps[0].left.p1.x >> 16;
+ y_dst = traps[0].left.p1.y >> 16;
+
+ if (!maskFormat)
+ {
+ if (pDst->polyEdge == PolyEdgeSharp)
+ format = PIXMAN_a1;
+ else
+ format = PIXMAN_a8;
+
+ for (i = 0; i < ntrap; ++i)
+ {
+ pixman_composite_trapezoids (op, src, dst, format,
+ xSrc + src_xoff,
+ ySrc + src_yoff,
+ x_dst + dst_xoff,
+ y_dst + dst_yoff,
+ 1, (pixman_trapezoid_t *)traps++);
+ }
+ }
+ else
+ {
+ switch (PICT_FORMAT_A (maskFormat->format))
+ {
+ case 1:
+ format = PIXMAN_a1;
+ break;
+
+ case 4:
+ format = PIXMAN_a4;
+ break;
+
+ default:
+ case 8:
+ format = PIXMAN_a8;
+ break;
+ }
+
+ pixman_composite_trapezoids (op, src, dst, format,
+ xSrc + src_xoff,
+ ySrc + src_yoff,
+ x_dst + dst_xoff,
+ y_dst + dst_yoff,
+ ntrap, (pixman_trapezoid_t *)traps);
+ }
+ }
+
+ free_pixman_pict (pSrc, src);
+ free_pixman_pict (pDst, dst);
+}