summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorOlivier Goutet <olivier.goutet@gmail.com>2009-11-05 14:48:03 +0100
committerOlivier Goutet <olivier.goutet@gmail.com>2009-11-05 14:48:03 +0100
commit83387a484c515e5234bd60f741578a6ac894bff5 (patch)
treeb0e9a950ca872ab67766b3831a4858aafbdc9855 /graphics
parent0b95a572a04073ba85dd860caf8fe724d807358d (diff)
downloadframeworks_base-83387a484c515e5234bd60f741578a6ac894bff5.zip
frameworks_base-83387a484c515e5234bd60f741578a6ac894bff5.tar.gz
frameworks_base-83387a484c515e5234bd60f741578a6ac894bff5.tar.bz2
Correction of an error in the setRotate method of the ColorMatrix class.
The matrix rotation params around the 2nd axis was not set correctly: Initial matrix for axis 2 (green): cos 0 sin 0 0 0 1 0 0 0 -sin 0 0 0 0 0 0 cos 1 0 After correction: cos 0 -sin 0 0 0 1 0 0 0 sin 0 cos 0 0 0 0 0 1 0
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/ColorMatrix.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/graphics/java/android/graphics/ColorMatrix.java b/graphics/java/android/graphics/ColorMatrix.java
index 2478712..c22cda1 100644
--- a/graphics/java/android/graphics/ColorMatrix.java
+++ b/graphics/java/android/graphics/ColorMatrix.java
@@ -110,22 +110,31 @@ public class ColorMatrix {
a[18] = aScale;
}
+ /**
+ * Set the rotation on a color axis by the specified values.
+ * axis=0 correspond to a rotation around the RED color
+ * axis=1 correspond to a rotation around the GREEN color
+ * axis=2 correspond to a rotation around the BLUE color
+ */
public void setRotate(int axis, float degrees) {
reset();
float radians = degrees * (float)Math.PI / 180;
float cosine = FloatMath.cos(radians);
float sine = FloatMath.sin(radians);
switch (axis) {
+ // Rotation around the red color
case 0:
mArray[6] = mArray[12] = cosine;
mArray[7] = sine;
mArray[11] = -sine;
break;
+ // Rotation around the green color
case 1:
- mArray[0] = mArray[17] = cosine;
- mArray[2] = sine;
- mArray[15] = -sine;
+ mArray[0] = mArray[12] = cosine;
+ mArray[2] = -sine;
+ mArray[10] = sine;
break;
+ // Rotation around the blue color
case 2:
mArray[0] = mArray[6] = cosine;
mArray[1] = sine;