summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Oliver Stöneberg <oliverst@online.de>2014-10-23 15:32:31 +0200
committer Oliver Stöneberg <oliverst@online.de>2014-10-23 15:32:31 +0200
commit38b44ae386fcd47495c186feb30f654a625ba233 (patch)
treeed750340ec0fdf51e6ccaa269aee7aefec7236ef
parent124803b4761e887791b4aaadab1d3ceb2abb1932 (diff)
only normalize component bounds in layout_element::layout_element() when components exist (nw)
avoids division by zero for sets using src/emu/layout/vertical.lay
-rw-r--r--src/emu/rendlay.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/emu/rendlay.c b/src/emu/rendlay.c
index 97342836972..2f9393180e1 100644
--- a/src/emu/rendlay.c
+++ b/src/emu/rendlay.c
@@ -452,19 +452,22 @@ layout_element::layout_element(running_machine &machine, xml_data_node &elemnode
m_maxstate = 65536;
}
- // determine the scale/offset for normalization
- float xoffs = bounds.x0;
- float yoffs = bounds.y0;
- float xscale = 1.0f / (bounds.x1 - bounds.x0);
- float yscale = 1.0f / (bounds.y1 - bounds.y0);
-
- // normalize all the component bounds
- for (component *curcomp = m_complist.first(); curcomp != NULL; curcomp = curcomp->next())
+ if (m_complist.first() != NULL)
{
- curcomp->m_bounds.x0 = (curcomp->m_bounds.x0 - xoffs) * xscale;
- curcomp->m_bounds.x1 = (curcomp->m_bounds.x1 - xoffs) * xscale;
- curcomp->m_bounds.y0 = (curcomp->m_bounds.y0 - yoffs) * yscale;
- curcomp->m_bounds.y1 = (curcomp->m_bounds.y1 - yoffs) * yscale;
+ // determine the scale/offset for normalization
+ float xoffs = bounds.x0;
+ float yoffs = bounds.y0;
+ float xscale = 1.0f / (bounds.x1 - bounds.x0);
+ float yscale = 1.0f / (bounds.y1 - bounds.y0);
+
+ // normalize all the component bounds
+ for (component *curcomp = m_complist.first(); curcomp != NULL; curcomp = curcomp->next())
+ {
+ curcomp->m_bounds.x0 = (curcomp->m_bounds.x0 - xoffs) * xscale;
+ curcomp->m_bounds.x1 = (curcomp->m_bounds.x1 - xoffs) * xscale;
+ curcomp->m_bounds.y0 = (curcomp->m_bounds.y0 - yoffs) * yscale;
+ curcomp->m_bounds.y1 = (curcomp->m_bounds.y1 - yoffs) * yscale;
+ }
}
// allocate an array of element textures for the states