aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBitmap.cpp
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2016-07-14 11:02:09 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-14 11:02:09 -0700
commit3296bee70d074bb8094b3229dbe12fa016657e90 (patch)
treea6dc47b3805301e3416e3b9a2e361ac9d0217f15 /src/core/SkBitmap.cpp
parent7cf36ccb441956e9e35bc4c9b08bdf8bafd9d4bb (diff)
Expand _01 half<->float limitation to _finite. Simplify.
It's become clear we need to sometimes deal with values <0 or >1. I'm not yet convinced we care about NaN or +-inf. We had some fairly clever tricks and optimizations here for NEON and SSE. I've thrown them out in favor of a single implementation. If we find the specializations mattered, we can certainly figure out how to extend them to this new range/domain. This happens to add a vectorized float -> half for ARMv7, which was missing from the _01 version. (The SSE strategy was not portable to platforms that flush denorm floats to zero.) I've tested the full float range for FloatToHalf on my desktop and a 5x. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2145663003 CQ_INCLUDE_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot;master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Review-Url: https://codereview.chromium.org/2145663003
Diffstat (limited to 'src/core/SkBitmap.cpp')
-rw-r--r--src/core/SkBitmap.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 863169c458..fb7f691c93 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -601,7 +601,7 @@ SkColor SkBitmap::getColor(int x, int y) const {
}
case kRGBA_F16_SkColorType: {
const uint64_t* addr = (const uint64_t*)fPixels + y * (fRowBytes >> 3) + x;
- Sk4f p4 = SkHalfToFloat_01(addr[0]);
+ Sk4f p4 = SkHalfToFloat_finite(addr[0]);
if (p4[3]) {
float inva = 1 / p4[3];
p4 = p4 * Sk4f(inva, inva, inva, 1);
@@ -1145,7 +1145,7 @@ bool SkBitmap::ReadRawPixels(SkReadBuffer* buffer, SkBitmap* bitmap) {
SkImageInfo info;
info.unflatten(*buffer);
- // If there was an error reading "info" or if it is bogus,
+ // If there was an error reading "info" or if it is bogus,
// don't use it to compute minRowBytes()
if (!buffer->validate(SkColorTypeValidateAlphaType(info.colorType(),
info.alphaType()))) {