Commit fbdd1134 authored by Gaëtan Renaudeau's avatar Gaëtan Renaudeau

Merge branch 'master' into 2.18.0

parents 1cfec472 d5c628c9
...@@ -27,25 +27,25 @@ npm i --save gl-react-native ...@@ -27,25 +27,25 @@ npm i --save gl-react-native
**on Android:** **on Android:**
1. `android/settings.gradle`:: Add the following snippet 1. `android/settings.gradle`:: Add the following snippet
```gradle ```gradle
include ':RNGL' include ':RNGL'
project(':RNGL').projectDir = file('../node_modules/gl-react-native/android') project(':RNGL').projectDir = file('../node_modules/gl-react-native/android')
``` ```
1. `android/app/build.gradle`: Add in dependencies block. 1. `android/app/build.gradle`: Add in dependencies block.
```gradle ```gradle
compile project(':RNGL') compile project(':RNGL')
``` ```
1. in your `MainActivity` (or equivalent): 1. in your `MainActivity` (or equivalent):
```java ```java
import com.projectseptember.RNGL.RNGLPackage; import com.projectseptember.RNGL.RNGLPackage;
... ...
mReactInstanceManager = ReactInstanceManager.builder() mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication()) .setApplication(getApplication())
... ...
.addPackage(new MainReactPackage()) .addPackage(new MainReactPackage())
.addPackage(new RNGLPackage()) .addPackage(new RNGLPackage())
... ...
.build(); .build();
``` ```
...@@ -61,7 +61,7 @@ NSArray* diff (NSArray* a, NSArray* b) { ...@@ -61,7 +61,7 @@ NSArray* diff (NSArray* a, NSArray* b) {
NSTimer *animationTimer; NSTimer *animationTimer;
BOOL _needSync; BOOL _needSync;
NSMutableArray *_captureConfigs; NSMutableArray *_captureConfigs;
BOOL _captureScheduled; BOOL _captureScheduled;
} }
...@@ -341,7 +341,6 @@ RCT_NOT_IMPLEMENTED(-init) ...@@ -341,7 +341,6 @@ RCT_NOT_IMPLEMENTED(-init)
if (imgData) contentData[i] = imgData; if (imgData) contentData[i] = imgData;
} }
_contentData = contentData; _contentData = contentData;
_deferredRendering = false;
[self setNeedsDisplay]; [self setNeedsDisplay];
RCT_PROFILE_END_EVENT(0, @"gl", nil); RCT_PROFILE_END_EVENT(0, @"gl", nil);
} }
...@@ -406,14 +405,13 @@ RCT_NOT_IMPLEMENTED(-init) ...@@ -406,14 +405,13 @@ RCT_NOT_IMPLEMENTED(-init)
return; return;
} }
bool willRender = !_deferredRendering; BOOL needsDeferredRendering = [_nbContentTextures intValue] > 0 && !_autoRedraw;
if (needsDeferredRendering && !_deferredRendering) {
if ([_nbContentTextures intValue] > 0 && !_autoRedraw) {
_deferredRendering = true; _deferredRendering = true;
[self performSelectorOnMainThread:@selector(syncContentData) withObject:nil waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(syncContentData) withObject:nil waitUntilDone:NO];
} }
else {
if (willRender) { _deferredRendering = false;
[self render]; [self render];
if (!_captureScheduled && [_captureConfigs count] > 0) { if (!_captureScheduled && [_captureConfigs count] > 0) {
_captureScheduled = true; _captureScheduled = true;
...@@ -426,24 +424,24 @@ RCT_NOT_IMPLEMENTED(-init) ...@@ -426,24 +424,24 @@ RCT_NOT_IMPLEMENTED(-init)
{ {
_captureScheduled = false; _captureScheduled = false;
if (!self.onGLCaptureFrame) return; if (!self.onGLCaptureFrame) return;
UIImage *frameImage = [self snapshot]; UIImage *frameImage = [self snapshot];
for (CaptureConfig *config in _captureConfigs) { for (CaptureConfig *config in _captureConfigs) {
id result; id result;
id error; id error;
BOOL isPng = [config.type isEqualToString:@"png"]; BOOL isPng = [config.type isEqualToString:@"png"];
BOOL isJpeg = !isPng && ([config.type isEqualToString:@"jpeg"] || [config.type isEqualToString:@"jpg"]); BOOL isJpeg = !isPng && ([config.type isEqualToString:@"jpeg"] || [config.type isEqualToString:@"jpg"]);
BOOL isBase64 = [config.format isEqualToString:@"base64"]; BOOL isBase64 = [config.format isEqualToString:@"base64"];
BOOL isFile = !isBase64 && [config.format isEqualToString:@"file"]; BOOL isFile = !isBase64 && [config.format isEqualToString:@"file"];
NSData *frameData = NSData *frameData =
isPng ? UIImagePNGRepresentation(frameImage) : isPng ? UIImagePNGRepresentation(frameImage) :
isJpeg ? UIImageJPEGRepresentation(frameImage, [config.quality floatValue]) : isJpeg ? UIImageJPEGRepresentation(frameImage, [config.quality floatValue]) :
nil; nil;
if (!frameData) { if (!frameData) {
error = [NSString stringWithFormat:@"Unsupported capture type '%@'", config.type]; error = [NSString stringWithFormat:@"Unsupported capture type '%@'", config.type];
} }
...@@ -463,14 +461,14 @@ RCT_NOT_IMPLEMENTED(-init) ...@@ -463,14 +461,14 @@ RCT_NOT_IMPLEMENTED(-init)
else { else {
error = [NSString stringWithFormat:@"Unsupported capture format '%@'", config.format]; error = [NSString stringWithFormat:@"Unsupported capture format '%@'", config.format];
} }
NSMutableDictionary *response = [[NSMutableDictionary alloc] init]; NSMutableDictionary *response = [[NSMutableDictionary alloc] init];
response[@"config"] = [config dictionary]; response[@"config"] = [config dictionary];
if (error) response[@"error"] = error; if (error) response[@"error"] = error;
if (result) response[@"result"] = result; if (result) response[@"result"] = result;
self.onGLCaptureFrame(response); self.onGLCaptureFrame(response);
} }
_captureConfigs = [[NSMutableArray alloc] init]; _captureConfigs = [[NSMutableArray alloc] init];
} }
......
{ {
"name": "gl-react-native", "name": "gl-react-native",
"version": "2.17.5", "version": "2.17.8",
"description": "OpenGL bindings for react-native to implement complex effects over images and components, in the descriptive VDOM paradigm", "description": "OpenGL bindings for react-native to implement complex effects over images and components, in the descriptive VDOM paradigm",
"repository": { "repository": {
"type": "git", "type": "git",
......
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