Fix scaling of basic patterns under HiDPI

The dense patterns should not be non-smoothly scaled, just repeated
more.

Change-Id: I869556039ea1c91773bf2bc83d236b4592bcfc66
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2020-11-11 11:27:11 +01:00
parent 4e935e35f1
commit 1c56ff73aa
3 changed files with 8 additions and 5 deletions

View File

@ -2712,17 +2712,19 @@ static TextureBlendType getBlendType(const QSpanData *data)
{ {
TextureBlendType ft; TextureBlendType ft;
if (data->txop <= QTransform::TxTranslate) if (data->txop <= QTransform::TxTranslate)
if (data->texture.type == QTextureData::Tiled) if (data->texture.type == QTextureData::Tiled || data->texture.type == QTextureData::Pattern)
ft = BlendTiled; ft = BlendTiled;
else else
ft = BlendUntransformed; ft = BlendUntransformed;
else if (data->bilinear) else if (data->bilinear)
if (data->texture.type == QTextureData::Tiled) if (data->texture.type == QTextureData::Tiled || data->texture.type == QTextureData::Pattern)
ft = BlendTransformedBilinearTiled; ft = BlendTransformedBilinearTiled;
else else
ft = BlendTransformedBilinear; ft = BlendTransformedBilinear;
else else
if (data->texture.type == QTextureData::Tiled) if (data->texture.type == QTextureData::Pattern)
ft = BlendTiled;
else if (data->texture.type == QTextureData::Tiled)
ft = BlendTransformedTiled; ft = BlendTransformedTiled;
else else
ft = BlendTransformed; ft = BlendTransformed;

View File

@ -321,7 +321,8 @@ struct QTextureData
bool hasAlpha; bool hasAlpha;
enum Type { enum Type {
Plain, Plain,
Tiled Tiled,
Pattern
}; };
Type type; Type type;
int const_alpha; int const_alpha;

View File

@ -4587,7 +4587,7 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
if (!tempImage) if (!tempImage)
tempImage = new QImage(); tempImage = new QImage();
*tempImage = rasterBuffer->colorizeBitmap(qt_imageForBrush(brushStyle, true), brush.color()); *tempImage = rasterBuffer->colorizeBitmap(qt_imageForBrush(brushStyle, true), brush.color());
initTexture(tempImage, alpha, QTextureData::Tiled); initTexture(tempImage, alpha, QTextureData::Pattern);
break; break;
case Qt::TexturePattern: case Qt::TexturePattern:
type = Texture; type = Texture;