Skip to content

Commit 2dc2938

Browse files
Merge pull request livecode#5880 from runrevmark/bugfix-9992
[[ Bug 9992 ]] Improve export/import snapshot from screen on iOS7+
2 parents 82a10bd + 018905d commit 2dc2938

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

docs/notes/bugfix-9992.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Improve export/import snapshot from screen on iOS
2+
3+
The from screen form of export/import snapshot has been changed
4+
to use a different API on iOS7+, which allows a greater variety
5+
of native layers to be captured.

engine/src/mbliphonedc.mm

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,19 @@ static void MCScreenDCDoSnapshot(void *p_env)
617617
-[window bounds].size.height * [[window layer] anchorPoint].y);
618618

619619
// Render the layer hierarchy to the current context
620-
[[window layer] renderInContext:t_img_context];
621-
620+
if ([window respondsToSelector: @selector(drawViewHierarchyInRect:afterScreenUpdates:)])
621+
{
622+
// This method is supported in iOS7+ and will capture many
623+
// native view's content.
624+
UIGraphicsPushContext(t_img_context);
625+
[window drawViewHierarchyInRect:[window bounds] afterScreenUpdates:YES];
626+
UIGraphicsPopContext();
627+
}
628+
else
629+
{
630+
[[window layer] renderInContext:t_img_context];
631+
}
632+
622633
// Restore the context
623634
CGContextRestoreGState(t_img_context);
624635
}

0 commit comments

Comments
 (0)