-
Dmitry Kazakov authored
You know, one of the problems of KisToolFreeHand is that it emits many update signals and most of them overlap with each other. This causes some areas of the image to be recalculated several times... And here comes the optimizer. It filters overlapping areas from the update queue, so the merger has to do less work! In the beginning i wanted to use some comprehensive theoretical algorithms for Maximum Independent Set of Rectangles problem, but then i decided to implement a simple and naive algorithm instead... This version of optimizer is trivial, it just unites rectangles until the area of a new rectangle is less than ALPHA*(summed area of both initial rectangles), where ALPHA is an empirical coefficient. Technically, ALPHA shows how much _more_ work the merger will have to make after we unite two rectangles. So, from a theoretical point of view, the algorithm is stable, until ALPHA is less than 1. In theory... Yeah, theory is really good thing... but not in our case ;) I've set the coefficient to 2.5, and it started to work really fast! More than that, the accumulated work, made by the merger does not(!) grow much! Actual average calculated ALPHA is still below 1.06. Of course, the algorithm became "unstable", and in some rare cases it can update much more than was requested, but, i think, we can live with it. Well, are you still reading this stuff? ;) Then i'll tell you how to activate and test the new scheduler: 1) Check that you don't have KisProjectionCache backend activated - it is not reentrant. You need to (a)activate Image Pyramid or (b)turn on OpenGL. a) put in your kritarc: useMipmapping=true b) set a radio-button in a configuration menu 2) Uncomment line in krita/image/kis_image.cc to activate the scheduler: #define USE_UPDATE_SCHEDULER 3) Comment out line in krita/image/kis_updater_context.cc to unlock multithreading: /** * FIXME: Due to non-reentrancy of some krita code * we limit the number of threads by 1 */ // threadCount = 1; Now you can easily paint from under the blur adjustment layer and freely move shapes on shape layer! svn path=/trunk/koffice/; revision=1145287
21dd1021