Commit 44bd5a73 authored by Gaëtan Renaudeau's avatar Gaëtan Renaudeau

fix syncContentData to be executed on ui thread

parent bcf99d5f
...@@ -22,6 +22,13 @@ ...@@ -22,6 +22,13 @@
<string>1</string> <string>1</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key> <key>UIRequiredDeviceCapabilities</key>
...@@ -31,18 +38,8 @@ ...@@ -31,18 +38,8 @@
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSAppTransportSecurity</key>
<dict>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/-->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict> </dict>
</plist> </plist>
...@@ -284,6 +284,7 @@ RCT_NOT_IMPLEMENTED(-init) ...@@ -284,6 +284,7 @@ RCT_NOT_IMPLEMENTED(-init)
- (void)syncContentData - (void)syncContentData
{ {
RCT_PROFILE_BEGIN_EVENT(0, @"GLCanvas syncContentData", nil);
NSMutableArray *contentData = [[NSMutableArray alloc] init]; NSMutableArray *contentData = [[NSMutableArray alloc] init];
int nb = [_nbContentTextures intValue]; int nb = [_nbContentTextures intValue];
for (int i = 0; i < nb; i++) { for (int i = 0; i < nb; i++) {
...@@ -300,6 +301,9 @@ RCT_NOT_IMPLEMENTED(-init) ...@@ -300,6 +301,9 @@ RCT_NOT_IMPLEMENTED(-init)
contentData[i] = imgData; contentData[i] = imgData;
} }
_contentData = contentData; _contentData = contentData;
_deferredRendering = true;
[self setNeedsDisplay];
RCT_PROFILE_END_EVENT(0, @"gl", nil);
} }
...@@ -346,12 +350,7 @@ RCT_NOT_IMPLEMENTED(-init) ...@@ -346,12 +350,7 @@ RCT_NOT_IMPLEMENTED(-init)
BOOL needsDeferredRendering = _nbContentTextures > 0 && !_autoRedraw; BOOL needsDeferredRendering = _nbContentTextures > 0 && !_autoRedraw;
if (needsDeferredRendering && !_deferredRendering) { if (needsDeferredRendering && !_deferredRendering) {
dispatch_async(dispatch_get_main_queue(), ^{ [self performSelectorOnMainThread:@selector(syncContentData) withObject:nil waitUntilDone:NO];
if (!weakSelf) return;
_deferredRendering = true;
[self syncContentData];
[weakSelf setNeedsDisplay];
});
} }
else { else {
RCT_PROFILE_BEGIN_EVENT(0, @"GLCanvas render", nil); RCT_PROFILE_BEGIN_EVENT(0, @"GLCanvas render", nil);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment