summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArpad Borsos <[email protected]>2010-04-14 14:26:32 -0600
committerBrian Paul <[email protected]>2010-04-14 14:26:37 -0600
commitb3a68cdc6f4bf2c006aa01f8980536e8e520d62a (patch)
tree60993ca65bc6153f425d42e2283b05027db0a84d
parentd9793fc3ac0986f8665e269ecf993705132d0360 (diff)
softpipe: Fix division by zero
This can be triggered by running the cairo tests using the gl backend and softpipe. Signed-off-by: Brian Paul <[email protected]>
-rw-r--r--src/gallium/drivers/softpipe/sp_setup.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c
index 85966bc5e49..e64aee6d824 100644
--- a/src/gallium/drivers/softpipe/sp_setup.c
+++ b/src/gallium/drivers/softpipe/sp_setup.c
@@ -669,17 +669,17 @@ static void setup_tri_edges( struct setup_context *setup )
setup->emaj.sy = ceilf(vmin_y);
setup->emaj.lines = (int) ceilf(vmax_y - setup->emaj.sy);
- setup->emaj.dxdy = setup->emaj.dx / setup->emaj.dy;
+ setup->emaj.dxdy = setup->emaj.dy ? setup->emaj.dx / setup->emaj.dy : .0f;
setup->emaj.sx = vmin_x + (setup->emaj.sy - vmin_y) * setup->emaj.dxdy;
setup->etop.sy = ceilf(vmid_y);
setup->etop.lines = (int) ceilf(vmax_y - setup->etop.sy);
- setup->etop.dxdy = setup->etop.dx / setup->etop.dy;
+ setup->etop.dxdy = setup->etop.dy ? setup->etop.dx / setup->etop.dy : .0f;
setup->etop.sx = vmid_x + (setup->etop.sy - vmid_y) * setup->etop.dxdy;
setup->ebot.sy = ceilf(vmin_y);
setup->ebot.lines = (int) ceilf(vmid_y - setup->ebot.sy);
- setup->ebot.dxdy = setup->ebot.dx / setup->ebot.dy;
+ setup->ebot.dxdy = setup->ebot.dy ? setup->ebot.dx / setup->ebot.dy : .0f;
setup->ebot.sx = vmin_x + (setup->ebot.sy - vmin_y) * setup->ebot.dxdy;
}