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

Commit f73b6868 authored by Romain Guy's avatar Romain Guy Committed by Android Git Automerger
Browse files

am 6b3c7b3a: am d831ecdd: Merge "Fix alpha channel computation with...

am 6b3c7b3a: am d831ecdd: Merge "Fix alpha channel computation with ColorMatrixColorFilter Bug #7222476" into jb-mr1-dev

* commit '6b3c7b3a':
  Fix alpha channel computation with ColorMatrixColorFilter Bug #7222476
parents 9abcaa74 6b3c7b3a
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -1398,8 +1398,8 @@ void OpenGLRenderer::setupDrawBlending(bool blend, SkXfermode::Mode mode, bool s
    // When the blending mode is kClear_Mode, we need to use a modulate color
    // When the blending mode is kClear_Mode, we need to use a modulate color
    // argb=1,0,0,0
    // argb=1,0,0,0
    accountForClear(mode);
    accountForClear(mode);
    chooseBlending(blend || (mColorSet && mColorA < 1.0f) || (mShader && mShader->blend()), mode,
    chooseBlending(blend || (mColorSet && mColorA < 1.0f) || (mShader && mShader->blend()) ||
            mDescription, swapSrcDst);
            (mColorFilter && mColorFilter->blend()), mode, mDescription, swapSrcDst);
}
}


void OpenGLRenderer::setupDrawProgram() {
void OpenGLRenderer::setupDrawProgram() {
+0 −1
Original line number Original line Diff line number Diff line
@@ -347,7 +347,6 @@ const char* gFS_Main_ApplyColorOp[4] = {
        // None
        // None
        "",
        "",
        // Matrix
        // Matrix
        // TODO: Fix premultiplied alpha computations for color matrix
        "    fragColor *= colorMatrix;\n"
        "    fragColor *= colorMatrix;\n"
        "    fragColor += colorMatrixVector;\n"
        "    fragColor += colorMatrixVector;\n"
        "    fragColor.rgb *= fragColor.a;\n",
        "    fragColor.rgb *= fragColor.a;\n",
+11 −8
Original line number Original line Diff line number Diff line
@@ -36,11 +36,8 @@ SkiaColorFilter::~SkiaColorFilter() {


SkiaColorMatrixFilter::SkiaColorMatrixFilter(SkColorFilter* skFilter, float* matrix, float* vector):
SkiaColorMatrixFilter::SkiaColorMatrixFilter(SkColorFilter* skFilter, float* matrix, float* vector):
        SkiaColorFilter(skFilter, kColorMatrix, true), mMatrix(matrix), mVector(vector) {
        SkiaColorFilter(skFilter, kColorMatrix, true), mMatrix(matrix), mVector(vector) {
    // Skia uses the range [0..255] for the addition vector, but we need
    // TODO: We should be smarter about this
    // the [0..1] range to apply the vector in GLSL
    mBlend = true;
    for (int i = 0; i < 4; i++) {
        mVector[i] /= 255.0f;
    }
}
}


SkiaColorMatrixFilter::~SkiaColorMatrixFilter() {
SkiaColorMatrixFilter::~SkiaColorMatrixFilter() {
@@ -71,6 +68,9 @@ SkiaLightingFilter::SkiaLightingFilter(SkColorFilter *skFilter, int multiply, in
    mAddR = ((add >> 16) & 0xFF) / 255.0f;
    mAddR = ((add >> 16) & 0xFF) / 255.0f;
    mAddG = ((add >>  8) & 0xFF) / 255.0f;
    mAddG = ((add >>  8) & 0xFF) / 255.0f;
    mAddB = ((add      ) & 0xFF) / 255.0f;
    mAddB = ((add      ) & 0xFF) / 255.0f;

    // A lighting filter always ignores alpha
    mBlend = false;
}
}


void SkiaLightingFilter::describe(ProgramDescription& description, const Extensions& extensions) {
void SkiaLightingFilter::describe(ProgramDescription& description, const Extensions& extensions) {
@@ -93,6 +93,9 @@ SkiaBlendFilter::SkiaBlendFilter(SkColorFilter *skFilter, int color, SkXfermode:
    mR = mA * ((color >> 16) & 0xFF) / 255.0f;
    mR = mA * ((color >> 16) & 0xFF) / 255.0f;
    mG = mA * ((color >>  8) & 0xFF) / 255.0f;
    mG = mA * ((color >>  8) & 0xFF) / 255.0f;
    mB = mA * ((color      ) & 0xFF) / 255.0f;
    mB = mA * ((color      ) & 0xFF) / 255.0f;

    // TODO: We should do something smarter here
    mBlend = true;
}
}


void SkiaBlendFilter::describe(ProgramDescription& description, const Extensions& extensions) {
void SkiaBlendFilter::describe(ProgramDescription& description, const Extensions& extensions) {