react-native/React
Nick Lockwood 7341706884 Disable background color propagation for everything except text nodes
Summary:
public
Blending semitransparent pixels against their background is fairly a fairly expensive operation on mobile GPUs. To reduce blending, React Native has a system called "background color propagation", where the background color of parent views is automatically inherited by child views unless explicitly overridden. This means that translucent pixels can be blended directly against a known background color, avoiding the need to do this dynamically on the GPU.

In practice, this is only useful for views that do their own drawing, which is basically just `<Image/>` and `<Text/>` components, and for image components it only really matters when the image has an alpha component.

The automatic background propagation is a bit of a hack, and often does the wrong thing - for example if a view overflows its bounds, or if it overlaps a sibling, the background color will often be incorrect and need to be manually disabled. Because the only place that it provides a significant performance benefit is for text, this diff disables the behavior for everything except `<Text/>` nodes. It might still be useful for `<Image/>` nodes too, but looking through the examples in UIExplorer, the number of places where it does the wrong thing for images outnumbers the cases where it provides significant reduction in blending.

Note that this diff does not prevent you from eliminating blending on image components by manually setting an opaque background color, nor does it stop you from disabling color propagation on text components by manually setting a transparent background.

Reviewed By: javache

Differential Revision: D2811031

fb-gh-sync-id: 2eb08918c9031c582a3dd2d40e04b27a663dac82
2016-01-08 03:38:31 -08:00
..
Base Fix extra native modules missing bridge after reload 2016-01-07 12:03:28 -08:00
Executors Add context executor API for sync hooks 2016-01-05 08:00:38 -08:00
Layout updated css-layout and fixed callsites 2015-12-21 10:18:41 -08:00
Modules Remove Hot Loading option from Dev Menu 2016-01-06 22:37:32 -08:00
Profiler Update createView C function on profiler 2016-01-07 12:03:38 -08:00
React.xcodeproj Refactor hot loading implementation on iOS 2016-01-04 10:40:32 -08:00
Views Disable background color propagation for everything except text nodes 2016-01-08 03:38:31 -08:00