Update skstd::to_string to write smaller literals.
This moves the small-literals logic from Literal::description back
into skstd::to_string, and also simplifies the logic a little further.
Previously, we would check %.6g, %.7g, %.8g and %.9g in sequence,
trying to find the shortest representation of the float. I've reduced
it to just checking %.7g, and if that's not right, jumping straight
to %.9g.
In practice the output is almost the same, and I'd rather have
smaller/faster code than get one fewer digit in the output.
sksl_binary_size_gpu: 18352 -> 18354 bytes
sksl_binary_size_graphite: 22445 -> 22448 bytes
sksl_binary_size_compute: 245 -> 245 bytes
Change-Id: Iee729c3c0110c68d6c8c79e9af13edfc23a76389
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/585747
Reviewed-by: Brian Osman <brianosman@google.com>
9 files changed