On Tuesday 20 Dec 2005 00:28, Guillaume Laurent wrote: > On Tuesday 20 December 2005 00:32, Chris Cannam wrote: > > > QPaintEvent also carries a QRegion, which is an array of QRects. > > > That's probably what we're looking for. > > > > That does sound promising, yes. > > Change is in, the traces seem to confirm it does what we want.
Not quite. We have another problem now -- pointer trails when moving the pointer leftwards. As soon as it moves by a step larger than the magic m_pointerPen.width() * 2, it leaves a ghost behind it. The reason for this is simple enough, and this time it _does_ involve the artifacts buffer. When we move the pointer further than that amount, we fire off two update calls -- one to erase the old pointer and one to draw the new one. These arrive in a single viewportPaintEvent, as separate rectangles in the region, and thus go through as two separate calls to viewportPaintRect. We also set m_artifactsDrawBufferNeedsRefresh so as to know we have to redraw. If we're moving right, the rectangle to clear the old pointer position is sorted first in the region, so that bit is refreshed from the segment buffer and m_artifactsDrawBufferNeedsRefresh is then reset. Then, the second rectangle is handled, the new pointer is drawn in and everything is OK. If we're moving left, the rectangle to draw the new pointer position is sorted first. So the new pointer is drawn, and m_artifactsDrawBufferNeedsRefresh is reset. And that's the problem -- when the next rectangle (to clear the old pointer) arrives, we think we've already handled the update, and so we now do nothing, just blit straight from the artifacts buffer with the old pointer still on it. Many possible fixes for this, of various strengths: -- Always refresh the exposed region of the artifacts buffer from the segment buffer when m_artifactsDrawBufferNeedsRefresh is set. Probably not too much of a hardship in terms of CPU cost, unless I'm forgetting something. We still wouldn't be copying the entire buffer (which we'd established was a bad idea). -- Introduce an artifacts buffer refresh rectangle just like the segment buffer refresh rectangle. That way we'd be sure to refresh enough the first time. -- Only set m_artifactsDrawBufferNeedsRefresh false on exit from the entire viewportPaintEvent call, not every refreshArtifactsDrawBuffer subcall. and probably some others. The first of these is logically sufficient (I think) but not perfectly efficient. The second should be sufficient and efficient. The third is probably not technically sufficient but we would get away with it in practice, it's easiest to code and understand the point of, and is probably the most efficient. I've tested the first and third and I can't see any difference in practice. I'm about to commit the third, because I like the small amount of simple code and I'm lazy that way. I don't think we should attempt the second (it'll probably break something). 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 [email protected] - use the link below to unsubscribe https://lists.sourceforge.net/lists/listinfo/rosegarden-devel
