summaryrefslogtreecommitdiff
path: root/libs/hwui/ProgramCache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/ProgramCache.cpp')
-rw-r--r--libs/hwui/ProgramCache.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp
index f451690709f9..3ef2a716905d 100644
--- a/libs/hwui/ProgramCache.cpp
+++ b/libs/hwui/ProgramCache.cpp
@@ -334,8 +334,10 @@ const char* gFS_Main_ApplyColorOp[3] = {
const char* gFS_Main_FragColor_HasRoundRectClip =
" mediump vec2 fragToLT = roundRectInnerRectLTRB.xy - roundRectPos;\n"
" mediump vec2 fragFromRB = roundRectPos - roundRectInnerRectLTRB.zw;\n"
- " mediump vec2 dist = max(max(fragToLT, fragFromRB), vec2(0.0, 0.0));\n"
- " mediump float linearDist = roundRectRadius - length(dist);\n"
+
+ // divide + multiply by 128 to avoid falling out of range in length() function
+ " mediump vec2 dist = max(max(fragToLT, fragFromRB), vec2(0.0, 0.0)) / 128.0;\n"
+ " mediump float linearDist = roundRectRadius - (length(dist) * 128.0);\n"
" gl_FragColor *= clamp(linearDist, 0.0, 1.0);\n";
const char* gFS_Main_DebugHighlight =