summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2004-09-11 09:23:12 +0000
committerEric Anholt <anholt@freebsd.org>2004-09-11 09:23:12 +0000
commit396100dd235105a0e2c9013f1e07e4dae0cc3404 (patch)
treea21e3ecabcc65fce11db66fabc56abac6264bd64 /hw
parent501dcf37aac4ec9298e8c79ca65c048c362bce31 (diff)
- Don't require Imrecise mode for Trapezoid acceleration. It looks like we
might be able to do Precise in hardware, so leave it up to the driver. - Add a helper function for computing a set of offsets for smooth trapezoid rasterizing using many sharp trapezoids.
Diffstat (limited to 'hw')
-rw-r--r--hw/kdrive/src/kaa.h4
-rw-r--r--hw/kdrive/src/kaapict.c31
2 files changed, 34 insertions, 1 deletions
diff --git a/hw/kdrive/src/kaa.h b/hw/kdrive/src/kaa.h
index d849de03f..cba8fb3d1 100644
--- a/hw/kdrive/src/kaa.h
+++ b/hw/kdrive/src/kaa.h
@@ -104,4 +104,8 @@ kaaRasterizeTrapezoid(PicturePtr pPict,
int xoff,
int yoff);
+void
+kaaInitTrapOffsets(int grid_order, float *x_offsets, float *y_offsets,
+ float x_offset, float y_offset);
+
#endif /* _KAA_H_ */
diff --git a/hw/kdrive/src/kaapict.c b/hw/kdrive/src/kaapict.c
index 8895a80f0..1918b78df 100644
--- a/hw/kdrive/src/kaapict.c
+++ b/hw/kdrive/src/kaapict.c
@@ -637,6 +637,13 @@ miLineFixedX (xLineFixed *l, xFixed y, Bool ceil)
*/
#define XFIXED_TO_FLOAT(x) (((float)((x) & 0xffffff00)) / 65536.0)
+/* This is just to allow us to work on the hardware side of the problem while
+ * waiting for cairo to get a new tesselator. We may not be able to support
+ * RasterizeTrapezoid at all due to the abutting edges requirement, but it might
+ * be technically legal if we widened the trap by some epsilon, so that alpha
+ * values at abutting edges were a little too big and capped at one, rather than
+ * a little too small and looked bad.
+ */
void kaaRasterizeTrapezoid(PicturePtr pDst,
xTrapezoid *trap,
int xoff,
@@ -651,7 +658,6 @@ void kaaRasterizeTrapezoid(PicturePtr pDst,
if (!pScreenPriv->enabled ||
!pKaaScr->info->PrepareTrapezoids ||
pDst->pDrawable->type != DRAWABLE_PIXMAP ||
- pDst->polyMode == PolyModePrecise ||
pDst->alphaMap || pDst->format != PICT_a8)
{
KdCheckRasterizeTrapezoid (pDst, trap, xoff, yoff);
@@ -688,3 +694,26 @@ void kaaRasterizeTrapezoid(PicturePtr pDst,
(*pKaaScr->info->Trapezoids) (&ktrap, 1);
(*pKaaScr->info->DoneTrapezoids) ();
}
+
+void
+kaaInitTrapOffsets(int grid_order, float *x_offsets, float *y_offsets,
+ float x_offset, float y_offset)
+{
+ int i = 0;
+ float x, y, x_count, y_count;
+
+ x_count = (1 << (grid_order / 2)) + 1;
+ y_count = (1 << (grid_order / 2)) - 1;
+
+ x_offset += 1.0 / x_count / 2.0;
+ y_offset += 1.0 / y_count / 2.0;
+
+ for (x = 0; x < x_count; x++) {
+ for (y = 0; y < y_count; y++) {
+ x_offsets[i] = x / x_count + x_offset;
+ y_offsets[i] = y / y_count + y_offset;
+ i++;
+ }
+ }
+}
+