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

Commit 5e3af5fc authored by Romain Guy's avatar Romain Guy
Browse files

Rescale ColorMatrix' vector to the [0..1] range

Bug #3246354

Change-Id: Idea7a1e6633c71119628315d65315076bc445eb0
parent d4b7b637
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -36,6 +36,11 @@ 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;
    }
}

SkiaColorMatrixFilter::~SkiaColorMatrixFilter() {