No issue - Set device contrast to an acceptable value if OOB.

On Mac and Win+DW, enhanced device contrast can possibly not be set.
This throws Skia for a loop by passing in an OOB scalar to its init.
Work around this by setting an accepted average value that helps
prevent font wash-out while not causing fringing.
This commit is contained in:
Moonchild
2025-05-28 12:27:24 +02:00
committed by roytam1
parent 75c0461123
commit 91a026ea65
+5 -2
View File
@@ -73,8 +73,11 @@ struct SkScalerContextRec {
return SkIntToScalar(fContrast) / ((1 << 8) - 1);
}
void setContrast(SkScalar c) {
SkASSERT(0 <= c && c <= SK_Scalar1);
fContrast = SkScalarRoundToInt(c * ((1 << 8) - 1));
if (0 <= c && c <= SK_Scalar1) {
fContrast = SkScalarRoundToInt(c * ((1 << 8) - 1));
} else {
fContrast = SkScalarRoundToInt(0.5f * ((1 << 8) - 1));
}
}
/**