Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
base
SkHalf.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2014 Google Inc.
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#include "
src/base/SkHalf.h
"
9
10
#include "
include/private/base/SkFloatingPoint.h
"
11
#include "
src/base/SkVx.h
"
12
13
// NOTE: These are defined within the CPP compilation unit so that they are not inlined everywhere
14
// and increase code size. Performance critical code is likely already using skvx directly, and
15
// they will be inlined where performance vs. code size is worth it.
16
SkHalf
SkFloatToHalf
(
float
f) {
17
if
(std::isnan(f)) {
18
return
SK_HalfNaN
;
19
}
else
{
20
return
to_half(
skvx::Vec<1,float>
(f))[0];
21
}
22
}
23
24
float
SkHalfToFloat
(
SkHalf
h
) {
25
return
from_half(
skvx::Vec<1,uint16_t>
(
h
))[0];
26
}
SkFloatingPoint.h
SkHalfToFloat
float SkHalfToFloat(SkHalf h)
Definition
SkHalf.cpp:24
SkFloatToHalf
SkHalf SkFloatToHalf(float f)
Definition
SkHalf.cpp:16
SkHalf.h
SkHalf
uint16_t SkHalf
Definition
SkHalf.h:16
SK_HalfNaN
static constexpr uint16_t SK_HalfNaN
Definition
SkHalf.h:18
SkVx.h
h
SkScalar h
Definition
pictureshadertile.cpp:30
skvx::Vec
Definition
SkVx.h:83
Generated on Fri Apr 26 2024 06:16:32 for Flutter Engine by
1.9.8