summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2012-09-04 19:57:40 -0700
committerJason Sams <jsams@google.com>2012-09-04 19:57:40 -0700
commit5729fcdf950eb909b0ab90a49af58731ed8f92cd (patch)
tree4b219767d00ad7670cd4068652c9d3efcd229c39 /graphics
parentc3f6d184bba5e2e0877d2c64a8624ffe07ea537d (diff)
downloadframeworks_base-5729fcdf950eb909b0ab90a49af58731ed8f92cd.zip
frameworks_base-5729fcdf950eb909b0ab90a49af58731ed8f92cd.tar.gz
frameworks_base-5729fcdf950eb909b0ab90a49af58731ed8f92cd.tar.bz2
Add ColorMatrix Intrinsic.
Add better intrinsic testing. Include reference .rs for each intrinsic. Change-Id: I327649f16ac8f641c2bd96f7b16f51874a3e820e
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/renderscript/ScriptIntrinsicColorMatrix.java68
1 files changed, 68 insertions, 0 deletions
diff --git a/graphics/java/android/renderscript/ScriptIntrinsicColorMatrix.java b/graphics/java/android/renderscript/ScriptIntrinsicColorMatrix.java
new file mode 100644
index 0000000..41e7e00
--- /dev/null
+++ b/graphics/java/android/renderscript/ScriptIntrinsicColorMatrix.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.util.Log;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map.Entry;
+import java.util.HashMap;
+
+
+/**
+ * @hide
+ **/
+public class ScriptIntrinsicColorMatrix extends ScriptIntrinsic {
+ private Matrix4f mMatrix = new Matrix4f();
+ private Allocation mInput;
+
+ ScriptIntrinsicColorMatrix(int id, RenderScript rs) {
+ super(id, rs);
+ }
+
+ /**
+ * Supported elements types are float, float4, uchar, uchar4
+ *
+ *
+ * @param rs
+ * @param e
+ *
+ * @return ScriptIntrinsicColorMatrix
+ */
+ public static ScriptIntrinsicColorMatrix create(RenderScript rs, Element e) {
+ int id = rs.nScriptIntrinsicCreate(2, e.getID(rs));
+ return new ScriptIntrinsicColorMatrix(id, rs);
+
+ }
+
+ public void setColorMatrix(Matrix4f m) {
+ mMatrix.load(m);
+ FieldPacker fp = new FieldPacker(16*4);
+ fp.addMatrix(m);
+ setVar(0, fp);
+ }
+
+ public void forEach(Allocation ain, Allocation aout) {
+ forEach(0, ain, aout, null);
+ }
+
+}
+