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;
if (data->txop <= QTransform::TxTranslate)
if (data->texture.type == QTextureData::Tiled)
if (data->texture.type == QTextureData::Tiled || data->texture.type == QTextureData::Pattern)
ft = BlendTiled;
else
ft = BlendUntransformed;
else if (data->bilinear)
if (data->texture.type == QTextureData::Tiled)
if (data->texture.type == QTextureData::Tiled || data->texture.type == QTextureData::Pattern)
ft = BlendTransformedBilinearTiled;
else
ft = BlendTransformedBilinear;
else
if (data->texture.type == QTextureData::Tiled)
if (data->texture.type == QTextureData::Pattern)
ft = BlendTiled;
else if (data->texture.type == QTextureData::Tiled)
ft = BlendTransformedTiled;
else
ft = BlendTransformed;

View File

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

View File

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