+ position->x[0] = subpixel_snap(v0[0][0] - setup->pixel_offset);
+ position->x[1] = subpixel_snap(v1[0][0] - setup->pixel_offset);
+ position->x[2] = subpixel_snap(v2[0][0] - setup->pixel_offset);
+ position->x[3] = 0;
+
+ position->y[0] = subpixel_snap(v0[0][1] - setup->pixel_offset);
+ position->y[1] = subpixel_snap(v1[0][1] - setup->pixel_offset);
+ position->y[2] = subpixel_snap(v2[0][1] - setup->pixel_offset);
+ position->y[3] = 0;
+
+ position->dx01 = position->x[0] - position->x[1];
+ position->dy01 = position->y[0] - position->y[1];
+
+ position->dx20 = position->x[2] - position->x[0];
+ position->dy20 = position->y[2] - position->y[0];
+
+ position->area = IMUL64(position->dx01, position->dy20) -
+ IMUL64(position->dx20, position->dy01);
+}
+
+
+/**
+ * Rotate a triangle, flipping its clockwise direction,
+ * Swaps values for xy[0] and xy[1]
+ */
+static inline void
+rotate_fixed_position_01( struct fixed_position* position )
+{
+ int x, y;
+
+ x = position->x[1];
+ y = position->y[1];
+ position->x[1] = position->x[0];
+ position->y[1] = position->y[0];
+ position->x[0] = x;
+ position->y[0] = y;
+
+ position->dx01 = -position->dx01;
+ position->dy01 = -position->dy01;
+ position->dx20 = position->x[2] - position->x[0];
+ position->dy20 = position->y[2] - position->y[0];
+
+ position->area = -position->area;
+}
+
+
+/**
+ * Rotate a triangle, flipping its clockwise direction,
+ * Swaps values for xy[1] and xy[2]
+ */
+static inline void
+rotate_fixed_position_12( struct fixed_position* position )
+{
+ int x, y;
+
+ x = position->x[2];
+ y = position->y[2];
+ position->x[2] = position->x[1];
+ position->y[2] = position->y[1];
+ position->x[1] = x;
+ position->y[1] = y;
+
+ x = position->dx01;
+ y = position->dy01;
+ position->dx01 = -position->dx20;
+ position->dy01 = -position->dy20;
+ position->dx20 = -x;
+ position->dy20 = -y;
+
+ position->area = -position->area;