美文网首页
ios GPUImage报错 [view bounds]

ios GPUImage报错 [view bounds]

作者: 今年27 | 来源:发表于2018-01-17 10:16 被阅读23次

这个是ios11 之后有关访问UI的属性的方法都不能在支线程中访问, 改一下就可以了

- (void)recalculateViewGeometry;

{

    dispatch_async(dispatch_get_main_queue(), ^{

        CGSize currentViewSize = self.bounds.size;

        runSynchronouslyOnVideoProcessingQueue(^{

            CGFloat heightScaling, widthScaling;

            //    CGFloat imageAspectRatio = inputImageSize.width / inputImageSize.height;

            //    CGFloat viewAspectRatio = currentViewSize.width / currentViewSize.height;

            CGRect insetRect = AVMakeRectWithAspectRatioInsideRect(inputImageSize, self.bounds);

            switch(_fillMode)

            {

                case kGPUImageFillModeStretch:

                {

                    widthScaling = 1.0;

                    heightScaling = 1.0;

                }; break;

                case kGPUImageFillModePreserveAspectRatio:

                {

                    widthScaling = insetRect.size.width / currentViewSize.width;

                    heightScaling = insetRect.size.height / currentViewSize.height;

                }; break;

                case kGPUImageFillModePreserveAspectRatioAndFill:

                {

                    //            CGFloat widthHolder = insetRect.size.width / currentViewSize.width;

                    widthScaling = currentViewSize.height / insetRect.size.height;

                    heightScaling = currentViewSize.width / insetRect.size.width;

                }; break;

            }

            imageVertices[0] = -widthScaling;

            imageVertices[1] = -heightScaling;

            imageVertices[2] = widthScaling;

            imageVertices[3] = -heightScaling;

            imageVertices[4] = -widthScaling;

            imageVertices[5] = heightScaling;

            imageVertices[6] = widthScaling;

            imageVertices[7] = heightScaling;

        });

    });

//    static const GLfloat imageVertices[] = {

//        -1.0f, -1.0f,

//        1.0f, -1.0f,

//        -1.0f,  1.0f,

//        1.0f,  1.0f,

//    };

}

相关文章

  • ios GPUImage报错 [view bounds]

    这个是ios11 之后有关访问UI的属性的方法都不能在支线程中访问, 改一下就可以了 - (void)recalc...

  • iOS纪录

    (1)View的Frame与Bounds区别 摘自 ios view的frame和bounds之区别(位置和大小)...

  • UIView的常用方法

    NSString *bounds = NSStringFromCGRect( view1.bounds);//求出...

  • iOS中View的位置和大小

    frame bounds center frame bounds center是View的属性,定义了View的位...

  • GPUImage -[UIView bounds]

    一、问题 GPUImage第一次渲染的时候卡顿。日志:Main Thread Checker: UI API ca...

  • 【技巧】View的Frame与Bounds区别

    摘自 ios view的frame和bounds之区别(位置和大小) 事例代码 下图说明一切~

  • frame与bounds区别

    iOS中View有两个属性,frame与bounds,在网上看到最多的解释是frame是相对于父view的,bou...

  • 截屏

    UIGraphicsBeginImageContextWithOptions(view.bounds.size, ...

  • iOS frame 和 bounds 的关系

    修改bounds 会影响子view的坐标原点位置,比如父view的bounds为(-20,-20)则在它上面添加的...

  • iOS动画总结

    View AnimationsAnimatable propertiesframe bounds transfor...

网友评论

      本文标题:ios GPUImage报错 [view bounds]

      本文链接:https://www.haomeiwen.com/subject/ozuyoxtx.html