macOS: Only do gamma-corrected blending for subpixel-antialiased text
The grayscale font-smoothing doesn't expect to be linearly blended, as first assumed. Amended nativetext manual test to better diagnose the native Core Text behavior. Non-linear blending will result in the magenta text having a dark outline against the green background. Change-Id: I24a5f04eb1bd66fb98d621078d80ee9b80800827 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
5af60d3b37
commit
3306b16239
@ -736,7 +736,7 @@ bool QCoreTextFontEngine::shouldSmoothFont() const
|
|||||||
|
|
||||||
bool QCoreTextFontEngine::expectsGammaCorrectedBlending() const
|
bool QCoreTextFontEngine::expectsGammaCorrectedBlending() const
|
||||||
{
|
{
|
||||||
return shouldSmoothFont();
|
return shouldSmoothFont() && fontSmoothing() == Subpixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QCoreTextFontEngine::fontSmoothingGamma()
|
qreal QCoreTextFontEngine::fontSmoothingGamma()
|
||||||
|
@ -101,7 +101,7 @@ public:
|
|||||||
|
|
||||||
const int ascent = fontMetrics().ascent();
|
const int ascent = fontMetrics().ascent();
|
||||||
|
|
||||||
QPen metricsPen(Qt::magenta, 1.0);
|
QPen metricsPen(QColor(112, 216, 255), 1.0);
|
||||||
metricsPen.setCosmetic(true);
|
metricsPen.setCosmetic(true);
|
||||||
p.setPen(metricsPen);
|
p.setPen(metricsPen);
|
||||||
p.drawLine(QPoint(0, ascent), QPoint(width(), ascent));
|
p.drawLine(QPoint(0, ascent), QPoint(width(), ascent));
|
||||||
@ -201,7 +201,7 @@ public:
|
|||||||
case 0: return qMakePair(QColor(), QColor());
|
case 0: return qMakePair(QColor(), QColor());
|
||||||
case 1: return qMakePair(QColor(Qt::black), QColor(Qt::white));
|
case 1: return qMakePair(QColor(Qt::black), QColor(Qt::white));
|
||||||
case 2: return qMakePair(QColor(Qt::white), QColor(Qt::black));
|
case 2: return qMakePair(QColor(Qt::white), QColor(Qt::black));
|
||||||
case 3: return qMakePair(QColor(Qt::green), QColor(Qt::red));
|
case 3: return qMakePair(QColor(Qt::magenta), QColor(Qt::green));
|
||||||
case 4: return qMakePair(QColor(0, 0, 0, 128), QColor(Qt::white));
|
case 4: return qMakePair(QColor(0, 0, 0, 128), QColor(Qt::white));
|
||||||
case 5: return qMakePair(QColor(255, 255, 255, 128), QColor(Qt::black));
|
case 5: return qMakePair(QColor(255, 255, 255, 128), QColor(Qt::black));
|
||||||
default: return qMakePair(QColor(), QColor());
|
default: return qMakePair(QColor(), QColor());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user