diff options
author | Romain Guy <romainguy@google.com> | 2012-09-27 18:06:43 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2012-09-27 18:06:43 -0700 |
commit | 6ed9e43879039ce0cbead08d304edbce79a88ced (patch) | |
tree | 9593f6dd705c5cbee64fa65c7c4209c39a4b53a0 /libs | |
parent | 54c1a64d5441a964890b44280e4457e11f4f924a (diff) | |
download | frameworks_base-6ed9e43879039ce0cbead08d304edbce79a88ced.zip frameworks_base-6ed9e43879039ce0cbead08d304edbce79a88ced.tar.gz frameworks_base-6ed9e43879039ce0cbead08d304edbce79a88ced.tar.bz2 |
Skia's ColorMatrix vector is in the 0..255 range not 0..1
Bug #7248980
Change-Id: I9873540e3bc1ea0526ea0884279a427c0de96006
Diffstat (limited to 'libs')
-rw-r--r-- | libs/hwui/SkiaColorFilter.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/hwui/SkiaColorFilter.cpp b/libs/hwui/SkiaColorFilter.cpp index f754388..df918be 100644 --- a/libs/hwui/SkiaColorFilter.cpp +++ b/libs/hwui/SkiaColorFilter.cpp @@ -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; } |