#1171 closed patch (fixed)
Layers disappear and require restart after first time selection of anti-aliased rendering
Reported by: | springmeyer | Owned by: | nobody |
---|---|---|---|
Priority: | major: does not work as expected | Milestone: | |
Component: | MapCanvas | Version: | Trunk |
Keywords: | Cc: | ||
Must Fix for Release: | Yes | Platform: | All |
Platform Version: | Awaiting user input: | no |
Description
On Mac OS X When viewing a postgis layer when first running the new metis build I changed the preferences setting to check "Make lines appear less jagged...". This immediately made the loaded layer dissapear and loading new layers and zooming to any of the layers did nothing to restore the rendered data.
A restart of the app fixed the problem and the problem does not occur when I uncheck the same setting, restart then check the settings. So their must be some subtle bug in the defaults and how the application if affected when first choosing that setting.
Attachments (1)
Change History (8)
comment:1 by , 16 years ago
Platform: | OS X → All |
---|---|
Type: | bug → patch |
by , 16 years ago
Attachment: | patch_for_1171.txt added |
---|
fix for blank map after choosing anti-alias (QImage) rendering
follow-up: 3 comment:2 by , 15 years ago
Milestone: | Version 1.0.0 → Version 1.0.1 |
---|
Is this patch still needed? I don't observe the blank map after changing the rendering type (on Linux). Calling refresh after switch from QPixmap to QImage is a good idea.
For the moment, I'm assigning this to 1.0.1 as the patch affects a critical part of the rendering system. It seems to risky to me to apply this a few days before release.
Marco
comment:3 by , 15 years ago
Milestone: | Version 1.0.1 → Version 1.0.0 |
---|---|
Must Fix for Release: | No → Yes |
Priority: | minor: annoyance or enhancement → major: does not work as expected |
Version: | 0.11.0 → HEAD |
Replying to mhugent:
Is this patch still needed? I don't observe the blank map after changing the rendering type (on Linux).
It still takes place, but only one-way:
- start QGIS
- set "Fix..." in Options>Rendering
- quit QGIS
- start QGIS
- load a Shapefile - it is rendered OK
- un-set "Fix..." in Options>Rendering - mapcanvas goes blank
comment:4 by , 15 years ago
Milestone: | Version 1.0.0 → Version 1.0.1 |
---|
Hm, it works for me also in the direction you described. Don't know what it may depend on. Perhaps the Qt version? Anyway, I'm pushing it to 1.0.1 milestone because the patch affects a critical part of the rendering system. It seems to risky to me to apply this a few days before release.
comment:5 by , 15 years ago
This is a very subtle issue - the problem originally described occurs once after start up. However, resizing the map canvas causes the map size and extent to jump when switching from QPixmap to QImage. The map is drawn at the previous QImage size, then is drawn correctly on subsequent resize. I have since found that the Render toggle isn't a factor - it just may show the effects more readily.
My recollection is that the QImage has a size of 0,0 initially, which is why the map goes blank. After that the object is at its previous size and hasn't been resized when QPixmap is the rendering object. The key factors are first use or that the map canvas has been resized.
It is not Qt version related - the problem exists with either 4.3.x series or 4.4.x.
For what it's worth (I admit, I am biased) I have been applying the patch each time I obtain the latest svn copy and have not found any other problem that could be attributed to the patch. I remove the patch and test without it when I believe there may be a problem related to it.
comment:6 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Yes, you are right, the image should be resized together with the pixmap. The patch is applied in r9891 and also in the 1.0 branch. Thanks for your great work!
Marco
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:
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.