1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
diff --git a/src/core/SkVM.cpp b/src/core/SkVM.cpp
index 654ab8f97c..e7b3137d8e 100644
--- a/src/core/SkVM.cpp
+++ b/src/core/SkVM.cpp
@@ -1173,7 +1173,7 @@ namespace skvm {
// Map min channel to 0, max channel to s, and scale the middle proportionally.
auto scale = [&](auto c) {
// TODO: better to divide and check for non-finite result?
- return select(sat == 0.0f, 0.0f
+ return select(eq_op(0.0f, sat), 0.0f
, ((c - mn) * s) / sat);
};
*r = scale(*r);
diff --git a/src/core/SkVM.h b/src/core/SkVM.h
index db5b273c45..5cf1ebba3c 100644
--- a/src/core/SkVM.h
+++ b/src/core/SkVM.h
@@ -882,6 +882,7 @@ namespace skvm {
static inline I32 operator==(I32 x, I32 y) { return x->eq(x,y); }
static inline I32 operator==(I32 x, int y) { return x->eq(x,y); }
static inline I32 operator==(int x, I32 y) { return y->eq(x,y); }
+ static inline I32 eq_op(float x, F32 y) { return y->eq(x,y); }
static inline I32 operator!=(I32 x, I32 y) { return x->neq(x,y); }
static inline I32 operator!=(I32 x, int y) { return x->neq(x,y); }
|