Change SkUnitScalarClampToByte to more accurate implementation.
The previous implementation was likely more efficient when SkScalar was SkFixed. BUG=skia:4632 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1691403002 Review URL: https://codereview.chromium.org/1691403002
This commit is contained in:
parent
3719886415
commit
f156ea3c3e
@ -224,13 +224,7 @@ static inline int SkAlphaBlend255(S16CPU src, S16CPU dst, U8CPU alpha) {
|
||||
}
|
||||
|
||||
static inline U8CPU SkUnitScalarClampToByte(SkScalar x) {
|
||||
if (x < 0) {
|
||||
return 0;
|
||||
}
|
||||
if (x >= SK_Scalar1) {
|
||||
return 255;
|
||||
}
|
||||
return SkScalarToFixed(x) >> 8;
|
||||
return static_cast<U8CPU>(SkScalarPin(x, 0, 1) * 255 + 0.5);
|
||||
}
|
||||
|
||||
#define SK_R16_BITS 5
|
||||
|
Loading…
Reference in New Issue
Block a user