summaryrefslogtreecommitdiffstats
path: root/graphics/java
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2012-03-28 15:30:07 -0700
committerJason Sams <jsams@google.com>2012-03-28 15:30:07 -0700
commitfb9aa9f3ef11878caaf6fcfb5ea49ffb9f7abf33 (patch)
tree385317786534f5f286a5e565017a3d6d507f0b3c /graphics/java
parent972ed5809c518ecaaca58723e85282e58c12758c (diff)
downloadframeworks_base-fb9aa9f3ef11878caaf6fcfb5ea49ffb9f7abf33.zip
frameworks_base-fb9aa9f3ef11878caaf6fcfb5ea49ffb9f7abf33.tar.gz
frameworks_base-fb9aa9f3ef11878caaf6fcfb5ea49ffb9f7abf33.tar.bz2
Convert from SurfaceTexture to Surface
Change-Id: I2ad4307294d4144999ca0c12ac19849b188243fb
Diffstat (limited to 'graphics/java')
-rw-r--r--graphics/java/android/renderscript/Allocation.java28
-rw-r--r--graphics/java/android/renderscript/RenderScript.java6
2 files changed, 28 insertions, 6 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index a76a628..6b59b10 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -22,6 +22,7 @@ import android.content.res.Resources;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
+import android.view.Surface;
import android.graphics.SurfaceTexture;
import android.util.Log;
import android.util.TypedValue;
@@ -1185,17 +1186,38 @@ public class Allocation extends BaseObj {
}
/**
+ *
* @hide
+ *
*/
- public void setSurfaceTexture(SurfaceTexture sur) {
+ public Surface getSurface() {
+ return new Surface(getSurfaceTexture());
+ }
+
+ /**
+ * @hide
+ */
+ public void setSurface(Surface sur) {
+ mRS.validate();
if ((mUsage & USAGE_IO_OUTPUT) == 0) {
throw new RSInvalidStateException("Allocation is not USAGE_IO_OUTPUT.");
}
- mRS.validate();
- mRS.nAllocationSetSurfaceTexture(getID(), sur);
+ mRS.nAllocationSetSurface(getID(), sur);
}
+ /**
+ * @hide
+ */
+ public void setSurfaceTexture(SurfaceTexture st) {
+ mRS.validate();
+ if ((mUsage & USAGE_IO_OUTPUT) == 0) {
+ throw new RSInvalidStateException("Allocation is not USAGE_IO_OUTPUT.");
+ }
+
+ Surface s = new Surface(st);
+ mRS.nAllocationSetSurface(getID(), s);
+ }
/**
* Creates a non-mipmapped renderscript allocation to use as a
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index ab6ba54..dffd400 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -299,10 +299,10 @@ public class RenderScript {
validate();
rsnAllocationGetSurfaceTextureID2(mContext, alloc, st);
}
- native void rsnAllocationSetSurfaceTexture(int con, int alloc, SurfaceTexture sur);
- synchronized void nAllocationSetSurfaceTexture(int alloc, SurfaceTexture sur) {
+ native void rsnAllocationSetSurface(int con, int alloc, Surface sur);
+ synchronized void nAllocationSetSurface(int alloc, Surface sur) {
validate();
- rsnAllocationSetSurfaceTexture(mContext, alloc, sur);
+ rsnAllocationSetSurface(mContext, alloc, sur);
}
native void rsnAllocationIoSend(int con, int alloc);
synchronized void nAllocationIoSend(int alloc) {