Spade-Editor / Spade

Cross-platform raster graphics editor inspired by Paint.NET
GNU General Public License v3.0
41 stars 10 forks source link

History.getUpdatedImage(), et al called far too often #62

Closed BurntPizza closed 10 years ago

BurntPizza commented 10 years ago

I've noticed this for a while now, but I'd thought I'd point it out: http://giant.gfycat.com/DecimalIncompleteBantamrooster.gif (ah, gfycat doesn't embed, shame) I think tool stroke previews should simply pile up in their own buffer, and not walk through the local history stack every frame, it's causing draw lag (low fps input polling), as demonstrated at the end of the gif where I cannot draw smooth circles.

I'll try to work this out before 1.0, but I'm pretty busy as of late. @HeroesGrave , do you have a date set for when you'd like to see 1.0 release?

HeroesGrave commented 10 years ago

I didn't realise they were affecting the history buffer.

Maybe there's a 'changed' value in there not getting reset.

_About 1.0 release: _ When it's ready. I could have had it out a week or so ago, but I wanted to have a proper solution for cleaning out the history (whether deleting it or storing it on disk). I'll just keep going and see what happens. At the moment it looks like deleting. (See issue #49)

BurntPizza commented 10 years ago

It's coming from History.java: 148 Canvas.java: 164 CanvasManager.java: 258

HeroesGrave commented 10 years ago

I got it.

BurntPizza commented 10 years ago

That's what I did, I thought it fixed it, but lag still happens sometimes, so its also somewhere else. Plus, even when it's working fine, if you do a big fill, the lag starts.

HeroesGrave commented 10 years ago

Yep. The fill tool could probably do with some optimisation, although I'm not sure what.

BurntPizza commented 10 years ago

I'm fairly decent at algorithms, so I'll try it, but not now, probably not going to be in 1.0

This isn't just the fill tool though, about half-to-80% of the time input is lagging right from app startup, before anything's been drawn.

Also your fix is causing a problem, try drawing a shape (line, rect, or ellipse). That has been happening after you make a selection for a while now too.

BurntPizza commented 10 years ago

Profiled, found out some things, look for yourself: Paint.JAVA profile

That's while vigorously drawing with the brush (and The Lag happening) What you don't see is that GUIManager.setFile() is being called rapidly, even at idle! So that's another issue

EDIT: culprit of setFile(): Application.java: 56

BurntPizza commented 10 years ago

Another profile, this time a full one, including std lib classes (again vigorously brushing): Full Pofile

Really not sure where SocketInputStreams come into this :\

BurntPizza commented 10 years ago

Fixed :D see latest pull request.