Fix accuracy with screen composition
It was using a faster divide by 256 instead of an accurate divide by 255. This meant black screen wasn't a null operation as it should be. This also fixes alpha mixing for a few other compositions. Pick-to: 6.3 6.2 5.15 Fixes: QTBUG-100327 Change-Id: I149ad39147176e00ce753979d55dc8633704dc1a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
parent
94b158134c
commit
2536d73adc
@ -1391,13 +1391,13 @@ private:
|
||||
|
||||
static inline int mix_alpha(int da, int sa)
|
||||
{
|
||||
return 255 - ((255 - sa) * (255 - da) >> 8);
|
||||
return 255 - qt_div_255((255 - sa) * (255 - da));
|
||||
}
|
||||
|
||||
#if QT_CONFIG(raster_64bit)
|
||||
static inline uint mix_alpha_rgb64(uint da, uint sa)
|
||||
{
|
||||
return 65535U - ((65535U - sa) * (65535U - da) >> 16);
|
||||
return 65535U - qt_div_65535((65535U - sa) * (65535U - da));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1807,7 +1807,7 @@ static inline void comp_func_Screen_impl(uint *Q_DECL_RESTRICT dest, const uint
|
||||
int da = qAlpha(d);
|
||||
int sa = qAlpha(s);
|
||||
|
||||
#define OP(a, b) 255 - (((255-a) * (255-b)) >> 8)
|
||||
#define OP(a, b) 255 - qt_div_255((255-a) * (255-b))
|
||||
int r = OP( qRed(d), qRed(s));
|
||||
int b = OP( qBlue(d), qBlue(s));
|
||||
int g = OP(qGreen(d), qGreen(s));
|
||||
@ -1837,7 +1837,7 @@ static inline void comp_func_Screen_impl(QRgba64 *Q_DECL_RESTRICT dest, const QR
|
||||
uint da = d.alpha();
|
||||
uint sa = s.alpha();
|
||||
|
||||
#define OP(a, b) 65535U - (((65535U-a) * (65535U-b)) >> 16)
|
||||
#define OP(a, b) 65535U - qt_div_65535((65535U-a) * (65535U-b))
|
||||
uint r = OP( d.red(), s.red());
|
||||
uint b = OP( d.blue(), s.blue());
|
||||
uint g = OP(d.green(), s.green());
|
||||
|
Loading…
Reference in New Issue
Block a user