On Wednesday 14 Dec 2005 21:35, Chris Cannam wrote: > What I think is happening is simply that the paint event for the > segment (which is wide and short) is being coalesced with the paint > event for the pointer move (which is tall and thin) and the resulting > rectangle union covers most of the window. So all of that gets > repainted.
OK, that was I think happening, but it's not the fundamental problem. Even separating out the calls (I tried the WPaintClever flag, which was the one I was trying to remember, and then I tried calling repaintContents instead of updateContents for the rectangle refreshes in setPointerPos) didn't actually help. The whole window was still repainted. The reason for this is actually pretty simple. A segment has changed, so we've set m_segmentsDrawBufferNeedsRefresh. And because that flag is set, checkScrollAndRefreshDrawBuffer decides it needs to refresh the whole buffer. It may not actually recreate the whole set of cached data, but it does do the re-blit from buffers. Why? Because we don't know, by the time we get to checkScrollAndRefreshDrawBuffer, which area of the canvas had changed. We may have worked it out in the original function that responded to the segment change, but we no longer have the information. That function used the same numbers as the arguments to updateContents, and so they were passed in to viewportPaintEvent, but that's effectively just coincidence by the time we reach checkScrollAndRefreshDrawBuffer; a similar area exposed by raising the window would have come through looking exactly the same. The problem (which I've mentioned before) is conflating "the area that changed" with "the area that needs to be refreshed". The two are not the same. If we have a buffer, we need to re-generate the former -- the parts of the buffer that have changed -- and then paint to the screen the latter -- the area that needs refreshed. The area covered by the Qt paint event is the latter; when repainting into the buffer, it isn't safe to assume that this is the full extent of the area that's actually changed. We'd need to record that separately, for example by replacing m_segmentsDrawBufferNeedsRefresh with a QRect describing which area of the buffer needs to be refreshed. I do rather fear that, though. It's a very simple change, but one that could make a lot of detail work. I'd like to think it over a bit before I'm sure I'd want to recommend it, as I may have made a mistake somewhere. Chris ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ Rosegarden-devel mailing list Rosegarden-devel@lists.sourceforge.net - use the link below to unsubscribe https://lists.sourceforge.net/lists/listinfo/rosegarden-devel