diff options
author | Byunghun Jeon <bjeon@codeaurora.org> | 2014-12-05 18:28:32 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-11-08 01:07:13 -0800 |
commit | 987034b5633d0eb7fca806acfe00ddbe3305b159 (patch) | |
tree | 9d186252541a857729a9f3920bd8369d4a056e0d /libs/gui | |
parent | b53d92c3eb9319dbf725b3e59b3c52acfa6d77f0 (diff) | |
download | frameworks_native-987034b5633d0eb7fca806acfe00ddbe3305b159.zip frameworks_native-987034b5633d0eb7fca806acfe00ddbe3305b159.tar.gz frameworks_native-987034b5633d0eb7fca806acfe00ddbe3305b159.tar.bz2 |
SurfaceFlinger: Native changes to add blur effect
Native changes to add blur-behind and blur mask effect
Change-Id: I54faf82d750e8299de6d261f6a893ab26d08df84
SurfaceFlinger: Adding template for LayerBlur files
Change-Id: I444009113b7bdd6c5284863fd1f56358e67d9fe6
SurfaceFlinger: Featurize libuiblur module for OSS build
Change-Id: Ifdc176e699434125d17b111c044b8ba954cf717c
Diffstat (limited to 'libs/gui')
-rw-r--r-- | libs/gui/LayerState.cpp | 8 | ||||
-rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 68 | ||||
-rw-r--r-- | libs/gui/SurfaceControl.cpp | 20 |
3 files changed, 96 insertions, 0 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index 00323dc..85452e6 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -32,6 +32,10 @@ status_t layer_state_t::write(Parcel& output) const output.writeUint32(w); output.writeUint32(h); output.writeUint32(layerStack); + output.writeFloat(blur); + output.writeStrongBinder(blurMaskSurface); + output.writeUint32(blurMaskSampling); + output.writeFloat(blurMaskAlphaThreshold); output.writeFloat(alpha); output.writeUint32(flags); output.writeUint32(mask); @@ -52,6 +56,10 @@ status_t layer_state_t::read(const Parcel& input) w = input.readUint32(); h = input.readUint32(); layerStack = input.readUint32(); + blur = input.readFloat(); + blurMaskSurface = input.readStrongBinder(); + blurMaskSampling = input.readUint32(); + blurMaskAlphaThreshold = input.readFloat(); alpha = input.readFloat(); flags = static_cast<uint8_t>(input.readUint32()); mask = static_cast<uint8_t>(input.readUint32()); diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 9955faf..82bdd6b 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -144,6 +144,14 @@ public: uint32_t w, uint32_t h); status_t setLayer(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, uint32_t z); + status_t setBlur(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, + float blur); + status_t setBlurMaskSurface(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, + const sp<IBinder>& maskSurfaceId); + status_t setBlurMaskSampling(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, + uint32_t blurMaskSampling); + status_t setBlurMaskAlphaThreshold(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, + float alpha); status_t setFlags(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, uint32_t flags, uint32_t mask); status_t setTransparentRegionHint( @@ -303,6 +311,50 @@ status_t Composer::setLayer(const sp<SurfaceComposerClient>& client, return NO_ERROR; } +status_t Composer::setBlur(const sp<SurfaceComposerClient>& client, + const sp<IBinder>& id, float blur) { + Mutex::Autolock _l(mLock); + layer_state_t* s = getLayerStateLocked(client, id); + if (!s) + return BAD_INDEX; + s->what |= layer_state_t::eBlurChanged; + s->blur = blur; + return NO_ERROR; +} + +status_t Composer::setBlurMaskSurface(const sp<SurfaceComposerClient>& client, + const sp<IBinder>& id, const sp<IBinder>& maskSurfaceId) { + Mutex::Autolock _l(mLock); + layer_state_t* s = getLayerStateLocked(client, id); + if (!s) + return BAD_INDEX; + s->what |= layer_state_t::eBlurMaskSurfaceChanged; + s->blurMaskSurface = maskSurfaceId; + return NO_ERROR; +} + +status_t Composer::setBlurMaskSampling(const sp<SurfaceComposerClient>& client, + const sp<IBinder>& id, uint32_t blurMaskSampling) { + Mutex::Autolock _l(mLock); + layer_state_t* s = getLayerStateLocked(client, id); + if (!s) + return BAD_INDEX; + s->what |= layer_state_t::eBlurMaskSamplingChanged; + s->blurMaskSampling = blurMaskSampling; + return NO_ERROR; +} + +status_t Composer::setBlurMaskAlphaThreshold(const sp<SurfaceComposerClient>& client, + const sp<IBinder>& id, float alpha) { + Mutex::Autolock _l(mLock); + layer_state_t* s = getLayerStateLocked(client, id); + if (!s) + return BAD_INDEX; + s->what |= layer_state_t::eBlurMaskAlphaThresholdChanged; + s->blurMaskAlphaThreshold = alpha; + return NO_ERROR; +} + status_t Composer::setFlags(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, uint32_t flags, uint32_t mask) { @@ -574,6 +626,22 @@ status_t SurfaceComposerClient::setLayer(const sp<IBinder>& id, uint32_t z) { return getComposer().setLayer(this, id, z); } +status_t SurfaceComposerClient::setBlur(const sp<IBinder>& id, float blur) { + return getComposer().setBlur(this, id, blur); +} + +status_t SurfaceComposerClient::setBlurMaskSurface(const sp<IBinder>& id, const sp<IBinder>& maskSurfaceId) { + return getComposer().setBlurMaskSurface(this, id, maskSurfaceId); +} + +status_t SurfaceComposerClient::setBlurMaskSampling(const sp<IBinder>& id, uint32_t blurMaskSampling) { + return getComposer().setBlurMaskSampling(this, id, blurMaskSampling); +} + +status_t SurfaceComposerClient::setBlurMaskAlphaThreshold(const sp<IBinder>& id, float alpha) { + return getComposer().setBlurMaskAlphaThreshold(this, id, alpha); +} + status_t SurfaceComposerClient::hide(const sp<IBinder>& id) { return getComposer().setFlags(this, id, layer_state_t::eLayerHidden, diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp index 1983027..8212b90 100644 --- a/libs/gui/SurfaceControl.cpp +++ b/libs/gui/SurfaceControl.cpp @@ -99,6 +99,26 @@ status_t SurfaceControl::setLayer(uint32_t layer) { if (err < 0) return err; return mClient->setLayer(mHandle, layer); } +status_t SurfaceControl::setBlur(float blur) { + status_t err = validate(); + if (err < 0) return err; + return mClient->setBlur(mHandle, blur); +} +status_t SurfaceControl::setBlurMaskSurface(const sp<SurfaceControl>& maskSurface) { + status_t err = validate(); + if (err < 0) return err; + return mClient->setBlurMaskSurface(mHandle, maskSurface != 0 ? maskSurface->mHandle : 0); +} +status_t SurfaceControl::setBlurMaskSampling(uint32_t blurMaskSampling) { + status_t err = validate(); + if (err < 0) return err; + return mClient->setBlurMaskSampling(mHandle, blurMaskSampling); +} +status_t SurfaceControl::setBlurMaskAlphaThreshold(float alpha) { + status_t err = validate(); + if (err < 0) return err; + return mClient->setBlurMaskAlphaThreshold(mHandle, alpha); +} status_t SurfaceControl::setPosition(float x, float y) { status_t err = validate(); if (err < 0) return err; |