diff options
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/SurfaceTexture.java | 5 | ||||
-rw-r--r-- | graphics/java/android/renderscript/Allocation.java | 14 | ||||
-rw-r--r-- | graphics/java/android/renderscript/AllocationAdapter.java | 2 | ||||
-rw-r--r-- | graphics/java/android/renderscript/Element.java | 31 | ||||
-rw-r--r-- | graphics/java/android/renderscript/Type.java | 14 |
5 files changed, 48 insertions, 18 deletions
diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java index 0ffd201..6c7341f 100644 --- a/graphics/java/android/graphics/SurfaceTexture.java +++ b/graphics/java/android/graphics/SurfaceTexture.java @@ -66,11 +66,8 @@ public class SurfaceTexture { /** * This field is used by native code, do not access or modify. - * - * @hide */ - @SuppressWarnings({"UnusedDeclaration"}) - public int mSurfaceTexture; + private int mSurfaceTexture; /** * Callback interface for being notified that a new stream frame is available. diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java index a63abb9..eeab9b4 100644 --- a/graphics/java/android/renderscript/Allocation.java +++ b/graphics/java/android/renderscript/Allocation.java @@ -606,9 +606,9 @@ public class Allocation extends BaseObj { */ public void copy1DRangeFrom(int off, int count, Allocation data, int dataOff) { mRS.nAllocationData2D(getID(), off, 0, - 0, Type.CubemapFace.POSITVE_X.mID, + 0, Type.CubemapFace.POSITIVE_X.mID, count, 1, data.getID(), dataOff, 0, - 0, Type.CubemapFace.POSITVE_X.mID); + 0, Type.CubemapFace.POSITIVE_X.mID); } private void validate2DRange(int xoff, int yoff, int w, int h) { @@ -675,9 +675,9 @@ public class Allocation extends BaseObj { mRS.validate(); validate2DRange(xoff, yoff, w, h); mRS.nAllocationData2D(getID(), xoff, yoff, - 0, Type.CubemapFace.POSITVE_X.mID, + 0, Type.CubemapFace.POSITIVE_X.mID, w, h, data.getID(), dataXoff, dataYoff, - 0, Type.CubemapFace.POSITVE_X.mID); + 0, Type.CubemapFace.POSITIVE_X.mID); } /** @@ -1048,15 +1048,15 @@ public class Allocation extends BaseObj { Allocation cubemap = Allocation.createTyped(rs, t, mips, usage); AllocationAdapter adapter = AllocationAdapter.create2D(rs, cubemap); - adapter.setFace(Type.CubemapFace.POSITVE_X); + adapter.setFace(Type.CubemapFace.POSITIVE_X); adapter.copyFrom(xpos); adapter.setFace(Type.CubemapFace.NEGATIVE_X); adapter.copyFrom(xneg); - adapter.setFace(Type.CubemapFace.POSITVE_Y); + adapter.setFace(Type.CubemapFace.POSITIVE_Y); adapter.copyFrom(ypos); adapter.setFace(Type.CubemapFace.NEGATIVE_Y); adapter.copyFrom(yneg); - adapter.setFace(Type.CubemapFace.POSITVE_Z); + adapter.setFace(Type.CubemapFace.POSITIVE_Z); adapter.copyFrom(zpos); adapter.setFace(Type.CubemapFace.NEGATIVE_Z); adapter.copyFrom(zneg); diff --git a/graphics/java/android/renderscript/AllocationAdapter.java b/graphics/java/android/renderscript/AllocationAdapter.java index 07a1f5d..61f2e1f 100644 --- a/graphics/java/android/renderscript/AllocationAdapter.java +++ b/graphics/java/android/renderscript/AllocationAdapter.java @@ -33,7 +33,7 @@ public class AllocationAdapter extends Allocation { private Allocation mAlloc; private int mSelectedLOD = 0; - private Type.CubemapFace mSelectedFace = Type.CubemapFace.POSITVE_X; + private Type.CubemapFace mSelectedFace = Type.CubemapFace.POSITIVE_X; AllocationAdapter(int id, RenderScript rs, Allocation alloc) { super(id, rs, null, alloc.mUsage); diff --git a/graphics/java/android/renderscript/Element.java b/graphics/java/android/renderscript/Element.java index 0c1ad2a..5a72dbe 100644 --- a/graphics/java/android/renderscript/Element.java +++ b/graphics/java/android/renderscript/Element.java @@ -32,8 +32,8 @@ import android.util.Log; * <p>Complex elements contain a list of sub-elements and names that * represents a structure of data. The fields can be accessed by name * from a script or shader. The memory layout is defined and ordered. Data - * alignment is determinied by the most basic primitive type. i.e. a float4 - * vector will be alligned to sizeof(float) and not sizeof(float4). The + * alignment is determined by the most basic primitive type. i.e. a float4 + * vector will be aligned to sizeof(float) and not sizeof(float4). The * ordering of elements in memory will be the order in which they were added * with each component aligned as necessary. No re-ordering will be done.</p> * @@ -584,6 +584,33 @@ public class Element extends BaseObj { } /** + * Check if the current Element is compatible with another Element. + * Primitive Elements are compatible if they share the same underlying + * size and type (i.e. U8 is compatible with A_8). User-defined Elements + * must be equal in order to be compatible. This requires strict name + * equivalence for all sub-Elements (in addition to structural equivalence). + * + * @param e The Element to check compatibility with. + * + * @return boolean true if the Elements are compatible, otherwise false. + */ + public boolean isCompatible(Element e) { + // Try strict BaseObj equality to start with. + if (this.equals(e)) { + return true; + } + + // Ignore mKind because it is allowed to be different (user vs. pixel). + // We also ignore mNormalized because it can be different. The mType + // field must be non-null since we require name equivalence for + // user-created Elements. + return ((mSize == e.mSize) && + (mType != null) && + (mType == e.mType) && + (mVectorSize == e.mVectorSize)); + } + + /** * Builder class for producing complex elements with matching field and name * pairs. The builder starts empty. The order in which elements are added * is retained for the layout in memory. diff --git a/graphics/java/android/renderscript/Type.java b/graphics/java/android/renderscript/Type.java index b39d2e4..f88af8b 100644 --- a/graphics/java/android/renderscript/Type.java +++ b/graphics/java/android/renderscript/Type.java @@ -46,12 +46,18 @@ public class Type extends BaseObj { Element mElement; public enum CubemapFace { - POSITVE_X (0), + POSITIVE_X (0), NEGATIVE_X (1), - POSITVE_Y (2), + POSITIVE_Y (2), NEGATIVE_Y (3), - POSITVE_Z (4), - NEGATIVE_Z (5); + POSITIVE_Z (4), + NEGATIVE_Z (5), + @Deprecated + POSITVE_X (0), + @Deprecated + POSITVE_Y (2), + @Deprecated + POSITVE_Z (4); int mID; CubemapFace(int id) { |