aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/private/SkFloatBits.h
Commit message (Collapse)AuthorAge
* Revert "Revert "implement SkScalar versions in terms of float versions""Gravatar Mike Reed2018-05-14
| | | | | | | | | | This reverts commit 0e6db75eebab430e7f6665c8cfa1e7dcd2fef123. Bug: skia: Change-Id: I015d01efc58dfe03dae6bcc57c4b1102276e7566 Reviewed-on: https://skia-review.googlesource.com/127967 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Revert "implement SkScalar versions in terms of float versions"Gravatar Mike Reed2018-05-14
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 4c3cb3767f5af3860998b932702dc18619ab3e1e. Reason for revert: investigate asan failures Original change's description: > implement SkScalar versions in terms of float versions > > Bug: skia: > Change-Id: I44ce228290f7fda5b7e3553c8543dcf581b1ca3b > Reviewed-on: https://skia-review.googlesource.com/127128 > Reviewed-by: Cary Clark <caryclark@google.com> > Commit-Queue: Mike Reed <reed@google.com> TBR=caryclark@google.com,reed@google.com Change-Id: Ic790b15130a67f46a0a99fdf991c5c08d682be5e No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/128060 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* implement SkScalar versions in terms of float versionsGravatar Mike Reed2018-05-14
| | | | | | | | Bug: skia: Change-Id: I44ce228290f7fda5b7e3553c8543dcf581b1ca3b Reviewed-on: https://skia-review.googlesource.com/127128 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Mike Reed <reed@google.com>
* clean up useage of SkFloatBitsGravatar Mike Reed2017-08-07
| | | | | | | | Bug: skia: Change-Id: I6d3a0019f2fcf11feca69123e4ce6eb35de43613 Reviewed-on: https://skia-review.googlesource.com/31222 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
* just use math.h for converting from float to intGravatar Mike Reed2017-08-04
| | | | | | | | Bug: skia: Change-Id: I40cce503cd4cef09c671511a705192efc5d67d71 Reviewed-on: https://skia-review.googlesource.com/31002 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Guard against buggy ucrt\math.h.Gravatar Mike Klein2016-11-28
| | | | | | | | | | | | | | BUG=666707 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5089 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: I3bebfdf635d541d92fb84236f0f6fae2da39d691 Reviewed-on: https://skia-review.googlesource.com/5089 Reviewed-by: Bruce Dawson <brucedawson@google.com> Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Clean up SkFloatBitsGravatar mtklein2016-05-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* fix undefined signed shiftsGravatar caryclark2016-02-26
| | | | | | | | | | | | | The expression (1 << 31) is technically undefined. Fixed the undefined shift referenced by this bug and a few friends. R=reed@google.com BUG=skia:2285 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1737363002 Review URL: https://codereview.chromium.org/1737363002
* Revert[8] "move some public headers into private"Gravatar reed2015-08-17
| | | | | | | | | This reverts commit fb28cd2b13d76c324570341e1155aaadc1b532b6. BUG=skia: TBR= Review URL: https://codereview.chromium.org/1298833002
* Revert[7] "move some public headers into private"Gravatar reed2015-08-15
| | | | | | | | | This reverts commit e02716908fe82c7c4ae9b415793277620a22bcd6. BUG=skia: TBR= Review URL: https://codereview.chromium.org/1300523002
* Revert[6] "move some public headers into private"Gravatar reed2015-08-15
| | | | | | | | | This reverts commit cc1229c9d5e57b45305ba8f99ae33e92db0032bc. BUG=skia: TBR= Review URL: https://codereview.chromium.org/1295003002
* Revert "Revert[4] "move some public headers into private""Gravatar reed2015-08-12
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 33e00db73d5f1836481cf4053c64e4ed20537662. BUG=skia: TBR= NOTREECHECKS=True FAILED: /b/build/goma/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/components/user_manager/user_manager_test_support.fake_user_manager.o.d -DV8_DEPRECATION_WARNINGS -DCLD_VERSION=2 -D_FILE_OFFSET_BITS=64 -DCHROMIUM_BUILD -DCR_CLANG_REVISION=242792-1 -DCOMPONENT_BUILD -DUI_COMPOSITOR_IMAGE_TRANSPORT -DUSE_AURA=1 -DUSE_ASH=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_DEFAULT_RENDER_THEME=1 -DUSE_LIBJPEG_TURBO=1 -DUSE_X11=1 -DIMAGE_LOADER_EXTENSION=1 -DENABLE_WEBRTC=1 -DENABLE_MEDIA_ROUTER=1 -DUSE_PROPRIETARY_CODECS -DENABLE_PEPPER_CDMS -DENABLE_CONFIGURATION_POLICY -DENABLE_NOTIFICATIONS -DENABLE_HIDPI=1 -DENABLE_TOPCHROME_MD=1 -DUSE_UDEV -DDONT_EMBED_BUILD_METADATA -DDCHECK_ALWAYS_ON=1 -DFIELDTRIAL_TESTING_ENABLED -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 -DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_BACKGROUND=1 -DENABLE_GOOGLE_NOW=1 -DENABLE_PRINTING=1 -DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_APP_LIST=1 -DENABLE_SUPERVISED_USERS=1 -DENABLE_MDNS=1 -DENABLE_SERVICE_DISCOVERY=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DSAFE_BROWSING_SERVICE -DGTEST_HAS_POSIX_RE=0 -DGTEST_LANG_CXX11=0 -DUNIT_TEST -DGTEST_HAS_RTTI=0 -DUSE_LIBPCI=1 -DUSE_OPENSSL=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DOS_CHROMEOS=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 -D_DEBUG -D_GLIBCXX_DEBUG=1 -Igen -I../.. -I../../skia/config -I../../testing/gmock/include -I../../testing/gtest/include -Werror -pthread -fno-strict-aliasing -Wall -Wno-unused-parameter -Wno-missing-field-initializers -fvisibility=hidden -pipe -fPIC -Wno-reserved-user-defined-literal -Xclang -load -Xclang /b/build/slave/linux_chromeos/build/src/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-templates -fcolor-diagnostics -B/b/build/slave/linux_chromeos/build/src/third_party/binutils/Linux_x64/Release/bin -Wheader-hygiene -Wno-char-subscripts -Wno-unneeded-internal-declaration -Wno-covered-switch-default -Wstring-conversion -Wno-c++11-narrowing -Wno-deprecated-register -Wno-inconsistent-missing-override -Wno-shift-negative-value -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -m64 -march=x86-64 -O0 -g -funwind-tables -gsplit-dwarf -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare -g0 -fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -Wsign-compare -std=gnu++11 -c ../../components/user_manager/fake_user_manager.cc -o obj/components/user_manager/user_manager_test_support.fake_user_manager.o In file included from ../../components/user_manager/fake_user_manager.cc:5: In file included from ../../components/user_manager/fake_user_manager.h:12: In file included from ../../components/user_manager/user.h:14: In file included from ../../components/user_manager/user_image/user_image.h:12: In file included from ../../ui/gfx/image/image_skia.h:15: In file included from ../../ui/gfx/image/image_skia_rep.h:8: In file included from ../../third_party/skia/include/core/SkBitmap.h:11: In file included from ../../third_party/skia/include/core/SkColor.h:11: In file included from ../../third_party/skia/include/core/SkScalar.h:12: ../../third_party/skia/include/core/../private/SkFloatingPoint.h:13:10: fatal error: 'SkTypes.h' file not found #include "SkTypes.h" ninja -w dupbuild=err -C /b/build/slave/linux_chromeos/build/src/out/Debug accessibility_unittests accessibility_unittests_run app_list_unittests app_list_unittests_run app_shell_unittests app_shell_unittests_run ash_unittests ash_unittests_run aura_builder aura_unittests aura_unittests_run base_unittests base_unittests_run browser_tests browser_tests_run cacheinvalidation_unittests cacheinvalidation_unittests_run chromeos_unittests chromeos_unittests_run components_unittests components_unittests_run compositor_unittests compositor_unittests_run content_browsertests content_browsertests_run content_unittests content_unittests_run crypto_unittests crypto_unittests_run dbus_unittests device_unittests device_unittests_run display_unittests display_unittests_run events_unittests events_unittests_run extensions_browsertests extensions_browsertests_run extensions_unittests extensions_unittests_run gcm_unit_tests gcm_unit_tests_run gfx_unittests gfx_unittests_run google_apis_unittests google_apis_unittests_run gpu_unittests gpu_unittests_run interactive_ui_tests interactive_ui_tests_run ipc_tests ipc_tests_run jingle_unittests jingle_unittests_run media_unittests media_unittests_run message_center_unittests message_center_unittests_run midi_unittests midi_unittests_run nacl_helper_nonsfi_unittests nacl_loader_unittests nacl_loader_unittests_run net_unittests net_unittests_run ppapi_unittests printing_unittests printing_unittests_run remoting_unittests remoting_unittests_run sandbox_linux_unittests sandbox_linux_unittests_run skia_unittests skia_unittests_run sql_unittests sql_unittests_run sync_unit_tests sync_unit_tests_run ui_base_unittests ui_base_unittests_run ui_chromeos_unittests ui_touch_selection_unittests ui_touch_selection_unittests_run unit_tests unit_tests_run url_unittests url_unittests_run views_unittests wm_unittests wm_unittests_run -j50 ninja: Entering directory `/b/build/slave/linux_chromeos/build/src/out/Debug' Review URL: https://codereview.chromium.org/1288863002
* Revert[4] "move some public headers into private"Gravatar reed2015-08-12
| | | | | | | | | This reverts commit 9cdcabefa33d49febfdb45e388e762b4dee8dd6f. BUG=skia: TBR= Review URL: https://codereview.chromium.org/1291613007
* Revert[3] "move some public headers into private"Gravatar reed2015-08-12
| | | | | | | | | | | This reverts commit 9d20ee57d72a3850a6b51f2f2b00e00978be3864. BUG=skia: TBR= failures here: https://codereview.chromium.org/1286103004 Review URL: https://codereview.chromium.org/1290733002
* Revert[2] "move some public headers into private"Gravatar reed2015-08-12
| | | | | | | | | | This reverts commit 4cf9e7e14797f87f08b2078fa1afaf731cbf8f52. BUG=skia: TBR= NOTRY=True Review URL: https://codereview.chromium.org/1284173002
* Revert "move some public headers into private"Gravatar reed2015-08-11
| | | | | | | | | | This reverts commit eedf0fb20489bc6c3706539dd6ab499f41cbe048. BUG=skia: TBR= NOTRY=True Review URL: https://codereview.chromium.org/1270313005
* move some public headers into privateGravatar reed2015-08-11
BUG=skia: Review URL: https://codereview.chromium.org/1289483002