/* The rasterizer generates 2x2 quads of fragment and feeds them to
- * the current fp_machine (see below).
+ * the current fp_machine (see below).
+ * Remember that Y=0=top with Y increasing down the window.
*/
-#define QUAD_BOTTOM_LEFT 0
-#define QUAD_BOTTOM_RIGHT 1
-#define QUAD_TOP_LEFT 2
-#define QUAD_TOP_RIGHT 3
+#define QUAD_TOP_LEFT 0
+#define QUAD_TOP_RIGHT 1
+#define QUAD_BOTTOM_LEFT 2
+#define QUAD_BOTTOM_RIGHT 3
-#define MASK_BOTTOM_LEFT 0x1
-#define MASK_BOTTOM_RIGHT 0x2
-#define MASK_TOP_LEFT 0x4
-#define MASK_TOP_RIGHT 0x8
+#define MASK_TOP_LEFT (1 << QUAD_TOP_LEFT)
+#define MASK_TOP_RIGHT (1 << QUAD_TOP_RIGHT)
+#define MASK_BOTTOM_LEFT (1 << QUAD_BOTTOM_LEFT)
+#define MASK_BOTTOM_RIGHT (1 << QUAD_BOTTOM_RIGHT)
#define MASK_ALL 0xf
if (setup->quad.x0 < minx)
setup->quad.mask &= (MASK_BOTTOM_RIGHT | MASK_TOP_RIGHT);
if (setup->quad.y0 < miny)
- setup->quad.mask &= (MASK_TOP_LEFT | MASK_TOP_RIGHT);
+ setup->quad.mask &= (MASK_BOTTOM_LEFT | MASK_BOTTOM_RIGHT);
if (setup->quad.x0 == maxx - 1)
setup->quad.mask &= (MASK_BOTTOM_LEFT | MASK_TOP_LEFT);
if (setup->quad.y0 == maxy - 1)
- setup->quad.mask &= (MASK_BOTTOM_LEFT | MASK_BOTTOM_RIGHT);
+ setup->quad.mask &= (MASK_TOP_LEFT | MASK_TOP_RIGHT);
}
unsigned mask = 0;
if (x >= setup->span.left[0] && x < setup->span.right[0])
- mask |= MASK_BOTTOM_LEFT;
+ mask |= MASK_TOP_LEFT;
if (x >= setup->span.left[1] && x < setup->span.right[1])
- mask |= MASK_TOP_LEFT;
+ mask |= MASK_BOTTOM_LEFT;
if (x+1 >= setup->span.left[0] && x+1 < setup->span.right[0])
- mask |= MASK_BOTTOM_RIGHT;
+ mask |= MASK_TOP_RIGHT;
if (x+1 >= setup->span.left[1] && x+1 < setup->span.right[1])
- mask |= MASK_TOP_RIGHT;
+ mask |= MASK_BOTTOM_RIGHT;
return mask;
}