[Qgis-developer] rendercontext-branch

Tom Elwertowski telwertowski at comcast.net
Thu May 1 03:26:02 EDT 2008


Marco Hugentobler wrote:
> Note that the render context branch is now in a stage where it can be tested.

I found two Mac rendering problems:

When QGIS first starts up, the screen is scrambled: the map canvas is drawn twice, the window title is inside the window and the toolbar icons are rendered inside (not floating over) the map canvas. This is caused by calling processEvents() from inside a paint event. I did not track down the call. Opening a file will unscramble the window. Including a file on the command line will prevent the initial scramble.

The second problem is caused by a non-zero feature rendering count. The bug is also present in trunk but I first noticed it now. When a window is resized, it will snap back to its original size after an incremental update. The window content remains at the new size but the window frame reverts back to the old size. This is caused by calling processEvents() in QgsVectorLayer::draw(). (WMS layers also have this bug due to calling processEvents() from QgsHttpTransaction::getSynchronously() from QgsWmsProvider::draw().)

Mac paint events must be serialized. If another paint event is pending when processEvents() is called, the newer one will start. When the call stack later unwinds, the earlier paint event resumes with a context that is no longer valid.

Long drawing operations are usually done in a thread so that the main thread can call processEvents() to listen for keyboard events such as a cancel key without interfering with the drawing process. Until we can move to a threaded design, we should disable the Mac resize control when incremental drawing is enabled or else conditionalize the incremental drawing code for non-Macs.

Tom


More information about the Qgis-developer mailing list