@@ -1869,6 +1869,10 @@ void QgsTextRenderer::drawBuffer( QgsRenderContext& context, const QgsTextRender
1869
1869
{
1870
1870
p->setCompositionMode ( buffer.blendMode () );
1871
1871
}
1872
+ if ( context.flags () & QgsRenderContext::Antialiasing )
1873
+ {
1874
+ p->setRenderHint ( QPainter::Antialiasing );
1875
+ }
1872
1876
1873
1877
// scale for any print output or image saving @ specific dpi
1874
1878
p->scale ( component.dpiRatio , component.dpiRatio );
@@ -2103,6 +2107,10 @@ void QgsTextRenderer::drawBackground( QgsRenderContext& context, QgsTextRenderer
2103
2107
p->translate ( QPointF ( xoff, yoff ) );
2104
2108
p->rotate ( component.rotationOffset );
2105
2109
p->translate ( -sizeOut / 2 , sizeOut / 2 );
2110
+ if ( context.flags () & QgsRenderContext::Antialiasing )
2111
+ {
2112
+ p->setRenderHint ( QPainter::Antialiasing );
2113
+ }
2106
2114
2107
2115
drawShadow ( context, component, format );
2108
2116
p->restore ();
@@ -2121,6 +2129,10 @@ void QgsTextRenderer::drawBackground( QgsRenderContext& context, QgsTextRenderer
2121
2129
{
2122
2130
p->setCompositionMode ( background.blendMode () );
2123
2131
}
2132
+ if ( context.flags () & QgsRenderContext::Antialiasing )
2133
+ {
2134
+ p->setRenderHint ( QPainter::Antialiasing );
2135
+ }
2124
2136
p->translate ( component.center .x (), component.center .y () );
2125
2137
p->rotate ( component.rotation );
2126
2138
double xoff = QgsTextRenderer::scaleToPixelContext ( background.offset ().x (), context, background.offsetUnit (), false , background.offsetMapUnitScale () );
@@ -2185,6 +2197,10 @@ void QgsTextRenderer::drawBackground( QgsRenderContext& context, QgsTextRenderer
2185
2197
return ;
2186
2198
2187
2199
p->save ();
2200
+ if ( context.flags () & QgsRenderContext::Antialiasing )
2201
+ {
2202
+ p->setRenderHint ( QPainter::Antialiasing );
2203
+ }
2188
2204
p->translate ( QPointF ( component.center .x (), component.center .y () ) );
2189
2205
p->rotate ( component.rotation );
2190
2206
double xoff = QgsTextRenderer::scaleToPixelContext ( background.offset ().x (), context, background.offsetUnit (), false , background.offsetMapUnitScale () );
@@ -2353,7 +2369,11 @@ void QgsTextRenderer::drawShadow( QgsRenderContext& context, const QgsTextRender
2353
2369
-offsetDist * sin ( angleRad + M_PI / 2 ) );
2354
2370
2355
2371
p->save ();
2356
- p->setRenderHints ( QPainter::Antialiasing | QPainter::SmoothPixmapTransform );
2372
+ p->setRenderHint ( QPainter::SmoothPixmapTransform );
2373
+ if ( context.flags () & QgsRenderContext::Antialiasing )
2374
+ {
2375
+ p->setRenderHint ( QPainter::Antialiasing );
2376
+ }
2357
2377
if ( context.useAdvancedEffects () )
2358
2378
{
2359
2379
p->setCompositionMode ( shadow .blendMode () );
@@ -2456,6 +2476,10 @@ void QgsTextRenderer::drawTextInternal( TextPart drawType,
2456
2476
Q_FOREACH ( const QString& line, textLines )
2457
2477
{
2458
2478
context.painter ()->save ();
2479
+ if ( context.flags () & QgsRenderContext::Antialiasing )
2480
+ {
2481
+ context.painter ()->setRenderHint ( QPainter::Antialiasing );
2482
+ }
2459
2483
context.painter ()->translate ( component.origin );
2460
2484
if ( !qgsDoubleNear ( component.rotation , 0.0 ) )
2461
2485
context.painter ()->rotate ( -component.rotation * 180 / M_PI );
0 commit comments