xserver/hw/kdrive/src kaa.h,1.6,1.7 kaapict.c,1.12,1.13

Eric Anholt <xserver-commit-u7BhqnqprCWvj1b/[email protected]>
Newsgroups gmane.comp.freedesktop.xserver.cvs
Message-ID <[email protected]>
Committed by: anholt

Update of /cvs/xserver/xserver/hw/kdrive/src
In directory gabe:/tmp/cvs-serv10193/hw/kdrive/src

Modified Files:
	kaa.h kaapict.c 
Log Message:
- 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.


Index: kaa.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/kaa.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- kaa.h	30 Aug 2004 22:16:46 -0000	1.6
+++ kaa.h	11 Sep 2004 09:23:12 -0000	1.7
@@ -104,4 +104,8 @@
 		      int xoff,
 		      int yoff);
 
+void
+kaaInitTrapOffsets(int grid_order, float *x_offsets, float *y_offsets,
+		   float x_offset, float y_offset);
+
 #endif /* _KAA_H_ */

Index: kaapict.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/kaapict.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- kaapict.c	30 Aug 2004 22:16:46 -0000	1.12
+++ kaapict.c	11 Sep 2004 09:23:12 -0000	1.13
@@ -637,6 +637,13 @@
  */
 #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 @@
     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 @@
     (*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++;
+	}
+    }
+}
+
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.