Loading libs/gui/LayerState.cpp +9 −11 Original line number Diff line number Diff line Loading @@ -98,8 +98,8 @@ status_t layer_state_t::write(Parcel& output) const output.writeInt32(cachedBuffer.bufferId); output.writeParcelable(metadata); output.writeFloat(colorAlpha); output.writeUint32(static_cast<uint32_t>(colorDataspace)); output.writeFloat(bgColorAlpha); output.writeUint32(static_cast<uint32_t>(bgColorDataspace)); return NO_ERROR; } Loading Loading @@ -175,8 +175,8 @@ status_t layer_state_t::read(const Parcel& input) cachedBuffer.bufferId = input.readInt32(); input.readParcelable(&metadata); colorAlpha = input.readFloat(); colorDataspace = static_cast<ui::Dataspace>(input.readUint32()); bgColorAlpha = input.readFloat(); bgColorDataspace = static_cast<ui::Dataspace>(input.readUint32()); return NO_ERROR; } Loading Loading @@ -390,13 +390,11 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eCachedBufferChanged; cachedBuffer = other.cachedBuffer; } if (other.what & eColorAlphaChanged) { what |= eColorAlphaChanged; colorAlpha = other.colorAlpha; } if (other.what & eColorDataspaceChanged) { what |= eColorDataspaceChanged; colorDataspace = other.colorDataspace; if (other.what & eBackgroundColorChanged) { what |= eBackgroundColorChanged; color = other.color; bgColorAlpha = other.bgColorAlpha; bgColorDataspace = other.bgColorDataspace; } if (other.what & eMetadataChanged) { what |= eMetadataChanged; Loading libs/gui/SurfaceComposerClient.cpp +6 −19 Original line number Diff line number Diff line Loading @@ -678,31 +678,18 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setColor return *this; } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setColorAlpha( const sp<SurfaceControl>& sc, float alpha) { layer_state_t* s = getLayerState(sc); if (!s) { mStatus = BAD_INDEX; return *this; } s->what |= layer_state_t::eColorAlphaChanged; s->colorAlpha = alpha; registerSurfaceControlForCallback(sc); return *this; } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setColorDataspace( const sp<SurfaceControl>& sc, ui::Dataspace dataspace) { SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setBackgroundColor( const sp<SurfaceControl>& sc, const half3& color, float alpha, ui::Dataspace dataspace) { layer_state_t* s = getLayerState(sc); if (!s) { mStatus = BAD_INDEX; return *this; } s->what |= layer_state_t::eColorDataspaceChanged; s->colorDataspace = dataspace; s->what |= layer_state_t::eBackgroundColorChanged; s->color = color; s->bgColorAlpha = alpha; s->bgColorDataspace = dataspace; registerSurfaceControlForCallback(sc); return *this; Loading libs/gui/include/gui/LayerState.h +9 −8 Original line number Diff line number Diff line Loading @@ -86,9 +86,8 @@ struct layer_state_t { eCornerRadiusChanged = 0x80000000, eFrameChanged = 0x1'00000000, eCachedBufferChanged = 0x2'00000000, eColorAlphaChanged = 0x4'00000000, eColorDataspaceChanged = 0x8'00000000, eMetadataChanged = 0x10'00000000, eBackgroundColorChanged = 0x4'00000000, eMetadataChanged = 0x8'00000000, }; layer_state_t() Loading @@ -115,8 +114,8 @@ struct layer_state_t { surfaceDamageRegion(), api(-1), colorTransform(mat4()), colorAlpha(0), colorDataspace(ui::Dataspace::UNKNOWN) { bgColorAlpha(0), bgColorDataspace(ui::Dataspace::UNKNOWN) { matrix.dsdx = matrix.dtdy = 1.0f; matrix.dsdy = matrix.dtdx = 0.0f; hdrMetadata.validTypes = 0; Loading Loading @@ -187,10 +186,12 @@ struct layer_state_t { cached_buffer_t cachedBuffer; float colorAlpha; ui::Dataspace colorDataspace; LayerMetadata metadata; // The following refer to the alpha, and dataspace, respectively of // the background color layer float bgColorAlpha; ui::Dataspace bgColorDataspace; }; struct ComposerState { Loading libs/gui/include/gui/SurfaceComposerClient.h +3 −5 Original line number Diff line number Diff line Loading @@ -330,11 +330,9 @@ public: Transaction& setColor(const sp<SurfaceControl>& sc, const half3& color); // Sets the alpha of the background color layer if it exists. Transaction& setColorAlpha(const sp<SurfaceControl>& sc, float alpha); // Sets the dataspace of the background color layer if it exists. Transaction& setColorDataspace(const sp<SurfaceControl>& sc, ui::Dataspace dataspace); // Sets the background color of a layer with the specified color, alpha, and dataspace Transaction& setBackgroundColor(const sp<SurfaceControl>& sc, const half3& color, float alpha, ui::Dataspace dataspace); Transaction& setTransform(const sp<SurfaceControl>& sc, uint32_t transform); Transaction& setTransformToDisplayInverse(const sp<SurfaceControl>& sc, Loading services/surfaceflinger/BufferStateLayer.cpp +0 −42 Original line number Diff line number Diff line Loading @@ -303,48 +303,6 @@ bool BufferStateLayer::setTransparentRegionHint(const Region& transparent) { return true; } bool BufferStateLayer::setColor(const half3& color) { // create color layer if one does not yet exist if (!mCurrentState.bgColorLayer) { uint32_t flags = ISurfaceComposerClient::eFXSurfaceColor; const String8& name = mName + "BackgroundColorLayer"; mCurrentState.bgColorLayer = new ColorLayer(LayerCreationArgs(mFlinger.get(), nullptr, name, 0, 0, flags)); // add to child list addChild(mCurrentState.bgColorLayer); mFlinger->mLayersAdded = true; // set up SF to handle added color layer if (isRemovedFromCurrentState()) { mCurrentState.bgColorLayer->onRemovedFromCurrentState(); } mFlinger->setTransactionFlags(eTransactionNeeded); } mCurrentState.bgColorLayer->setColor(color); mCurrentState.bgColorLayer->setLayer(std::numeric_limits<int32_t>::min()); return true; } bool BufferStateLayer::setColorAlpha(float alpha) { if (!mCurrentState.bgColorLayer) { ALOGE("Attempting to set color alpha on a buffer state layer with no background color"); return false; } mCurrentState.bgColorLayer->setAlpha(alpha); return true; } bool BufferStateLayer::setColorDataspace(ui::Dataspace dataspace) { if (!mCurrentState.bgColorLayer) { ALOGE("Attempting to set color dataspace on a buffer state layer with no background color"); return false; } mCurrentState.bgColorLayer->setDataspace(dataspace); return true; } Rect BufferStateLayer::getBufferSize(const State& s) const { // for buffer state layers we use the display frame size as the buffer size. if (getActiveWidth(s) < UINT32_MAX && getActiveHeight(s) < UINT32_MAX) { Loading Loading
libs/gui/LayerState.cpp +9 −11 Original line number Diff line number Diff line Loading @@ -98,8 +98,8 @@ status_t layer_state_t::write(Parcel& output) const output.writeInt32(cachedBuffer.bufferId); output.writeParcelable(metadata); output.writeFloat(colorAlpha); output.writeUint32(static_cast<uint32_t>(colorDataspace)); output.writeFloat(bgColorAlpha); output.writeUint32(static_cast<uint32_t>(bgColorDataspace)); return NO_ERROR; } Loading Loading @@ -175,8 +175,8 @@ status_t layer_state_t::read(const Parcel& input) cachedBuffer.bufferId = input.readInt32(); input.readParcelable(&metadata); colorAlpha = input.readFloat(); colorDataspace = static_cast<ui::Dataspace>(input.readUint32()); bgColorAlpha = input.readFloat(); bgColorDataspace = static_cast<ui::Dataspace>(input.readUint32()); return NO_ERROR; } Loading Loading @@ -390,13 +390,11 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eCachedBufferChanged; cachedBuffer = other.cachedBuffer; } if (other.what & eColorAlphaChanged) { what |= eColorAlphaChanged; colorAlpha = other.colorAlpha; } if (other.what & eColorDataspaceChanged) { what |= eColorDataspaceChanged; colorDataspace = other.colorDataspace; if (other.what & eBackgroundColorChanged) { what |= eBackgroundColorChanged; color = other.color; bgColorAlpha = other.bgColorAlpha; bgColorDataspace = other.bgColorDataspace; } if (other.what & eMetadataChanged) { what |= eMetadataChanged; Loading
libs/gui/SurfaceComposerClient.cpp +6 −19 Original line number Diff line number Diff line Loading @@ -678,31 +678,18 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setColor return *this; } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setColorAlpha( const sp<SurfaceControl>& sc, float alpha) { layer_state_t* s = getLayerState(sc); if (!s) { mStatus = BAD_INDEX; return *this; } s->what |= layer_state_t::eColorAlphaChanged; s->colorAlpha = alpha; registerSurfaceControlForCallback(sc); return *this; } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setColorDataspace( const sp<SurfaceControl>& sc, ui::Dataspace dataspace) { SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setBackgroundColor( const sp<SurfaceControl>& sc, const half3& color, float alpha, ui::Dataspace dataspace) { layer_state_t* s = getLayerState(sc); if (!s) { mStatus = BAD_INDEX; return *this; } s->what |= layer_state_t::eColorDataspaceChanged; s->colorDataspace = dataspace; s->what |= layer_state_t::eBackgroundColorChanged; s->color = color; s->bgColorAlpha = alpha; s->bgColorDataspace = dataspace; registerSurfaceControlForCallback(sc); return *this; Loading
libs/gui/include/gui/LayerState.h +9 −8 Original line number Diff line number Diff line Loading @@ -86,9 +86,8 @@ struct layer_state_t { eCornerRadiusChanged = 0x80000000, eFrameChanged = 0x1'00000000, eCachedBufferChanged = 0x2'00000000, eColorAlphaChanged = 0x4'00000000, eColorDataspaceChanged = 0x8'00000000, eMetadataChanged = 0x10'00000000, eBackgroundColorChanged = 0x4'00000000, eMetadataChanged = 0x8'00000000, }; layer_state_t() Loading @@ -115,8 +114,8 @@ struct layer_state_t { surfaceDamageRegion(), api(-1), colorTransform(mat4()), colorAlpha(0), colorDataspace(ui::Dataspace::UNKNOWN) { bgColorAlpha(0), bgColorDataspace(ui::Dataspace::UNKNOWN) { matrix.dsdx = matrix.dtdy = 1.0f; matrix.dsdy = matrix.dtdx = 0.0f; hdrMetadata.validTypes = 0; Loading Loading @@ -187,10 +186,12 @@ struct layer_state_t { cached_buffer_t cachedBuffer; float colorAlpha; ui::Dataspace colorDataspace; LayerMetadata metadata; // The following refer to the alpha, and dataspace, respectively of // the background color layer float bgColorAlpha; ui::Dataspace bgColorDataspace; }; struct ComposerState { Loading
libs/gui/include/gui/SurfaceComposerClient.h +3 −5 Original line number Diff line number Diff line Loading @@ -330,11 +330,9 @@ public: Transaction& setColor(const sp<SurfaceControl>& sc, const half3& color); // Sets the alpha of the background color layer if it exists. Transaction& setColorAlpha(const sp<SurfaceControl>& sc, float alpha); // Sets the dataspace of the background color layer if it exists. Transaction& setColorDataspace(const sp<SurfaceControl>& sc, ui::Dataspace dataspace); // Sets the background color of a layer with the specified color, alpha, and dataspace Transaction& setBackgroundColor(const sp<SurfaceControl>& sc, const half3& color, float alpha, ui::Dataspace dataspace); Transaction& setTransform(const sp<SurfaceControl>& sc, uint32_t transform); Transaction& setTransformToDisplayInverse(const sp<SurfaceControl>& sc, Loading
services/surfaceflinger/BufferStateLayer.cpp +0 −42 Original line number Diff line number Diff line Loading @@ -303,48 +303,6 @@ bool BufferStateLayer::setTransparentRegionHint(const Region& transparent) { return true; } bool BufferStateLayer::setColor(const half3& color) { // create color layer if one does not yet exist if (!mCurrentState.bgColorLayer) { uint32_t flags = ISurfaceComposerClient::eFXSurfaceColor; const String8& name = mName + "BackgroundColorLayer"; mCurrentState.bgColorLayer = new ColorLayer(LayerCreationArgs(mFlinger.get(), nullptr, name, 0, 0, flags)); // add to child list addChild(mCurrentState.bgColorLayer); mFlinger->mLayersAdded = true; // set up SF to handle added color layer if (isRemovedFromCurrentState()) { mCurrentState.bgColorLayer->onRemovedFromCurrentState(); } mFlinger->setTransactionFlags(eTransactionNeeded); } mCurrentState.bgColorLayer->setColor(color); mCurrentState.bgColorLayer->setLayer(std::numeric_limits<int32_t>::min()); return true; } bool BufferStateLayer::setColorAlpha(float alpha) { if (!mCurrentState.bgColorLayer) { ALOGE("Attempting to set color alpha on a buffer state layer with no background color"); return false; } mCurrentState.bgColorLayer->setAlpha(alpha); return true; } bool BufferStateLayer::setColorDataspace(ui::Dataspace dataspace) { if (!mCurrentState.bgColorLayer) { ALOGE("Attempting to set color dataspace on a buffer state layer with no background color"); return false; } mCurrentState.bgColorLayer->setDataspace(dataspace); return true; } Rect BufferStateLayer::getBufferSize(const State& s) const { // for buffer state layers we use the display frame size as the buffer size. if (getActiveWidth(s) < UINT32_MAX && getActiveHeight(s) < UINT32_MAX) { Loading