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

Issue #686 - Memory leak on toNativeImage #748

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vBoykoGit
Copy link

No description provided.

Copy link

@akhrameev-picsart akhrameev-picsart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@VineFiner
Copy link

Hello, can you add a scale?

    func toNativeImage(size: Size, _ scale: CGFloat = UIScreen.main.scale, layout: ContentLayout = .of()) -> MImage {
        let renderer = RenderUtils.createNodeRenderer(self, view: nil)
        let rect = size.rect()

        MGraphicsBeginImageContextWithOptions(size.toCG(), false, scale)
        let ctx = MGraphicsGetCurrentContext()!
        ctx.clear(rect.toCG())

        let transform = LayoutHelper.calcTransform(self, layout, size)
        ctx.concatenate(transform.toCG())
        renderer.render(in: ctx, force: false, opacity: self.opacity)

        let img = MGraphicsGetImageFromCurrentImageContext()
        MGraphicsEndImageContext()
        return img!
    }

@hotbott hotbott mentioned this pull request Dec 2, 2021
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

Successfully merging this pull request may close these issues.

None yet

3 participants