Replace gfx::ClampToInt with base::saturated_cast.
This found a bug in saturated_cast that was covered by ClampToInt tests so it fixes that. If you have a floating point value of MAX_INT, then comparing an integer against it for equality with promote it to a float and it will compare true. However if you cast the float to an int, its actually outside the bounds of integer, so you can end up with a negative int as a result. Added unittests to check this for saturated_cast. Review URL: https://codereview.chromium.org/1164063005 Cr-Commit-Position: refs/heads/master@{#333092}
Showing
Please register or sign in to comment