diff options
| author | 2020-12-14 16:49:38 +0800 | |
|---|---|---|
| committer | 2020-12-18 02:51:49 +0000 | |
| commit | de09f10aa504fd8066370591a00c9ff1cafbb7fa (patch) | |
| tree | 7bf8b1030e8e2522ec9779ae173e8967e66cc643 /services/surfaceflinger/RegionSamplingThread.cpp | |
| parent | adf390d7a03cb7cb0a1141f54e6efa1674eb6359 (diff) | |
Fix the order of applying layer alpha and color matrices in GLESRenderEngine
If the system want to do a color inversion,
there is an unexpected result due to applying the layer alpha first.
Solution: RenderEngine should apply
the layer's alpha after multiplying by the color matrix.
For example, given the following color inversion matrix:
| r.r r.g r.b | | -1.0 0.0 0.0 |
| g.r g.g g.b | = | 0.0 -1.0 0.0 |
| b.r b.g b.b | | 0.0 0.0 -1.0 |
| Tr Tg Tb | | 1.0 1.0 1.0 |
We want to get a black layer when applying the color transform to a white layer;
However, the white layer applies layer alpha before color matrix. We can get
the below calculation: When layer alpha is 0, R_out value was always Tr.
Then we do not get a black layer when the system applies color inversion to a
white layer.
R_out = (R_in * layer_alpha) * r.r + Tr
Therefore we apply the color matrix first, so we can get the below calculation.
When the layer alpha is 0, we can get a black layer.
R_out = (R_in * r.r + Tr) * layer_alpha
= (R_in * r.r * layer_alpha) + (Tr * layer_alpha)
adds RenderEngineTest::fillBufferColorTransformZeroLayerAlpha
Bug: 157204341
Test: color inversion when switching pages in the Setting app
Test: RenderEngineTest
Change-Id: I206184aae84042290b00e411709e04e54579780a
Merged-In: I206184aae84042290b00e411709e04e54579780a
Diffstat (limited to 'services/surfaceflinger/RegionSamplingThread.cpp')
0 files changed, 0 insertions, 0 deletions