Add a note about (x*y+255)/256.
BUG=skia:4117 Review URL: https://codereview.chromium.org/1312283004
This commit is contained in:
parent
e01008fdbc
commit
6904d1d3f1
@ -103,6 +103,7 @@ public:
|
|||||||
// May be incorrect by +-1, but is always exactly correct when *this or o is 0 or 255.
|
// May be incorrect by +-1, but is always exactly correct when *this or o is 0 or 255.
|
||||||
Sk4px approxMulDiv255(const Sk16b& o) const {
|
Sk4px approxMulDiv255(const Sk16b& o) const {
|
||||||
// (x*y + x) / 256 meets these criteria. (As of course does (x*y + y) / 256 by symmetry.)
|
// (x*y + x) / 256 meets these criteria. (As of course does (x*y + y) / 256 by symmetry.)
|
||||||
|
// FYI: (x*y + 255) / 256 also meets these criteria. In my brief testing, it was slower.
|
||||||
return this->widenLo().addNarrowHi(*this * o);
|
return this->widenLo().addNarrowHi(*this * o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user