[QGIS-trac] Re: [Quantum GIS] #1171: Layers disappear and require restart after first time selection of anti-aliased rendering

Quantum GIS qgis at qgis.org
Sat Sep 13 14:11:05 EDT 2008


#1171: Layers disappear and require restart after first time selection of anti-
aliased rendering
----------------------------------------------------+-----------------------
        Reporter:  springmeyer                      |         Owner:  nobody       
            Type:  patch                            |        Status:  new          
        Priority:  minor: annoyance or enhancement  |     Milestone:  Version 1.0.0
       Component:  MapCanvas                        |       Version:  0.11.0       
      Resolution:                                   |      Keywords:               
Platform_version:                                   |      Platform:  All          
        Must_fix:  No                               |   Status_info:  0            
----------------------------------------------------+-----------------------
Changes (by smizuno):

  * platform:  OS X => All
  * type:  bug => patch

Comment:

 This problem occurs with Windows and Linux, too. The map will be drawn if
 the QGIS window is resized.

 I also found that if using QImage, when Render is off and the QGIS window
 is subsequently resized, the map is drawn at the previous canvas size once
 Render is enabled.

 Have found two problems in the code:

 1. in QgsMapCanvasMap that on resize the mPixmap size is used to build
 mImage in render(); then the mImage is used in a paint() call, which
 creates mPixmap from mImage. Depending on time lag (long when Render is
 off) the mPixmap may be created from the mImage at the previous size or
 having no value (if first use). This is used the next time the map is
 rendered, resulting in the map being rendered at the previous size (or
 blank) even though the map canvas window is a different size.

 2. when switching between QImage and QPixmap rendering the map canvas
 should be rendered.

 The patch I have provided creates mImage in the resize() function of
 QgsMapCanvasMap rather than in render(), so it is available whenever it is
 needed (most of time since it is the default).

 And in QgsMapCanvas::useImageToRender() refresh() is called after calling
 mMap->useImageToRender(). It seems better to do this at a higher so other
 factors control whether rendering takes place. Note that this may cause a
 black canvas or a previously rendered map to show if Render is off and
 there is a switch from QPixmap to QImage rendering.

-- 
Ticket URL: <http://trac.osgeo.org/qgis/ticket/1171#comment:1>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats


More information about the QGIS-trac mailing list