Hi, All!<br><br>I&#39;ve been working on the system which will merge layers, taking into account all the needRects and changeRects. And here is the first (well, second =) ) preliminary result for you consideration.<br><br>
WARNING: this patchset does not replaces current merge mechanism yet! More than that IT BREAKS THE ONE! <br>At the moment walkers are working inside isolated tests only, not in Krita itself.<br><br>(i won&#39;t be able to code for 4-5 days due to exam so i decided to publish it unfinished and listen to some opinions :) )<br clear="all">
<br><br>Ok, what is done:<br>KisGraphWalker and KisMergeWalker - are classes for performing a loop through all the layers and collecting all the needed information for merge. <br>The most important information is stored in KisMergeWalker::m_mergeTask. It consists of a structures describing a layer and a rect we need from it. This structure stores the position of the layer inside a stack as well. The positions can be:<br>
N_NORMAL - the layer is filthy or lays above filthy node<br>N_LOWER - the leyer lays below filthy node<br>  N_TOPMOST - the highest layer of the group layer&#39;s childs<br>N_BOTTOMMOST - the lowest layer of the group layer&#39;s childs<br>
<br>These two classes are splitted by the task they do: KisGraphWalker just iterates through nodes while KisMergeWalker does actual work - it collects rects.<br><br>After execution of KisMergeWalker::collectRects the walker will have all needed information for a merge. This information will be given to KisAsyncMerger.<br>
The Merger will iterate reversely through the stack and merge the image.<br><br><br>How to test this:<br>There are two unit-tests written. One for walkers and another one for  merger.<br>You can see them here:<br>krita/image/tests/kis_graph_walker_test.cpp<br>
krita/image/tests/kis_async_merger_test.cpp<br><br><br>The thing i&#39;m most unsure is naming of the classes.<br><br>If you have any ideas or comments - you are welcome! <br><br>-- <br>Dmitry Kazakov<br>