summaryrefslogtreecommitdiff
path: root/fb/fbtrap.c
diff options
context:
space:
mode:
authorSoren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com>2007-05-23 15:50:25 -0400
committerSoren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com>2007-05-23 15:50:25 -0400
commit9d87ef4e0dff40ea39f1b209c67b90079fc79065 (patch)
tree8c8d6d1eb7178bb7bce161bf04e8ae8b050a0ffe /fb/fbtrap.c
parent2a960c442bd7560630f52b55d82ec0517542ee5a (diff)
- Make image_from_pict() non-static
- Delete fbedge.c and fbedgeimp.h - Use pixman_rasterize_edges() in fbtrap.c
Diffstat (limited to 'fb/fbtrap.c')
-rw-r--r--fb/fbtrap.c80
1 files changed, 79 insertions, 1 deletions
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 478a80f4f..6e8da2424 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -35,6 +35,7 @@
#include "renderedge.h"
#include "fbpict.h"
+#if 0
void
fbAddTraps (PicturePtr pPicture,
INT16 x_off,
@@ -98,6 +99,75 @@ fbAddTraps (PicturePtr pPicture,
fbFinishAccess (pPicture->pDrawable);
}
+#endif
+
+void
+fbAddTraps (PicturePtr pPicture,
+ INT16 x_off,
+ INT16 y_off,
+ int ntrap,
+ xTrap *traps)
+{
+ FbBits *buf;
+ int bpp;
+ int width;
+ int stride;
+ int height;
+ int pxoff, pyoff;
+
+ xFixed x_off_fixed;
+ xFixed y_off_fixed;
+ RenderEdge l, r;
+ xFixed t, b;
+
+ pixman_image_t *image = image_from_pict (pPicture, FALSE);
+
+ fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
+
+ width = pPicture->pDrawable->width;
+ height = pPicture->pDrawable->height;
+#if 0
+ x_off += pxoff;
+ y_off += pyoff;
+#endif
+
+ x_off_fixed = IntToxFixed(y_off);
+ y_off_fixed = IntToxFixed(y_off);
+
+ while (ntrap--)
+ {
+ t = traps->top.y + y_off_fixed;
+ if (t < 0)
+ t = 0;
+ t = RenderSampleCeilY (t, bpp);
+
+ b = traps->bot.y + y_off_fixed;
+ if (xFixedToInt (b) >= height)
+ b = IntToxFixed (height) - 1;
+ b = RenderSampleFloorY (b, bpp);
+
+ if (b >= t)
+ {
+ /* initialize edge walkers */
+ RenderEdgeInit (&l, bpp, t,
+ traps->top.l + x_off_fixed,
+ traps->top.y + y_off_fixed,
+ traps->bot.l + x_off_fixed,
+ traps->bot.y + y_off_fixed);
+
+ RenderEdgeInit (&r, bpp, t,
+ traps->top.r + x_off_fixed,
+ traps->top.y + y_off_fixed,
+ traps->bot.r + x_off_fixed,
+ traps->bot.y + y_off_fixed);
+
+ pixman_rasterize_edges (image, &l, &r, t, b);
+ }
+ traps++;
+ }
+
+ fbFinishAccess (pPicture->pDrawable);
+}
void
fbRasterizeTrapezoid (PicturePtr pPicture,
@@ -116,16 +186,21 @@ fbRasterizeTrapezoid (PicturePtr pPicture,
xFixed y_off_fixed;
RenderEdge l, r;
xFixed t, b;
+ pixman_image_t *image;
if (!xTrapezoidValid (trap))
return;
+ image = image_from_pict (pPicture, FALSE);
+
fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
width = pPicture->pDrawable->width;
height = pPicture->pDrawable->height;
+#if 0
x_off += pxoff;
y_off += pyoff;
+#endif
x_off_fixed = IntToxFixed(x_off);
y_off_fixed = IntToxFixed(y_off);
@@ -144,8 +219,11 @@ fbRasterizeTrapezoid (PicturePtr pPicture,
/* initialize edge walkers */
RenderLineFixedEdgeInit (&l, bpp, t, &trap->left, x_off, y_off);
RenderLineFixedEdgeInit (&r, bpp, t, &trap->right, x_off, y_off);
-
+
+ pixman_rasterize_edges (image, &l, &r, t, b);
+#if 0
fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b);
+#endif
}
fbFinishAccess (pPicture->pDrawable);