Skip to content

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

@Gocy015

Description

@Gocy015

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 !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions