SwiftyDraw icon indicating copy to clipboard operation
SwiftyDraw copied to clipboard

FPS Drop

Open multybuq opened this issue 5 years ago • 6 comments

Hello! I faced FPS drop on the draw() method, if a lot of lines will be in the drawing bounds. Any ideas about it?

multybuq avatar Nov 06 '18 14:11 multybuq

Hi @multybuq I have already seen the issue you're talking about. I'm currently not sure how to resolve the issue. I believe it occurs because we're redrawing all lines in draw(_:). Maybe we can introduce a property to Line that determines whether this line needs to be drawn again...

I'll let you know about updates.

LinusGeffarth avatar Nov 06 '18 14:11 LinusGeffarth

@LinusGeffarth, thanks for fast reply.

BTW, I tried this possibility, this way it will wipe out all the lines inside the overdrawing rect. Overdrawing view's bound is taking even more resources.

The possible solution I see, is to render all the lines to an image at the touchesEnded() function and place it below the view. But this will break erase function.

The other possible solution I see, is to render all the lines to an image and render part of this image equal to rect parameter of draw() function. I didn't achieve this yet, I will update you, if succeeded.

multybuq avatar Nov 06 '18 14:11 multybuq

Hmmm I'm sure we'll find a way. I appreciate your support & efforts!

LinusGeffarth avatar Nov 06 '18 14:11 LinusGeffarth

Are those FPS drops only on the iOS Simulator or on a real iPad as well?

lucashoeft avatar Apr 09 '19 16:04 lucashoeft

Real device. I haven't tested on the Simulator actually @lucashoeft

LinusGeffarth avatar Apr 09 '19 16:04 LinusGeffarth

Hey there friends - I am using SwiftyDraw (really cool) in an iOS app and am seeing this issue still - was there ever a solution to this issue? On my app, if there are complex lines, I can draw others, but it takes forever before I can actually start to draw.

EDIT: The version I am using is older / severely modified from what I think the original is - I am not sure this is still an issue.

Pete

dulanyconsulting avatar Nov 15 '20 03:11 dulanyconsulting