HaikuArchives / ArtPaint

ArtPaint is a painting and image processing program.
https://haikuarchives.github.io/ArtPaint/
29 stars 18 forks source link

Freehand: 1 pixel width pegs CPU (freezes the app) #653

Closed Pintaio closed 8 months ago

Pintaio commented 8 months ago

Hi

Since 2.7 update, Freehand line tool is not working anymore. If you open Artpaint and select it and try to paint, you get no results and Artpaint freezes. If you open Artpaint and select other tools, like Hairy brush or Straight line tool, it works without problems. But, when you select Freehand line tool, Artpaint freezes.

Greetings

humdingerb commented 8 months ago

Please remove the file "application" of the ArtPaint settings at /boot/home/config/settings/ArtPaint. It's some sort of buggered backward compatibility. Sorry for the inconvenience...

Pintaio commented 8 months ago

Thanks for te reply I've tried to remove that file, but it still doesn't work well. I've also tried to uninstall Artpaint and delete all its files and reinstall Artpaint again, but it still doesn't work.

humdingerb commented 8 months ago

I've tried to remove that file, but it still doesn't work well.

"doesn't work well" sounds like it doesn't freeze any more. :) Are you sure that the painted line with its default 1 pixel width just is too feint to see?

Pintaio commented 8 months ago

Are you sure that the painted line with its default 1 pixel width just is too feint to see?

I'm sure, but I've done more tests: Indeed it seems the problem is the pixel width: using Freehand line tool, it freezes if you choose 1 pixel width, but if you choose widths greater than 1 pixel, it works ok.

humdingerb commented 8 months ago

Reproducible! So we do make a bit of progress. :) I'll edit the ticket's title to reflect what we found out.

When checking a debug build, it appears that the pegging CPU is looping forever in https://github.com/HaikuArchives/ArtPaint/blob/master/artpaint/Utilities/BitmapUtilities.cpp#L387

ArtPaint_debug-36513-debug-30-01-2024-18-16-29.report.txt

Unfortunately, that's as far as I get, as my coding skills are weak... Maybe @korli has an idea? :)

humdingerb commented 8 months ago

Seems to be a reproducible way of what's described in #643.

korli commented 8 months ago

@humdingerb if this is a regression since 2.7, you could try to revert the part in BitmapUtilities.cpp: https://github.com/HaikuArchives/ArtPaint/commit/aec396d373fb3cf094444d506302ab71606c64d1

humdingerb commented 8 months ago

That does indeed fix the issue! Thanks a bunch!! I smell a v2.7.1 in the air...