From 675cbd5fade91fd6a6bf533a31b0a211237af6e8 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 1 Jul 2012 12:39:13 +0100 Subject: sna/trapezoids: Skip the division when converting coverage to floating point Signed-off-by: Chris Wilson --- src/sna/sna_trapezoids.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/sna/sna_trapezoids.c') diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c index 7bbe2708..36defa10 100644 --- a/src/sna/sna_trapezoids.c +++ b/src/sna/sna_trapezoids.c @@ -2770,6 +2770,7 @@ composite_unaligned_trap_row(struct sna *sna, BoxRec box; int opacity; int x1, x2; +#define u8_to_float(x) ((x) * (1.f/255)) if (covered == 0) return; @@ -2800,7 +2801,7 @@ composite_unaligned_trap_row(struct sna *sna, if (opacity) composite_unaligned_box(sna, tmp, &box, - opacity/255., clip); + u8_to_float(opacity), clip); } else { if (pixman_fixed_frac(trap->left.p1.x)) { box.x1 = x1; @@ -2811,7 +2812,7 @@ composite_unaligned_trap_row(struct sna *sna, if (opacity) composite_unaligned_box(sna, tmp, &box, - opacity/255., clip); + u8_to_float(opacity), clip); } if (x2 > x1) { @@ -2819,7 +2820,8 @@ composite_unaligned_trap_row(struct sna *sna, box.x2 = x2; composite_unaligned_box(sna, tmp, &box, - covered*SAMPLES_X/255., clip); + covered == SAMPLES_Y ? 1. : u8_to_float(covered*SAMPLES_X), + clip); } if (pixman_fixed_frac(trap->right.p1.x)) { @@ -2831,7 +2833,7 @@ composite_unaligned_trap_row(struct sna *sna, if (opacity) composite_unaligned_box(sna, tmp, &box, - opacity/255., clip); + u8_to_float(opacity), clip); } } } -- cgit v1.2.3