use nearest neighbour interpolation if scale is integer

This commit is contained in:
Jesús A. Álvarez 2017-11-30 20:34:59 +01:00
parent 6d5d57787b
commit 97ab910a84

View File

@ -56,6 +56,10 @@ static ScreenView *sharedScreenView = nil;
screenBounds.origin.x = (viewBounds.size.width - screenBounds.size.width)/2;
screenBounds = CGRectIntegral(screenBounds);
videoLayer.frame = screenBounds;
BOOL scaleIsIntegral = (floor(screenScale) == screenScale);
NSString *screenFilter = scaleIsIntegral ? kCAFilterNearest : [[NSUserDefaults standardUserDefaults] stringForKey:@"screenFilter"];
videoLayer.magnificationFilter = screenFilter;
videoLayer.minificationFilter = screenFilter;
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {