Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force use of raster masking in layout designer preview #49302

Merged
merged 1 commit into from
Jul 12, 2022

Conversation

nyalldawson
Copy link
Collaborator

The vector masking (while great for output quality) is much slower,
so for the layout designer preview renders we just use the faster
raster approach.

The vector masking (while great for output quality) is much slower,
so for the layout designer preview renders we just use the faster
raster approach.
@github-actions github-actions bot added this to the 3.28.0 milestone Jul 11, 2022
Qgis.MapSettingsFlag.__doc__ = 'Flags which adjust the way maps are rendered.\n\n.. versionadded:: 3.22\n\n' + '* ``Antialiasing``: ' + Qgis.MapSettingsFlag.Antialiasing.__doc__ + '\n' + '* ``DrawEditingInfo``: ' + Qgis.MapSettingsFlag.DrawEditingInfo.__doc__ + '\n' + '* ``ForceVectorOutput``: ' + Qgis.MapSettingsFlag.ForceVectorOutput.__doc__ + '\n' + '* ``UseAdvancedEffects``: ' + Qgis.MapSettingsFlag.UseAdvancedEffects.__doc__ + '\n' + '* ``DrawLabeling``: ' + Qgis.MapSettingsFlag.DrawLabeling.__doc__ + '\n' + '* ``UseRenderingOptimization``: ' + Qgis.MapSettingsFlag.UseRenderingOptimization.__doc__ + '\n' + '* ``DrawSelection``: ' + Qgis.MapSettingsFlag.DrawSelection.__doc__ + '\n' + '* ``DrawSymbolBounds``: ' + Qgis.MapSettingsFlag.DrawSymbolBounds.__doc__ + '\n' + '* ``RenderMapTile``: ' + Qgis.MapSettingsFlag.RenderMapTile.__doc__ + '\n' + '* ``RenderPartialOutput``: ' + Qgis.MapSettingsFlag.RenderPartialOutput.__doc__ + '\n' + '* ``RenderPreviewJob``: ' + Qgis.MapSettingsFlag.RenderPreviewJob.__doc__ + '\n' + '* ``RenderBlocking``: ' + Qgis.MapSettingsFlag.RenderBlocking.__doc__ + '\n' + '* ``LosslessImageRendering``: ' + Qgis.MapSettingsFlag.LosslessImageRendering.__doc__ + '\n' + '* ``Render3DMap``: ' + Qgis.MapSettingsFlag.Render3DMap.__doc__ + '\n' + '* ``HighQualityImageTransforms``: ' + Qgis.MapSettingsFlag.HighQualityImageTransforms.__doc__ + '\n' + '* ``SkipSymbolRendering``: ' + Qgis.MapSettingsFlag.SkipSymbolRendering.__doc__
QgsMapSettings.ForceRasterMasks = Qgis.MapSettingsFlag.ForceRasterMasks
QgsMapSettings.ForceRasterMasks.is_monkey_patched = True
QgsMapSettings.ForceRasterMasks.__doc__ = "Force symbol masking to be applied using a raster method. This is considerably faster when compared to the vector method, but results in a inferior quality output. (since QGIS 3.26.1)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
QgsMapSettings.ForceRasterMasks.__doc__ = "Force symbol masking to be applied using a raster method. This is considerably faster when compared to the vector method, but results in a inferior quality output. (since QGIS 3.26.1)"
QgsMapSettings.ForceRasterMasks.__doc__ = "Force symbol masking to be applied using a raster method. This is considerably faster when compared to the vector method, but results in an inferior quality output. (since QGIS 3.26.1)"

?

@@ -1334,6 +1334,7 @@ class CORE_EXPORT Qgis
Render3DMap = 0x2000, //!< Render is for a 3D map
HighQualityImageTransforms = 0x4000, //!< Enable high quality image transformations, which results in better appearance of scaled or rotated raster components of a map (since QGIS 3.24)
SkipSymbolRendering = 0x8000, //!< Disable symbol rendering while still drawing labels if enabled (since QGIS 3.24)
ForceRasterMasks = 0x10000, //!< Force symbol masking to be applied using a raster method. This is considerably faster when compared to the vector method, but results in a inferior quality output. (since QGIS 3.26.1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ForceRasterMasks = 0x10000, //!< Force symbol masking to be applied using a raster method. This is considerably faster when compared to the vector method, but results in a inferior quality output. (since QGIS 3.26.1)
ForceRasterMasks = 0x10000, //!< Force symbol masking to be applied using a raster method. This is considerably faster when compared to the vector method, but results in an inferior quality output. (since QGIS 3.26.1)

Copy link
Contributor

@nirvn nirvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we wouldn't want to force raster mask on map canvas drawing? Much like the layout designer preview, we don't care that map canvas draws non-vector outputs.

Or are raster masks not looking as good as vector masks?

@nyalldawson
Copy link
Collaborator Author

@nirvn

Is there a reason why we wouldn't want to force raster mask on map canvas drawing?

That's already the case. The reason why layouts use vector is because the map settings flag "ForceVector" is set (so that we don't use rasterised markers, etc). So the new flag overrides ForceVector for the masking functionality alone and forces it back to raster

@nirvn
Copy link
Contributor

nirvn commented Jul 12, 2022

@nyalldawson , cool cool.

@troopa81
Copy link
Contributor

Sorry to come back late at this but I try to fix #50543 and I think we should have a way to disable completely vectorization of rendering (and so the selective masking vector way which is really slow)

The reason why layouts use vector is because the map settings flag "ForceVector" is set (so that we don't use rasterised markers, etc).

But, why is it useful to have non-rasterized markers when we export to an image ? or to a pdf where the user didn't check Always export as vectors. Because in that cases we force it to true here and there

Should we:

  1. Keep only ForceVectorOutput flag : if true everything is vector (marker, selective masking...), else everything is raster
  2. Set the ForceRasterMasks to true when exporting to image or exporting to PDF with the Always export as vectors option disabled (but it make the code a little bit ambiguous AMHA)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants