785a5b941a
- remove dead code - rewrite float -> int converters The strategy for the new converters is: - convert input to double - floor/ceil/round in double space - pin that double to [SK_MinS32, SK_MaxS32] - truncate that double to int32_t This simpler strategy does not work: - floor/ceil/round in float space - pin that float to [SK_MinS32, SK_MaxS32] - truncate that float to int32_t SK_MinS32 and SK_MaxS32 are not representable as floats: they round to the nearest float, ±2^31, which makes the pin insufficient for floats near SK_MinS32 (-2^31+1) or SK_MaxS32 (+2^31-1). float only has 24 bits of precision, and we need 31. double can represent all integers up to 50-something bits. An alternative is to pin in float to ±2147483520, the last exactly representable float before SK_MaxS32 (127 too small). Our tests test that we round as floor(x+0.5), which can return different numbers than round(x) for negative x. So this CL explicitly uses floor(x+0.5). I've updated the tests with ±inf and ±NaN, and tried to make them a little clearer, especially using SK_MinS32 instead of -SK_MaxS32. I have not timed anything here. I have never seen any of these methods in a profile. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2012333003 Review-Url: https://codereview.chromium.org/2012333003 |
||
---|---|---|
.. | ||
GrAuditTrail.h | ||
GrRenderTargetProxy.h | ||
GrSingleOwner.h | ||
GrSurfaceProxy.h | ||
GrTextureProxy.h | ||
SkAtomics.h | ||
SkChecksum.h | ||
SkFixed.h | ||
SkFloatBits.h | ||
SkFloatingPoint.h | ||
SkGpuFenceSync.h | ||
SkImageInfoPriv.h | ||
SkMiniRecorder.h | ||
SkMutex.h | ||
SkOnce.h | ||
SkRecords.h | ||
SkSemaphore.h | ||
SkSpinlock.h | ||
SkTArray.h | ||
SkTDArray.h | ||
SkTDict.h | ||
SkTemplates.h | ||
SkTFitsIn.h | ||
SkTHash.h | ||
SkThreadID.h | ||
SkTLogic.h | ||
SkTSearch.h | ||
SkWeakRefCnt.h |