summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/renderscript/Allocation.java11
-rw-r--r--graphics/java/android/renderscript/Element.java26
2 files changed, 29 insertions, 8 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index 4b8c58e..9ac1a00 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -99,6 +99,14 @@ public class Allocation extends BaseObj {
*/
public static final int USAGE_GRAPHICS_CONSTANTS = 0x0008;
+ /**
+ * @hide
+ * USAGE_GRAPHICS_RENDER_TARGET The allcation will be used as a
+ * target for offscreen rendering
+ *
+ */
+ public static final int USAGE_GRAPHICS_RENDER_TARGET = 0x0010;
+
/**
* Controls mipmap behavior when using the bitmap creation and
@@ -137,7 +145,8 @@ public class Allocation extends BaseObj {
if ((usage & ~(USAGE_SCRIPT |
USAGE_GRAPHICS_TEXTURE |
USAGE_GRAPHICS_VERTEX |
- USAGE_GRAPHICS_CONSTANTS)) != 0) {
+ USAGE_GRAPHICS_CONSTANTS |
+ USAGE_GRAPHICS_RENDER_TARGET)) != 0) {
throw new RSIllegalArgumentException("Unknown usage specified.");
}
mType = t;
diff --git a/graphics/java/android/renderscript/Element.java b/graphics/java/android/renderscript/Element.java
index fae22f0..0c1ad2a 100644
--- a/graphics/java/android/renderscript/Element.java
+++ b/graphics/java/android/renderscript/Element.java
@@ -124,7 +124,8 @@ public class Element extends BaseObj {
PIXEL_A (8),
PIXEL_LA (9),
PIXEL_RGB (10),
- PIXEL_RGBA (11);
+ PIXEL_RGBA (11),
+ PIXEL_DEPTH (12);
int mID;
DataKind(int id) {
@@ -536,10 +537,12 @@ public class Element extends BaseObj {
dk == DataKind.PIXEL_A ||
dk == DataKind.PIXEL_LA ||
dk == DataKind.PIXEL_RGB ||
- dk == DataKind.PIXEL_RGBA)) {
+ dk == DataKind.PIXEL_RGBA ||
+ dk == DataKind.PIXEL_DEPTH)) {
throw new RSIllegalArgumentException("Unsupported DataKind");
}
if (!(dt == DataType.UNSIGNED_8 ||
+ dt == DataType.UNSIGNED_16 ||
dt == DataType.UNSIGNED_5_6_5 ||
dt == DataType.UNSIGNED_4_4_4_4 ||
dt == DataType.UNSIGNED_5_5_5_1)) {
@@ -554,16 +557,25 @@ public class Element extends BaseObj {
if (dt == DataType.UNSIGNED_4_4_4_4 && dk != DataKind.PIXEL_RGBA) {
throw new RSIllegalArgumentException("Bad kind and type combo");
}
+ if (dt == DataType.UNSIGNED_16 &&
+ dk != DataKind.PIXEL_DEPTH) {
+ throw new RSIllegalArgumentException("Bad kind and type combo");
+ }
int size = 1;
- if (dk == DataKind.PIXEL_LA) {
+ switch (dk) {
+ case PIXEL_LA:
size = 2;
- }
- if (dk == DataKind.PIXEL_RGB) {
+ break;
+ case PIXEL_RGB:
size = 3;
- }
- if (dk == DataKind.PIXEL_RGBA) {
+ break;
+ case PIXEL_RGBA:
size = 4;
+ break;
+ case PIXEL_DEPTH:
+ size = 2;
+ break;
}
boolean norm = true;