frameworks/native
Revision | 2173449d9dccb15b87c9df5d373dc32e1dcabed6 (tree) |
---|---|
Zeit | 2019-07-29 07:26:42 |
Autor | android-build-team Robot <android-build-team-robot@goog...> |
Commiter | android-build-team Robot |
Merge cherrypicks of [9007561, 9007562, 9007563, 9007600, 9007801, 9007895, 9007389] into qt-release
Change-Id: I10d7f5b7ccd28effeb39bbbbb7a454d819e1f93d
@@ -575,10 +575,11 @@ String8 ProgramCache::generateFragmentShader(const Key& needs) { | ||
575 | 575 | float applyCornerRadius(vec2 cropCoords) |
576 | 576 | { |
577 | 577 | vec2 position = cropCoords - cropCenter; |
578 | - // Increase precision here so that a large corner radius doesn't | |
579 | - // cause floating point error | |
580 | - highp vec2 dist = abs(position) + vec2(cornerRadius) - cropCenter; | |
581 | - float plane = length(max(dist, vec2(0.0))); | |
578 | + // Scale down the dist vector here, as otherwise large corner | |
579 | + // radii can cause floating point issues when computing the norm | |
580 | + vec2 dist = (abs(position) - cropCenter + vec2(cornerRadius)) / 16.0; | |
581 | + // Once we've found the norm, then scale back up. | |
582 | + float plane = length(max(dist, vec2(0.0))) * 16.0; | |
582 | 583 | return 1.0 - clamp(plane - cornerRadius, 0.0, 1.0); |
583 | 584 | } |
584 | 585 | )__SHADER__"; |