Merge pull request #3280 from biscuitehh/bugfix/fix-promotion-display-issues

Fix ProMotion display issues
This commit is contained in:
Kinarobin 2021-10-07 14:56:33 +08:00 committed by GitHub
commit 8c0753c4a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -89,7 +89,12 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
#elif SD_IOS || SD_TV #elif SD_IOS || SD_TV
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations" #pragma clang diagnostic ignored "-Wdeprecated-declarations"
NSTimeInterval duration = self.displayLink.duration * self.displayLink.frameInterval; NSTimeInterval duration = 0;
if (@available(iOS 10.0, *)) {
duration = self.displayLink.targetTimestamp - CACurrentMediaTime();
} else {
duration = self.displayLink.duration * self.displayLink.frameInterval;
}
#pragma clang diagnostic pop #pragma clang diagnostic pop
#else #else
NSTimeInterval duration = 0; NSTimeInterval duration = 0;
@ -98,7 +103,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
duration = nextFireDate - self.currentFireDate; duration = nextFireDate - self.currentFireDate;
} }
#endif #endif
if (duration == 0) { if (duration <= 0) {
duration = kSDDisplayLinkInterval; duration = kSDDisplayLinkInterval;
} }
return duration; return duration;