aboutsummaryrefslogtreecommitdiffhomepage
path: root/gyp/core.gypi
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2016-05-27 10:47:31 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-27 10:47:32 -0700
commit785a5b941a4d74a1f272729fe8dca55c6eda6bb8 (patch)
tree895897fb08b687abaac95e9be208272db32e4342 /gyp/core.gypi
parent78d58d1084f0390c1c0f9123ac6e48efcd226f39 (diff)
Clean up SkFloatBits
- 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
Diffstat (limited to 'gyp/core.gypi')
-rw-r--r--gyp/core.gypi1
1 files changed, 0 insertions, 1 deletions
diff --git a/gyp/core.gypi b/gyp/core.gypi
index 38aa1b750e..2ae75befc4 100644
--- a/gyp/core.gypi
+++ b/gyp/core.gypi
@@ -123,7 +123,6 @@
'<(skia_src_path)/core/SkFindAndPlaceGlyph.h',
'<(skia_src_path)/core/SkFlattenable.cpp',
'<(skia_src_path)/core/SkFlattenableSerialization.cpp',
- '<(skia_src_path)/core/SkFloatBits.cpp',
'<(skia_src_path)/core/SkFont.cpp',
'<(skia_src_path)/core/SkFontLCDConfig.cpp',
'<(skia_src_path)/core/SkFontMgr.cpp',