Skip to content

Commit 6ed9e43

Browse files
author
Romain Guy
committed
Skia's ColorMatrix vector is in the 0..255 range not 0..1
Bug #7248980 Change-Id: I9873540e3bc1ea0526ea0884279a427c0de96006
1 parent 54c1a64 commit 6ed9e43

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libs/hwui/SkiaColorFilter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ SkiaColorFilter::~SkiaColorFilter() {
3636

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

0 commit comments

Comments
 (0)