Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6cfeb09c authored by Prabhat Awasthi's avatar Prabhat Awasthi
Browse files

Use highp precision for scaled coordination

If scaled coordination is closer to zero than what
the medium precision can store, distance becomes
zero and it causes divided by zero.

Change-Id: I8ee921dd1f57564a442e685266b12d95fc08e165
parent daff51d0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -66,7 +66,8 @@ public class FisheyeFilter extends Filter {
            "void main() {\n" +
            "  const float m_pi_2 = 1.570963;\n" +
            "  vec2 coord = v_texcoord - vec2(0.5, 0.5);\n" +
            "  float dist = length(coord * scale);\n" +
            "  highp vec2 scaled_coord = coord * scale;\n" +
            "  float dist = length(scaled_coord);\n" +
            "  float radian = m_pi_2 - atan(alpha * sqrt(radius2 - dist * dist), dist);\n" +
            "  float scalar = radian * factor / dist;\n" +
            "  vec2 new_coord = coord * scalar + vec2(0.5, 0.5);\n" +