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

Commit 7a88a145 authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Android (Google) Code Review
Browse files

Merge "Added native functionality to create a color layer."

parents 2261f1cd 13fdc495
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -43,7 +43,10 @@ status_t LayerDebugInfo::writeToParcel(Parcel* parcel) const {
    RETURN_ON_ERROR(parcel->writeInt32(mHeight));
    RETURN_ON_ERROR(parcel->write(mCrop));
    RETURN_ON_ERROR(parcel->write(mFinalCrop));
    RETURN_ON_ERROR(parcel->writeFloat(mAlpha));
    RETURN_ON_ERROR(parcel->writeFloat(mColor.r));
    RETURN_ON_ERROR(parcel->writeFloat(mColor.g));
    RETURN_ON_ERROR(parcel->writeFloat(mColor.b));
    RETURN_ON_ERROR(parcel->writeFloat(mColor.a));
    RETURN_ON_ERROR(parcel->writeUint32(mFlags));
    RETURN_ON_ERROR(parcel->writeInt32(mPixelFormat));
    RETURN_ON_ERROR(parcel->writeUint32(static_cast<uint32_t>(mDataSpace)));
@@ -79,7 +82,14 @@ status_t LayerDebugInfo::readFromParcel(const Parcel* parcel) {
    RETURN_ON_ERROR(parcel->readInt32(&mHeight));
    RETURN_ON_ERROR(parcel->read(mCrop));
    RETURN_ON_ERROR(parcel->read(mFinalCrop));
    RETURN_ON_ERROR(parcel->readFloat(&mAlpha));
    mColor.r = parcel->readFloat();
    RETURN_ON_ERROR(parcel->errorCheck());
    mColor.g = parcel->readFloat();
    RETURN_ON_ERROR(parcel->errorCheck());
    mColor.b = parcel->readFloat();
    RETURN_ON_ERROR(parcel->errorCheck());
    mColor.a = parcel->readFloat();
    RETURN_ON_ERROR(parcel->errorCheck());
    RETURN_ON_ERROR(parcel->readUint32(&mFlags));
    RETURN_ON_ERROR(parcel->readInt32(&mPixelFormat));
    // \todo [2017-07-25 kraita]: Static casting mDataSpace pointer to an uint32 does work. Better ways?
@@ -116,8 +126,10 @@ std::string to_string(const LayerDebugInfo& info) {
    result.appendFormat("isOpaque=%1d, invalidate=%1d, ", info.mIsOpaque, info.mContentDirty);
    result.appendFormat("dataspace=%s, ", dataspaceDetails(info.mDataSpace).c_str());
    result.appendFormat("pixelformat=%s, ", decodePixelFormat(info.mPixelFormat).c_str());
    result.appendFormat("alpha=%.3f, flags=0x%08x, ",
            static_cast<double>(info.mAlpha), info.mFlags);
    result.appendFormat("color=(%.3f,%.3f,%.3f,%.3f), flags=0x%08x, ",
            static_cast<double>(info.mColor.r), static_cast<double>(info.mColor.g),
            static_cast<double>(info.mColor.b), static_cast<double>(info.mColor.a),
            info.mFlags);
    result.appendFormat("tr=[%.2f, %.2f][%.2f, %.2f]",
            static_cast<double>(info.mMatrix[0][0]), static_cast<double>(info.mMatrix[0][1]),
            static_cast<double>(info.mMatrix[1][0]), static_cast<double>(info.mMatrix[1][1]));
+6 −0
Original line number Diff line number Diff line
@@ -46,6 +46,9 @@ status_t layer_state_t::write(Parcel& output) const
    output.writeStrongBinder(IInterface::asBinder(barrierGbp));
    output.writeStrongBinder(relativeLayerHandle);
    output.writeStrongBinder(parentHandleForChild);
    output.writeFloat(color.r);
    output.writeFloat(color.g);
    output.writeFloat(color.b);
    output.write(transparentRegion);
    return NO_ERROR;
}
@@ -79,6 +82,9 @@ status_t layer_state_t::read(const Parcel& input)
        interface_cast<IGraphicBufferProducer>(input.readStrongBinder());
    relativeLayerHandle = input.readStrongBinder();
    parentHandleForChild = input.readStrongBinder();
    color.r = input.readFloat();
    color.g = input.readFloat();
    color.b = input.readFloat();
    input.read(transparentRegion);
    return NO_ERROR;
}
+17 −0
Original line number Diff line number Diff line
@@ -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);
}
+5 −0
Original line number Diff line number Diff line
@@ -155,6 +155,11 @@ status_t SurfaceControl::setAlpha(float alpha) {
    if (err < 0) return err;
    return mClient->setAlpha(mHandle, alpha);
}
status_t SurfaceControl::setColor(const half3& color) {
    status_t err = validate();
    if (err < 0) return err;
    return mClient->setColor(mHandle, color);
}
status_t SurfaceControl::setMatrix(float dsdx, float dtdx, float dtdy, float dsdy) {
    status_t err = validate();
    if (err < 0) return err;
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ public:
        eCursorWindow = 0x00002000,

        eFXSurfaceNormal = 0x00000000,
        eFXSurfaceDim = 0x00020000,
        eFXSurfaceColor = 0x00020000,
        eFXSurfaceMask = 0x000F0000,
    };

Loading