-
Notifications
You must be signed in to change notification settings - Fork 24.2k
Commit
…ible Summary: Cards which are not visible because another card is occluding them are still being rendered by Android resulting in overdraw. This results in wasted GPU time because some pixels are drawn multiple times. This change reduces overdraw by changing the opacity of occluded cards to 0. This bug was found using the tools described in Android's overdraw docs: https://developer.android.com/topic/performance/rendering/overdraw.html **Test plan (required)** This change is being used in my team's app. Adam Comella Microsoft Corp. Closes #10908 Differential Revision: D4175758 Pulled By: ericvicenti fbshipit-source-id: 4bfac7df16d2a7ea67db977659237a9aa6598f87
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,21 +87,21 @@ function forHorizontal(props: NavigationSceneRendererProps): Object { | |
} | ||
|
||
const index = scene.index; | ||
const inputRange = [index - 1, index, index + 1]; | ||
const inputRange = [index - 1, index, index + 0.99, index + 1]; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ptomasroos
Contributor
|
||
const width = layout.initWidth; | ||
const outputRange = I18nManager.isRTL ? | ||
([-width, 0, 10]: Array<number>) : | ||
([width, 0, -10]: Array<number>); | ||
([-width, 0, 10, 10]: Array<number>) : | ||
([width, 0, -10, -10]: Array<number>); | ||
|
||
|
||
const opacity = position.interpolate({ | ||
inputRange, | ||
outputRange: ([1, 1, 0.3]: Array<number>), | ||
outputRange: ([1, 1, 0.3, 0]: Array<number>), | ||
}); | ||
|
||
const scale = position.interpolate({ | ||
inputRange, | ||
outputRange: ([1, 1, 0.95]: Array<number>), | ||
outputRange: ([1, 1, 0.95, 0.95]: Array<number>), | ||
}); | ||
|
||
const translateY = 0; | ||
|
@@ -132,23 +132,23 @@ function forVertical(props: NavigationSceneRendererProps): Object { | |
} | ||
|
||
const index = scene.index; | ||
const inputRange = [index - 1, index, index + 1]; | ||
const inputRange = [index - 1, index, index + 0.99, index + 1]; | ||
const height = layout.initHeight; | ||
|
||
const opacity = position.interpolate({ | ||
inputRange, | ||
outputRange: ([1, 1, 0.3]: Array<number>), | ||
outputRange: ([1, 1, 0.3, 0]: Array<number>), | ||
}); | ||
|
||
const scale = position.interpolate({ | ||
inputRange, | ||
outputRange: ([1, 1, 0.95]: Array<number>), | ||
outputRange: ([1, 1, 0.95, 0.95]: Array<number>), | ||
}); | ||
|
||
const translateX = 0; | ||
const translateY = position.interpolate({ | ||
inputRange, | ||
outputRange: ([height, 0, -10]: Array<number>), | ||
outputRange: ([height, 0, -10, -10]: Array<number>), | ||
}); | ||
|
||
return { | ||
|
May I ask what index + 0.99 actually target? I've been trying to wrap my head around this :) Since i haven't really seen a float within the scene's array / range @rigdern