Fix inconcequent use of DPI at generating the WMS legend
-
Consider DPI of QgsWmsRenderContext what is the OGC default (0.28 mm per pixel) or the passed WMS parameter - this is done by creating the QgsRenderContext by the mapSettings (with BBOX) or applying the dotsPerMm to the scaleFactor.
-
Additionally the image size needs to be calculated according to the QgsRenderContext now, what means it needs to be generated before.
-
The QPainter needs to be applied after to the context (since it's not passed by creating the context anymore).