Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93a3eb7f authored by Vishnu Nair's avatar Vishnu Nair Committed by Android (Google) Code Review
Browse files

Merge changes from topic "bye-container-layer"

* changes:
  Remove container layer
  SF: Replace container layers with effect layers
parents 587d4c1f b21272e8
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -145,7 +145,6 @@ filegroup {
        "ClientCache.cpp",
        "Client.cpp",
        "EffectLayer.cpp",
        "ContainerLayer.cpp",
        "DisplayDevice.cpp",
        "DisplayHardware/AidlComposerHal.cpp",
        "DisplayHardware/HidlComposerHal.cpp",
+0 −47
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion"

// #define LOG_NDEBUG 0
#undef LOG_TAG
#define LOG_TAG "ContainerLayer"

#include "ContainerLayer.h"

namespace android {

ContainerLayer::ContainerLayer(const LayerCreationArgs& args) : Layer(args) {}

ContainerLayer::~ContainerLayer() = default;

bool ContainerLayer::isVisible() const {
    return false;
}

sp<Layer> ContainerLayer::createClone() {
    sp<ContainerLayer> layer = mFlinger->getFactory().createContainerLayer(
            LayerCreationArgs(mFlinger.get(), nullptr, mName + " (Mirror)", 0, LayerMetadata()));
    layer->setInitialValuesForClone(this);
    return layer;
}

} // namespace android

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion"
+0 −41
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#pragma once

#include <sys/types.h>

#include <cstdint>

#include "Layer.h"

namespace android {

class ContainerLayer : public Layer {
public:
    explicit ContainerLayer(const LayerCreationArgs&);
    ~ContainerLayer() override;

    const char* getType() const override { return "ContainerLayer"; }
    bool isVisible() const override;

    bool isCreatedFromMainThread() const override { return true; }

protected:
    bool canDrawShadows() const override { return false; }
    sp<Layer> createClone() override;
};

} // namespace android
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ std::vector<compositionengine::LayerFE::LayerSettings> EffectLayer::prepareClien
}

bool EffectLayer::isVisible() const {
    return !isHiddenByPolicy() && (getAlpha() > 0.0_hf || hasBlur()) && hasSomethingToDraw();
    return hasSomethingToDraw() && !isHiddenByPolicy() && (getAlpha() > 0.0_hf || hasBlur());
}

bool EffectLayer::setColor(const half3& color) {
+4 −1
Original line number Diff line number Diff line
@@ -1945,8 +1945,11 @@ half4 Layer::getColor() const {
}

int32_t Layer::getBackgroundBlurRadius() const {
    const auto& p = mDrawingParent.promote();
    if (getDrawingState().backgroundBlurRadius == 0) {
        return 0;
    }

    const auto& p = mDrawingParent.promote();
    half parentAlpha = (p != nullptr) ? p->getAlpha() : 1.0_hf;
    return parentAlpha * getDrawingState().backgroundBlurRadius;
}
Loading