Commit 107e6aaf authored by Gaëtan Renaudeau's avatar Gaëtan Renaudeau

Improve perfs of autoRedraw

parent fd28f9e3
...@@ -111,11 +111,13 @@ RCT_NOT_IMPLEMENTED(-init) ...@@ -111,11 +111,13 @@ RCT_NOT_IMPLEMENTED(-init)
- (void)setAutoRedraw:(BOOL)autoRedraw - (void)setAutoRedraw:(BOOL)autoRedraw
{ {
_autoRedraw = autoRedraw;
if (autoRedraw) { if (autoRedraw) {
if (!animationTimer) if (!animationTimer)
animationTimer =
[NSTimer scheduledTimerWithTimeInterval:1.0/60.0 [NSTimer scheduledTimerWithTimeInterval:1.0/60.0
target:self target:self
selector:@selector(setNeedsDisplay) selector:@selector(autoRedrawUpdate)
userInfo:nil userInfo:nil
repeats:YES]; repeats:YES];
} }
...@@ -332,10 +334,21 @@ RCT_NOT_IMPLEMENTED(-init) ...@@ -332,10 +334,21 @@ RCT_NOT_IMPLEMENTED(-init)
//// Draw //// Draw
- (void) autoRedrawUpdate
{
if ([self haveRemainingToPreload]) {
return;
}
if ([_nbContentTextures intValue] > 0) {
[self syncContentData];
}
[self setNeedsDisplay];
}
- (void)drawRect:(CGRect)rect - (void)drawRect:(CGRect)rect
{ {
self.layer.opaque = _opaque; self.layer.opaque = _opaque;
if (_neverRendered) { if (_neverRendered) {
_neverRendered = false; _neverRendered = false;
glClearColor(0.0, 0.0, 0.0, 0.0); glClearColor(0.0, 0.0, 0.0, 0.0);
...@@ -352,7 +365,7 @@ RCT_NOT_IMPLEMENTED(-init) ...@@ -352,7 +365,7 @@ RCT_NOT_IMPLEMENTED(-init)
bool willRender = !_deferredRendering; bool willRender = !_deferredRendering;
if ([_nbContentTextures intValue] > 0) { 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];
} }
......
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