From 01d331415a6db0728c0045d2f77649f73e20d097 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Thu, 2 Jun 2016 19:31:43 -0400 Subject: fix padding bugs, no padding anywhere now but at least its consistent --- python/examples/export-svg.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'python/examples') diff --git a/python/examples/export-svg.py b/python/examples/export-svg.py index 1e5e3ca0..3800edf7 100755 --- a/python/examples/export-svg.py +++ b/python/examples/export-svg.py @@ -34,8 +34,8 @@ def instruction_data_flow(function,address): def render_svg(function): graph = function.create_graph() graph.layout_and_wait() - heightconst = 17 - ratio = 0.44 + heightconst = 15 + ratio = 0.48 widthconst = heightconst*ratio output = ''' @@ -117,7 +117,7 @@ def render_svg(function): - '''.format(width=int(graph.width * widthconst + 0.5), height=graph.height * heightconst) + '''.format(width=graph.width*widthconst, height=graph.height*heightconst) output += ''' Function Graph 0 ''' @@ -125,10 +125,10 @@ def render_svg(function): for i,block in enumerate(graph.blocks): #Calculate basic block location and coordinates - x = int(block.x * widthconst + 0.5) - y = int((block.y) * heightconst) - width = int(block.width * widthconst + 0.5) - height = block.height * heightconst + x = ((block.x) * widthconst) + y = ((block.y) * heightconst) + width = ((block.width) * widthconst) + height = ((block.height) * heightconst) #Render block output += ' \n'.format(i=i) @@ -138,9 +138,9 @@ def render_svg(function): #Render instructions, unfortunately tspans don't allow copying/pasting more #than one line at a time, need SVG 1.2 textarea tags for that it looks like - output += ' \n'.format(x=x+3,y=y+5 + (i + 1) * (heightconst - 2)) + output += ' \n'.format(x=x,y=y + (i + 1) * heightconst) for i,line in enumerate(block.lines): - output += ' '.format(x=x+3,y=y + 5 + (i + 0.7) * (heightconst - 2),address=hex(line.address)[:-1]) + output += ' '.format(x=x,y=y + (i + 0.7) * heightconst,address=hex(line.address)[:-1]) hover = instruction_data_flow(function, line.address) output += '{hover}'.format(hover=hover) for token in line.tokens: -- cgit v1.3.1