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

Commit 653aac7a authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "[RenderEngine] Introduce non-linear display color transform." am: efca8f8c am: 80e4479b

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1426642

Change-Id: If4b265313d479520c4221d7bcb728df10f20dd2a
parents d309d9a1 80e4479b
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -52,5 +52,10 @@ bool Description::hasColorMatrix() const {
    return colorMatrix != identity;
}

bool Description::hasDisplayColorMatrix() const {
    const mat4 identity;
    return displayColorMatrix != identity;
}

} // namespace renderengine
} // namespace android
+6 −1
Original line number Diff line number Diff line
@@ -1048,6 +1048,7 @@ status_t GLESRenderEngine::drawLayers(const DisplaySettings& display,

    setOutputDataSpace(display.outputDataspace);
    setDisplayMaxLuminance(display.maxLuminance);
    setDisplayColorTransform(display.colorTransform);

    const mat4 projectionMatrix =
            ui::Transform(display.orientation).asMatrix4() * mState.projectionMatrix;
@@ -1114,7 +1115,7 @@ status_t GLESRenderEngine::drawLayers(const DisplaySettings& display,
        position[3] = vec2(bounds.right, bounds.top);

        setupLayerCropping(*layer, mesh);
        setColorTransform(display.colorTransform * layer->colorTransform);
        setColorTransform(layer->colorTransform);

        bool usePremultipliedAlpha = true;
        bool disableTexture = true;
@@ -1271,6 +1272,10 @@ void GLESRenderEngine::setColorTransform(const mat4& colorTransform) {
    mState.colorMatrix = colorTransform;
}

void GLESRenderEngine::setDisplayColorTransform(const mat4& colorTransform) {
    mState.displayColorMatrix = colorTransform;
}

void GLESRenderEngine::disableTexturing() {
    mState.textureEnabled = false;
}
+1 −0
Original line number Diff line number Diff line
@@ -159,6 +159,7 @@ private:
    void setupLayerTexturing(const Texture& texture);
    void setupFillWithColor(float r, float g, float b, float a);
    void setColorTransform(const mat4& colorTransform);
    void setDisplayColorTransform(const mat4& colorTransform);
    void disableTexturing();
    void disableBlending();
    void setupCornerRadiusCropSize(float width, float height);
+4 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ Program::Program(const ProgramCache::Key& /*needs*/, const char* vertex, const c
        mTextureMatrixLoc = glGetUniformLocation(programId, "texture");
        mSamplerLoc = glGetUniformLocation(programId, "sampler");
        mColorLoc = glGetUniformLocation(programId, "color");
        mDisplayColorMatrixLoc = glGetUniformLocation(programId, "displayColorMatrix");
        mDisplayMaxLuminanceLoc = glGetUniformLocation(programId, "displayMaxLuminance");
        mMaxMasteringLuminanceLoc = glGetUniformLocation(programId, "maxMasteringLuminance");
        mMaxContentLuminanceLoc = glGetUniformLocation(programId, "maxContentLuminance");
@@ -129,6 +130,9 @@ void Program::setUniforms(const Description& desc) {
        const float color[4] = {desc.color.r, desc.color.g, desc.color.b, desc.color.a};
        glUniform4fv(mColorLoc, 1, color);
    }
    if (mDisplayColorMatrixLoc >= 0) {
        glUniformMatrix4fv(mDisplayColorMatrixLoc, 1, GL_FALSE, desc.displayColorMatrix.asArray());
    }
    if (mInputTransformMatrixLoc >= 0) {
        mat4 inputTransformMatrix = desc.inputTransformMatrix;
        glUniformMatrix4fv(mInputTransformMatrixLoc, 1, GL_FALSE, inputTransformMatrix.asArray());
+1 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ private:
    /* location of transform matrix */
    GLint mInputTransformMatrixLoc;
    GLint mOutputTransformMatrixLoc;
    GLint mDisplayColorMatrixLoc;

    /* location of corner radius uniform */
    GLint mCornerRadiusLoc;
Loading