[cairo-commit] libpixman/src renderedge.h,1.2,1.3

Carl Worth commit at pdx.freedesktop.org
Mon Feb 21 13:29:30 PST 2005


Committed by: cworth

Update of /cvs/cairo/libpixman/src
In directory gabe:/tmp/cvs-serv30647/src

Modified Files:
	renderedge.h 
Log Message:

        * src/renderedge.h: Add only-just-better-than-ASCII-art diagram
        showing all macros used in locating sub-pixel sample rows/columns.

        * src/renderedge.h (RenderEdgeStepSmall, RenderEdgeStepBig): Add
        missing protective parentheses around macro parameter usage.


Index: renderedge.h
===================================================================
RCS file: /cvs/cairo/libpixman/src/renderedge.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- renderedge.h	21 Jan 2005 18:26:28 -0000	1.2
+++ renderedge.h	21 Feb 2005 21:29:22 -0000	1.3
@@ -27,6 +27,45 @@
 
 #include "pixman-xserver-compat.h"
 
+/* Here is a drawing of the sample grid for the 4-bit alpha case,
+   along with indications of the various defined terms:
+
+                STEP_Y_SMALL
+┌─────┬─────┬─────┐  ↓
+│•••••│•••••│•••••│ ─── ⟵── Y_FRAC_FIRST
+│•••••│•••••│•••••│ ───
+│•••••│•••••│•••••│  ↑  ⟵── Y_FRAC_LAST
+├─────┼─────┼─────┤
+│•••••│•••••│•••••│
+│•••••│•••••│•••••│  ↓
+│•••••│•••••│•••••│ ───
+├─────┼─────┼─────┤ STEP_Y_BIG
+│•••••│•••••│•••••│ ───
+│•••••│•••••│•••••│  ↑
+│•••••│•••••│•••••│
+└─────┴─────┴─────┘
+ │   │ ││ ⟶│ │⟵STEP_X_BIG
+ │   │⟶││⟵STEP_X_SMALL
+ │   │
+ │   └ X_FRAC_LAST
+ │
+ â”” X_FRAC_FIRST
+
+N = 4 		(# of bits of alpha)
+MAX_ALPHA = 15	(# of samples per pixel)
+N_X_FRAC = 5	(# of sample columns per pixel)
+N_Y_FRAC = 3	(# of sample rows per column)
+STEP_X_SMALL	(distance between sample columns within a pixel)
+STEP_X_BIG	(distance between sample columns across pixel boundaries)
+STEP_Y_SMALL	(distance between sample rows within a pixel)
+STEP_Y_BIG	(distance between sample rows across pixel boundaries)
+X_FRAC_FIRST	(sub-pixel position of first sample column in pixel)
+X_FRAC_LAST	(sub-pixel position of last  sample column in pixel)
+Y_FRAC_FIRST	(sub-pixel position of first sample row in pixel)
+Y_FRAC_LAST	(sub-pixel position of last  sample row pixel)
+
+*/
+
 #define MAX_ALPHA(n)	((1 << (n)) - 1)
 #define N_Y_FRAC(n)	((n) == 1 ? 1 : (1 << ((n)/2)) - 1)
 #define N_X_FRAC(n)	((1 << ((n)/2)) + 1)
@@ -69,12 +108,12 @@
  * Step across a small sample grid gap
  */
 #define RenderEdgeStepSmall(edge) { \
-    edge->x += edge->stepx_small;   \
-    edge->e += edge->dx_small;	    \
-    if (edge->e > 0)		    \
+    (edge)->x += (edge)->stepx_small;   \
+    (edge)->e += (edge)->dx_small;	    \
+    if ((edge)->e > 0)		    \
     {				    \
-	edge->e -= edge->dy;	    \
-	edge->x += edge->signdx;    \
+	(edge)->e -= (edge)->dy;	    \
+	(edge)->x += (edge)->signdx;    \
     }				    \
 }
 
@@ -82,12 +121,12 @@
  * Step across a large sample grid gap
  */
 #define RenderEdgeStepBig(edge) {   \
-    edge->x += edge->stepx_big;	    \
-    edge->e += edge->dx_big;	    \
-    if (edge->e > 0)		    \
+    (edge)->x += (edge)->stepx_big;	    \
+    (edge)->e += (edge)->dx_big;	    \
+    if ((edge)->e > 0)		    \
     {				    \
-	edge->e -= edge->dy;	    \
-	edge->x += edge->signdx;    \
+	(edge)->e -= (edge)->dy;	    \
+	(edge)->x += (edge)->signdx;    \
     }				    \
 }
 




More information about the cairo-commit mailing list