On Tuesday 08 Nov 2005 11:00, Chris Cannam wrote: > On Tuesday 08 Nov 2005 10:49, Guillaume Laurent wrote: > > No need to, there's obviously something wrong with the logic in > > CompositionView::refreshArtifactsDrawBuffer() > > No, it's not in there -- if I comment out both calls to that function from > viewportPaintEvent and then blit directly from the segment draw buffer, I > get exactly the same results (except that obviously the artifacts are > invisible).
Well, to follow on from our IM chat just now, here's the proximate cause. The problems basically arise (at least in the case I've been looking at) when you scroll the canvas at the same time as causing something else to be refreshed, for example if you drag a selection rectangle off the edge. What happens is that you get two paint events, one for the scrolled bit and one for the rectangle. For the scroll one (let's assume it arrives first), the refresh flag will be true, the exposed area only will be refreshed in the cache, and then it will be copied to the widget (I'm ignoring the artifacts buffer for the moment as the behaviour is the same with or without that enabled). The remaining (unexposed) region of the widget will be scrolled automatically by the scroll view. Then for the rectangle itself, another paint event arrives but this time the refresh flag is false because the previous paint already carried out a refresh. So, the exposed area is copied directly from the cache and refreshSegmentsDrawBuffer is never called, resulting in the wrong thing being drawn because this area of the cache has never been refreshed since the scroll position changed. The fundamental problem is that our cache "status" information (the refresh flag) doesn't reflect the actual status of the cache. After our first refresh above, the cache is still mostly invalid because only the area exposed by the scroll has been redrawn -- not the main scrolled area -- but the refresh-needed flag is nonetheless set false because "a refresh" has happened. For the second refresh, we copy directly from the now invalid cache because we no longer know any better. I think either our cache status needs to be more sophisticated (rectangles known to be available -- ugh) or our cache needs to be completely maintained up to date when something changes, and never left in this partly-updated state. Chris ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ Rosegarden-devel mailing list [email protected] - use the link below to unsubscribe https://lists.sourceforge.net/lists/listinfo/rosegarden-devel
