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

Commit 6ed9e438 authored by Romain Guy's avatar Romain Guy
Browse files

Skia's ColorMatrix vector is in the 0..255 range not 0..1

Bug #7248980

Change-Id: I9873540e3bc1ea0526ea0884279a427c0de96006
parent 54c1a64d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -36,6 +36,12 @@ SkiaColorFilter::~SkiaColorFilter() {

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

    // TODO: We should be smarter about this
    mBlend = true;
}