Skip to content

Commit

Permalink
Merge pull request #125 from jbinney/master
Browse files Browse the repository at this point in the history
[visualize] User-friendly error message for widthless/heightless layers
  • Loading branch information
arigrant committed Nov 1, 2015
2 parents 589c527 + 4aa9cdf commit 0d2f24d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion commands/FBVisualizationCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,15 @@ def _showColor(color):

def _showLayer(layer):
layer = '(' + layer + ')'
size = '((CGRect)[(id)' + layer + ' bounds]).size'

lldb.debugger.HandleCommand('expr (void)UIGraphicsBeginImageContextWithOptions(((CGRect)[(id)' + layer + ' bounds]).size, NO, 0.0)')
width = float(fb.evaluateExpression(size + '.width'))
height = float(fb.evaluateExpression(size + '.height'))
if width == 0.0 or height == 0.0:
print 'Nothing to see here - the size of this element is {} x {}.'.format(width, height)
return

lldb.debugger.HandleCommand('expr (void)UIGraphicsBeginImageContextWithOptions(' + size + ', NO, 0.0)')
lldb.debugger.HandleCommand('expr (void)[(id)' + layer + ' renderInContext:(void *)UIGraphicsGetCurrentContext()]')

frame = lldb.debugger.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
Expand Down

0 comments on commit 0d2f24d

Please sign in to comment.