Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- (UIImage *)snapshotOfUnderlyingView getting the wrong blurLayer. #137

Open
Gocy015 opened this issue Jan 5, 2017 · 2 comments
Open

- (UIImage *)snapshotOfUnderlyingView getting the wrong blurLayer. #137

Gocy015 opened this issue Jan 5, 2017 · 2 comments

Comments

@Gocy015
Copy link

Gocy015 commented Jan 5, 2017

Hi , I am currently using FXBlurView , i've notice a place where there could be a bug:

in FXBlurView.m , in - (UIImage *)snapshotOfUnderlyingView

- (UIImage *)snapshotOfUnderlyingView
{
    __strong FXBlurLayer *blurLayer = [self blurPresentationLayer];
    __strong CALayer *underlyingLayer = [self underlyingLayer];
    CGRect bounds = [blurLayer convertRect:blurLayer.bounds toLayer:underlyingLayer];

    self.lastUpdate = [NSDate date];
    CGFloat scale = 0.5;
    if (self.iterations)
    {
        CGFloat blockSize = 12.0/self.iterations;
        scale = blockSize/MAX(blockSize * 2, blurLayer.blurRadius);
        scale = 1.0/floor(1.0/scale);
    }
    CGSize size = bounds.size;
...
}

In this method , the blurLayer could be self.layer or self.layer.presentationLayer , however , the underlyingLayer will always be self.underlyingView.layer , the issue i'm having is that , when blurLayer is equal to self.layer.presentationLayer ,the bounds here is not correct, and since you access the blurRadius from self.layer , i assume that the first line of this method should be :

    __strong FXBlurLayer *blurLayer = [self blurLayer];

Or am i understanding this wrong ? Any help would be appreciated !

@FlorianBasso
Copy link

FlorianBasso commented Jan 17, 2017

I had a huge bug with the blur effect and thanks to you @Gocy015 it is fixed !
Thanks !!

@Gocy015
Copy link
Author

Gocy015 commented Jan 18, 2017

@FlorianBasso , glad i can help !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants