summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Avison <bavison@riscosopen.org>2015-09-04 03:09:20 +0100
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2015-09-25 14:26:04 +0300
commit2876d8d3dd6a71cb9eb3ac93e5b9c18b71a452da (patch)
tree8177094b6196874e5c746c7e2061f30646e455fc
parent0e2e9751282b19280c92be4a80c5ae476bae0ce4 (diff)
affine-bench: remove 8e margin from COVER area
Patch "Remove the 8e extra safety margin in COVER_CLIP analysis" reduced the required image area for setting the COVER flags in pixman.c:analyze_extent(). Do the same reduction in affine-bench. Leaving the old calculations in place would be very confusing for anyone reading the code. Also add a comment that explains how affine-bench wants to hit the COVER paths. This explains why the intricate extent calculations are copied from pixman.c. [Pekka: split patch, change comments, write commit message] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Ben Avison <bavison@riscosopen.org>
-rw-r--r--test/affine-bench.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/test/affine-bench.c b/test/affine-bench.c
index 9e0121e7..86bf46ef 100644
--- a/test/affine-bench.c
+++ b/test/affine-bench.c
@@ -395,14 +395,26 @@ main (int argc, char *argv[])
return EXIT_FAILURE;
}
+ /* Compute required extents for source and mask image so they qualify
+ * for COVER fast paths and get the flags in pixman.c:analyze_extent().
+ * These computations are for FAST_PATH_SAMPLES_COVER_CLIP_BILINEAR,
+ * but at the same time they also allow COVER_CLIP_NEAREST.
+ */
compute_transformed_extents (&binfo.transform, &dest_box, &transformed);
- /* The source area is expanded by a tiny bit (8/65536th pixel)
- * to match the calculation of the COVER_CLIP flags in analyze_extent()
+ xmin = pixman_fixed_to_int (transformed.x1 - pixman_fixed_1 / 2);
+ ymin = pixman_fixed_to_int (transformed.y1 - pixman_fixed_1 / 2);
+ xmax = pixman_fixed_to_int (transformed.x2 + pixman_fixed_1 / 2);
+ ymax = pixman_fixed_to_int (transformed.y2 + pixman_fixed_1 / 2);
+ /* Note:
+ * The upper limits can be reduced to the following when fetchers
+ * are guaranteed to not access pixels with zero weight. This concerns
+ * particularly all bilinear samplers.
+ *
+ * xmax = pixman_fixed_to_int (transformed.x2 + pixman_fixed_1 / 2 - pixman_fixed_e);
+ * ymax = pixman_fixed_to_int (transformed.y2 + pixman_fixed_1 / 2 - pixman_fixed_e);
+ * This is equivalent to subtracting 0.5 and rounding up, rather than
+ * subtracting 0.5, rounding down and adding 1.
*/
- xmin = pixman_fixed_to_int (transformed.x1 - 8 * pixman_fixed_e - pixman_fixed_1 / 2);
- ymin = pixman_fixed_to_int (transformed.y1 - 8 * pixman_fixed_e - pixman_fixed_1 / 2);
- xmax = pixman_fixed_to_int (transformed.x2 + 8 * pixman_fixed_e + pixman_fixed_1 / 2);
- ymax = pixman_fixed_to_int (transformed.y2 + 8 * pixman_fixed_e + pixman_fixed_1 / 2);
binfo.src_x = -xmin;
binfo.src_y = -ymin;