diff options
author | 2017-06-27 12:40:18 -0700 | |
---|---|---|
committer | 2017-09-21 18:10:21 -0700 | |
commit | 13fdc49516d17f41e64e62e73c313b0928bf13cc (patch) | |
tree | 556fefa10d7612c1577cacf0d954715829b791a2 /libs/gui/SurfaceComposerClient.cpp | |
parent | dda5d5d7914297adb42e251e8aadaece4dc3e65a (diff) |
Added native functionality to create a color layer.
Added a new layer that can draw a specified color and specified
alpha. This will replace creating a dim layer and allow any colors,
not just black, to be set for this layer.
Test: Added tests to Transaction_test.cpp to test with a color
and a color layer with alpha.
Change-Id: I00a38d1bbc01093026f088c3347454281bdc2b8c
Diffstat (limited to 'libs/gui/SurfaceComposerClient.cpp')
-rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index be7b1d2f6a..c5a4389ae8 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -158,6 +158,8 @@ public: const Region& transparentRegion); status_t setAlpha(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, float alpha); + status_t setColor(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, + const half3& color); status_t setMatrix(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, float dsdx, float dtdx, float dtdy, float dsdy); status_t setOrientation(int orientation); @@ -402,6 +404,17 @@ status_t Composer::setAlpha(const sp<SurfaceComposerClient>& client, return NO_ERROR; } +status_t Composer::setColor(const sp<SurfaceComposerClient>& client, + const sp<IBinder>& id, const half3& color) { + Mutex::Autolock _l(mLock); + layer_state_t* s = getLayerStateLocked(client, id); + if (!s) + return BAD_INDEX; + s->what |= layer_state_t::eColorChanged; + s->color = color; + return NO_ERROR; +} + status_t Composer::setLayerStack(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, uint32_t layerStack) { Mutex::Autolock _l(mLock); @@ -822,6 +835,10 @@ status_t SurfaceComposerClient::setAlpha(const sp<IBinder>& id, float alpha) { return getComposer().setAlpha(this, id, alpha); } +status_t SurfaceComposerClient::setColor(const sp<IBinder>& id, const half3& color) { + return getComposer().setColor(this, id, color); +} + status_t SurfaceComposerClient::setLayerStack(const sp<IBinder>& id, uint32_t layerStack) { return getComposer().setLayerStack(this, id, layerStack); } |