summaryrefslogtreecommitdiff
path: root/src/sna/sna_trapezoids.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-07-01 12:39:13 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-07-01 13:25:00 +0100
commit675cbd5fade91fd6a6bf533a31b0a211237af6e8 (patch)
treeb64c288623a163d00329effbcd8f15055f3957da /src/sna/sna_trapezoids.c
parent182c3637cc5d3a6ce52127087aa2f19ca2b42719 (diff)
sna/trapezoids: Skip the division when converting coverage to floating point
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_trapezoids.c')
-rw-r--r--src/sna/sna_trapezoids.c10
1 files changed, 6 insertions, 4 deletions
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);
}
}
}