• danakj's avatar
    Replace gfx::ClampToInt with base::saturated_cast. · 3193742f
    danakj authored
    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}
    3193742f
canvas_skia.cc 12.8 KB