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

Commit efca8f8c authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "[RenderEngine] Introduce non-linear display color transform."

parents b40b64d0 ba2f0bc3
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -52,5 +52,10 @@ bool Description::hasColorMatrix() const {
    return colorMatrix != identity;
    return colorMatrix != identity;
}
}


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

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


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


    const mat4 projectionMatrix =
    const mat4 projectionMatrix =
            ui::Transform(display.orientation).asMatrix4() * mState.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);
        position[3] = vec2(bounds.right, bounds.top);


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


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


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

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


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