summaryrefslogtreecommitdiff
path: root/rs/java/android/renderscript/Element.java
diff options
context:
space:
mode:
authorYang Ni <yangni@google.com>2016-04-20 18:20:35 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-04-20 18:20:35 +0000
commit3c207ff5af7c4f0a9d9cafa6c6f5c947cfdb78ca (patch)
tree99fc6eceb8e8d8ce7389f2c769c93d797cf3d765 /rs/java/android/renderscript/Element.java
parent448d39f7ae40b5bf49929905bded367d4b01b1ea (diff)
parentacd0061f908f7f9d9545d2729ce46d83ab349e58 (diff)
Merge "Made Element accessors thread-safe"
am: acd0061 * commit 'acd0061f908f7f9d9545d2729ce46d83ab349e58': Made Element accessors thread-safe Change-Id: I669c5b09b459da6dfe1a6a39af46b1eca1f16e2d
Diffstat (limited to 'rs/java/android/renderscript/Element.java')
-rw-r--r--rs/java/android/renderscript/Element.java527
1 files changed, 395 insertions, 132 deletions
diff --git a/rs/java/android/renderscript/Element.java b/rs/java/android/renderscript/Element.java
index 50226acc77b4..9d2f75080bb6 100644
--- a/rs/java/android/renderscript/Element.java
+++ b/rs/java/android/renderscript/Element.java
@@ -311,8 +311,12 @@ public class Element extends BaseObj {
* @return Element
*/
public static Element BOOLEAN(RenderScript rs) {
- if(rs.mElement_BOOLEAN == null) {
- rs.mElement_BOOLEAN = createUser(rs, DataType.BOOLEAN);
+ if (rs.mElement_BOOLEAN == null) {
+ synchronized (rs) {
+ if (rs.mElement_BOOLEAN == null) {
+ rs.mElement_BOOLEAN = createUser(rs, DataType.BOOLEAN);
+ }
+ }
}
return rs.mElement_BOOLEAN;
}
@@ -325,8 +329,12 @@ public class Element extends BaseObj {
* @return Element
*/
public static Element U8(RenderScript rs) {
- if(rs.mElement_U8 == null) {
- rs.mElement_U8 = createUser(rs, DataType.UNSIGNED_8);
+ if (rs.mElement_U8 == null) {
+ synchronized (rs) {
+ if (rs.mElement_U8 == null) {
+ rs.mElement_U8 = createUser(rs, DataType.UNSIGNED_8);
+ }
+ }
}
return rs.mElement_U8;
}
@@ -339,436 +347,683 @@ public class Element extends BaseObj {
* @return Element
*/
public static Element I8(RenderScript rs) {
- if(rs.mElement_I8 == null) {
- rs.mElement_I8 = createUser(rs, DataType.SIGNED_8);
+ if (rs.mElement_I8 == null) {
+ synchronized (rs) {
+ if (rs.mElement_I8 == null) {
+ rs.mElement_I8 = createUser(rs, DataType.SIGNED_8);
+ }
+ }
}
return rs.mElement_I8;
}
public static Element U16(RenderScript rs) {
- if(rs.mElement_U16 == null) {
- rs.mElement_U16 = createUser(rs, DataType.UNSIGNED_16);
+ if (rs.mElement_U16 == null) {
+ synchronized (rs) {
+ if (rs.mElement_U16 == null) {
+ rs.mElement_U16 = createUser(rs, DataType.UNSIGNED_16);
+ }
+ }
}
return rs.mElement_U16;
}
public static Element I16(RenderScript rs) {
- if(rs.mElement_I16 == null) {
- rs.mElement_I16 = createUser(rs, DataType.SIGNED_16);
+ if (rs.mElement_I16 == null) {
+ synchronized (rs) {
+ if (rs.mElement_I16 == null) {
+ rs.mElement_I16 = createUser(rs, DataType.SIGNED_16);
+ }
+ }
}
return rs.mElement_I16;
}
public static Element U32(RenderScript rs) {
- if(rs.mElement_U32 == null) {
- rs.mElement_U32 = createUser(rs, DataType.UNSIGNED_32);
+ if (rs.mElement_U32 == null) {
+ synchronized (rs) {
+ if (rs.mElement_U32 == null) {
+ rs.mElement_U32 = createUser(rs, DataType.UNSIGNED_32);
+ }
+ }
}
return rs.mElement_U32;
}
public static Element I32(RenderScript rs) {
- if(rs.mElement_I32 == null) {
- rs.mElement_I32 = createUser(rs, DataType.SIGNED_32);
+ if (rs.mElement_I32 == null) {
+ synchronized (rs) {
+ if (rs.mElement_I32 == null) {
+ rs.mElement_I32 = createUser(rs, DataType.SIGNED_32);
+ }
+ }
}
return rs.mElement_I32;
}
public static Element U64(RenderScript rs) {
- if(rs.mElement_U64 == null) {
- rs.mElement_U64 = createUser(rs, DataType.UNSIGNED_64);
+ if (rs.mElement_U64 == null) {
+ synchronized (rs) {
+ if (rs.mElement_U64 == null) {
+ rs.mElement_U64 = createUser(rs, DataType.UNSIGNED_64);
+ }
+ }
}
return rs.mElement_U64;
}
public static Element I64(RenderScript rs) {
- if(rs.mElement_I64 == null) {
- rs.mElement_I64 = createUser(rs, DataType.SIGNED_64);
+ if (rs.mElement_I64 == null) {
+ synchronized (rs) {
+ if (rs.mElement_I64 == null) {
+ rs.mElement_I64 = createUser(rs, DataType.SIGNED_64);
+ }
+ }
}
return rs.mElement_I64;
}
public static Element F16(RenderScript rs) {
- if(rs.mElement_F16 == null) {
- rs.mElement_F16 = createUser(rs, DataType.FLOAT_16);
+ if (rs.mElement_F16 == null) {
+ synchronized (rs) {
+ if (rs.mElement_F16 == null) {
+ rs.mElement_F16 = createUser(rs, DataType.FLOAT_16);
+ }
+ }
}
return rs.mElement_F16;
}
public static Element F32(RenderScript rs) {
- if(rs.mElement_F32 == null) {
- rs.mElement_F32 = createUser(rs, DataType.FLOAT_32);
+ if (rs.mElement_F32 == null) {
+ synchronized (rs) {
+ if (rs.mElement_F32 == null) {
+ rs.mElement_F32 = createUser(rs, DataType.FLOAT_32);
+ }
+ }
}
return rs.mElement_F32;
}
public static Element F64(RenderScript rs) {
- if(rs.mElement_F64 == null) {
- rs.mElement_F64 = createUser(rs, DataType.FLOAT_64);
+ if (rs.mElement_F64 == null) {
+ synchronized (rs) {
+ if (rs.mElement_F64 == null) {
+ rs.mElement_F64 = createUser(rs, DataType.FLOAT_64);
+ }
+ }
}
return rs.mElement_F64;
}
public static Element ELEMENT(RenderScript rs) {
- if(rs.mElement_ELEMENT == null) {
- rs.mElement_ELEMENT = createUser(rs, DataType.RS_ELEMENT);
+ if (rs.mElement_ELEMENT == null) {
+ synchronized (rs) {
+ if (rs.mElement_ELEMENT == null) {
+ rs.mElement_ELEMENT = createUser(rs, DataType.RS_ELEMENT);
+ }
+ }
}
return rs.mElement_ELEMENT;
}
public static Element TYPE(RenderScript rs) {
- if(rs.mElement_TYPE == null) {
- rs.mElement_TYPE = createUser(rs, DataType.RS_TYPE);
+ if (rs.mElement_TYPE == null) {
+ synchronized (rs) {
+ if (rs.mElement_TYPE == null) {
+ rs.mElement_TYPE = createUser(rs, DataType.RS_TYPE);
+ }
+ }
}
return rs.mElement_TYPE;
}
public static Element ALLOCATION(RenderScript rs) {
- if(rs.mElement_ALLOCATION == null) {
- rs.mElement_ALLOCATION = createUser(rs, DataType.RS_ALLOCATION);
+ if (rs.mElement_ALLOCATION == null) {
+ synchronized (rs) {
+ if (rs.mElement_ALLOCATION == null) {
+ rs.mElement_ALLOCATION = createUser(rs, DataType.RS_ALLOCATION);
+ }
+ }
}
return rs.mElement_ALLOCATION;
}
public static Element SAMPLER(RenderScript rs) {
- if(rs.mElement_SAMPLER == null) {
- rs.mElement_SAMPLER = createUser(rs, DataType.RS_SAMPLER);
+ if (rs.mElement_SAMPLER == null) {
+ synchronized (rs) {
+ if (rs.mElement_SAMPLER == null) {
+ rs.mElement_SAMPLER = createUser(rs, DataType.RS_SAMPLER);
+ }
+ }
}
return rs.mElement_SAMPLER;
}
public static Element SCRIPT(RenderScript rs) {
- if(rs.mElement_SCRIPT == null) {
- rs.mElement_SCRIPT = createUser(rs, DataType.RS_SCRIPT);
+ if (rs.mElement_SCRIPT == null) {
+ synchronized (rs) {
+ if (rs.mElement_SCRIPT == null) {
+ rs.mElement_SCRIPT = createUser(rs, DataType.RS_SCRIPT);
+ }
+ }
}
return rs.mElement_SCRIPT;
}
public static Element MESH(RenderScript rs) {
- if(rs.mElement_MESH == null) {
- rs.mElement_MESH = createUser(rs, DataType.RS_MESH);
+ if (rs.mElement_MESH == null) {
+ synchronized (rs) {
+ if (rs.mElement_MESH == null) {
+ rs.mElement_MESH = createUser(rs, DataType.RS_MESH);
+ }
+ }
}
return rs.mElement_MESH;
}
public static Element PROGRAM_FRAGMENT(RenderScript rs) {
- if(rs.mElement_PROGRAM_FRAGMENT == null) {
- rs.mElement_PROGRAM_FRAGMENT = createUser(rs, DataType.RS_PROGRAM_FRAGMENT);
+ if (rs.mElement_PROGRAM_FRAGMENT == null) {
+ synchronized (rs) {
+ if (rs.mElement_PROGRAM_FRAGMENT == null) {
+ rs.mElement_PROGRAM_FRAGMENT = createUser(rs, DataType.RS_PROGRAM_FRAGMENT);
+ }
+ }
}
return rs.mElement_PROGRAM_FRAGMENT;
}
public static Element PROGRAM_VERTEX(RenderScript rs) {
- if(rs.mElement_PROGRAM_VERTEX == null) {
- rs.mElement_PROGRAM_VERTEX = createUser(rs, DataType.RS_PROGRAM_VERTEX);
+ if (rs.mElement_PROGRAM_VERTEX == null) {
+ synchronized (rs) {
+ if (rs.mElement_PROGRAM_VERTEX == null) {
+ rs.mElement_PROGRAM_VERTEX = createUser(rs, DataType.RS_PROGRAM_VERTEX);
+ }
+ }
}
return rs.mElement_PROGRAM_VERTEX;
}
public static Element PROGRAM_RASTER(RenderScript rs) {
- if(rs.mElement_PROGRAM_RASTER == null) {
- rs.mElement_PROGRAM_RASTER = createUser(rs, DataType.RS_PROGRAM_RASTER);
+ if (rs.mElement_PROGRAM_RASTER == null) {
+ synchronized (rs) {
+ if (rs.mElement_PROGRAM_RASTER == null) {
+ rs.mElement_PROGRAM_RASTER = createUser(rs, DataType.RS_PROGRAM_RASTER);
+ }
+ }
}
return rs.mElement_PROGRAM_RASTER;
}
public static Element PROGRAM_STORE(RenderScript rs) {
- if(rs.mElement_PROGRAM_STORE == null) {
- rs.mElement_PROGRAM_STORE = createUser(rs, DataType.RS_PROGRAM_STORE);
+ if (rs.mElement_PROGRAM_STORE == null) {
+ synchronized (rs) {
+ if (rs.mElement_PROGRAM_STORE == null) {
+ rs.mElement_PROGRAM_STORE = createUser(rs, DataType.RS_PROGRAM_STORE);
+ }
+ }
}
return rs.mElement_PROGRAM_STORE;
}
public static Element FONT(RenderScript rs) {
- if(rs.mElement_FONT == null) {
- rs.mElement_FONT = createUser(rs, DataType.RS_FONT);
+ if (rs.mElement_FONT == null) {
+ synchronized (rs) {
+ if (rs.mElement_FONT == null) {
+ rs.mElement_FONT = createUser(rs, DataType.RS_FONT);
+ }
+ }
}
return rs.mElement_FONT;
}
-
public static Element A_8(RenderScript rs) {
- if(rs.mElement_A_8 == null) {
- rs.mElement_A_8 = createPixel(rs, DataType.UNSIGNED_8, DataKind.PIXEL_A);
+ if (rs.mElement_A_8 == null) {
+ synchronized (rs) {
+ if (rs.mElement_A_8 == null) {
+ rs.mElement_A_8 = createPixel(rs, DataType.UNSIGNED_8, DataKind.PIXEL_A);
+ }
+ }
}
return rs.mElement_A_8;
}
public static Element RGB_565(RenderScript rs) {
- if(rs.mElement_RGB_565 == null) {
- rs.mElement_RGB_565 = createPixel(rs, DataType.UNSIGNED_5_6_5, DataKind.PIXEL_RGB);
+ if (rs.mElement_RGB_565 == null) {
+ synchronized (rs) {
+ if (rs.mElement_RGB_565 == null) {
+ rs.mElement_RGB_565 = createPixel(rs, DataType.UNSIGNED_5_6_5, DataKind.PIXEL_RGB);
+ }
+ }
}
return rs.mElement_RGB_565;
}
public static Element RGB_888(RenderScript rs) {
- if(rs.mElement_RGB_888 == null) {
- rs.mElement_RGB_888 = createPixel(rs, DataType.UNSIGNED_8, DataKind.PIXEL_RGB);
+ if (rs.mElement_RGB_888 == null) {
+ synchronized (rs) {
+ if (rs.mElement_RGB_888 == null) {
+ rs.mElement_RGB_888 = createPixel(rs, DataType.UNSIGNED_8, DataKind.PIXEL_RGB);
+ }
+ }
}
return rs.mElement_RGB_888;
}
public static Element RGBA_5551(RenderScript rs) {
- if(rs.mElement_RGBA_5551 == null) {
- rs.mElement_RGBA_5551 = createPixel(rs, DataType.UNSIGNED_5_5_5_1, DataKind.PIXEL_RGBA);
+ if (rs.mElement_RGBA_5551 == null) {
+ synchronized (rs) {
+ if (rs.mElement_RGBA_5551 == null) {
+ rs.mElement_RGBA_5551 = createPixel(rs, DataType.UNSIGNED_5_5_5_1, DataKind.PIXEL_RGBA);
+ }
+ }
}
return rs.mElement_RGBA_5551;
}
public static Element RGBA_4444(RenderScript rs) {
- if(rs.mElement_RGBA_4444 == null) {
- rs.mElement_RGBA_4444 = createPixel(rs, DataType.UNSIGNED_4_4_4_4, DataKind.PIXEL_RGBA);
+ if (rs.mElement_RGBA_4444 == null) {
+ synchronized (rs) {
+ if (rs.mElement_RGBA_4444 == null) {
+ rs.mElement_RGBA_4444 = createPixel(rs, DataType.UNSIGNED_4_4_4_4, DataKind.PIXEL_RGBA);
+ }
+ }
}
return rs.mElement_RGBA_4444;
}
public static Element RGBA_8888(RenderScript rs) {
- if(rs.mElement_RGBA_8888 == null) {
- rs.mElement_RGBA_8888 = createPixel(rs, DataType.UNSIGNED_8, DataKind.PIXEL_RGBA);
+ if (rs.mElement_RGBA_8888 == null) {
+ synchronized (rs) {
+ if (rs.mElement_RGBA_8888 == null) {
+ rs.mElement_RGBA_8888 = createPixel(rs, DataType.UNSIGNED_8, DataKind.PIXEL_RGBA);
+ }
+ }
}
return rs.mElement_RGBA_8888;
}
public static Element F16_2(RenderScript rs) {
- if(rs.mElement_HALF_2 == null) {
- rs.mElement_HALF_2 = createVector(rs, DataType.FLOAT_16, 2);
+ if (rs.mElement_HALF_2 == null) {
+ synchronized (rs) {
+ if (rs.mElement_HALF_2 == null) {
+ rs.mElement_HALF_2 = createVector(rs, DataType.FLOAT_16, 2);
+ }
+ }
}
return rs.mElement_HALF_2;
}
public static Element F16_3(RenderScript rs) {
- if(rs.mElement_HALF_3 == null) {
- rs.mElement_HALF_3 = createVector(rs, DataType.FLOAT_16, 3);
+ if (rs.mElement_HALF_3 == null) {
+ synchronized (rs) {
+ if (rs.mElement_HALF_3 == null) {
+ rs.mElement_HALF_3 = createVector(rs, DataType.FLOAT_16, 3);
+ }
+ }
}
return rs.mElement_HALF_3;
}
public static Element F16_4(RenderScript rs) {
- if(rs.mElement_HALF_4 == null) {
- rs.mElement_HALF_4 = createVector(rs, DataType.FLOAT_16, 4);
+ if (rs.mElement_HALF_4 == null) {
+ synchronized (rs) {
+ if (rs.mElement_HALF_4 == null) {
+ rs.mElement_HALF_4 = createVector(rs, DataType.FLOAT_16, 4);
+ }
+ }
}
return rs.mElement_HALF_4;
}
public static Element F32_2(RenderScript rs) {
- if(rs.mElement_FLOAT_2 == null) {
- rs.mElement_FLOAT_2 = createVector(rs, DataType.FLOAT_32, 2);
+ if (rs.mElement_FLOAT_2 == null) {
+ synchronized (rs) {
+ if (rs.mElement_FLOAT_2 == null) {
+ rs.mElement_FLOAT_2 = createVector(rs, DataType.FLOAT_32, 2);
+ }
+ }
}
return rs.mElement_FLOAT_2;
}
public static Element F32_3(RenderScript rs) {
- if(rs.mElement_FLOAT_3 == null) {
- rs.mElement_FLOAT_3 = createVector(rs, DataType.FLOAT_32, 3);
+ if (rs.mElement_FLOAT_3 == null) {
+ synchronized (rs) {
+ if (rs.mElement_FLOAT_3 == null) {
+ rs.mElement_FLOAT_3 = createVector(rs, DataType.FLOAT_32, 3);
+ }
+ }
}
return rs.mElement_FLOAT_3;
}
public static Element F32_4(RenderScript rs) {
- if(rs.mElement_FLOAT_4 == null) {
- rs.mElement_FLOAT_4 = createVector(rs, DataType.FLOAT_32, 4);
+ if (rs.mElement_FLOAT_4 == null) {
+ synchronized (rs) {
+ if (rs.mElement_FLOAT_4 == null) {
+ rs.mElement_FLOAT_4 = createVector(rs, DataType.FLOAT_32, 4);
+ }
+ }
}
return rs.mElement_FLOAT_4;
}
public static Element F64_2(RenderScript rs) {
- if(rs.mElement_DOUBLE_2 == null) {
- rs.mElement_DOUBLE_2 = createVector(rs, DataType.FLOAT_64, 2);
+ if (rs.mElement_DOUBLE_2 == null) {
+ synchronized (rs) {
+ if (rs.mElement_DOUBLE_2 == null) {
+ rs.mElement_DOUBLE_2 = createVector(rs, DataType.FLOAT_64, 2);
+ }
+ }
}
return rs.mElement_DOUBLE_2;
}
public static Element F64_3(RenderScript rs) {
- if(rs.mElement_DOUBLE_3 == null) {
- rs.mElement_DOUBLE_3 = createVector(rs, DataType.FLOAT_64, 3);
+ if (rs.mElement_DOUBLE_3 == null) {
+ synchronized (rs) {
+ if (rs.mElement_DOUBLE_3 == null) {
+ rs.mElement_DOUBLE_3 = createVector(rs, DataType.FLOAT_64, 3);
+ }
+ }
}
return rs.mElement_DOUBLE_3;
}
public static Element F64_4(RenderScript rs) {
- if(rs.mElement_DOUBLE_4 == null) {
- rs.mElement_DOUBLE_4 = createVector(rs, DataType.FLOAT_64, 4);
+ if (rs.mElement_DOUBLE_4 == null) {
+ synchronized (rs) {
+ if (rs.mElement_DOUBLE_4 == null) {
+ rs.mElement_DOUBLE_4 = createVector(rs, DataType.FLOAT_64, 4);
+ }
+ }
}
return rs.mElement_DOUBLE_4;
}
public static Element U8_2(RenderScript rs) {
- if(rs.mElement_UCHAR_2 == null) {
- rs.mElement_UCHAR_2 = createVector(rs, DataType.UNSIGNED_8, 2);
+ if (rs.mElement_UCHAR_2 == null) {
+ synchronized (rs) {
+ if (rs.mElement_UCHAR_2 == null) {
+ rs.mElement_UCHAR_2 = createVector(rs, DataType.UNSIGNED_8, 2);
+ }
+ }
}
return rs.mElement_UCHAR_2;
}
public static Element U8_3(RenderScript rs) {
- if(rs.mElement_UCHAR_3 == null) {
- rs.mElement_UCHAR_3 = createVector(rs, DataType.UNSIGNED_8, 3);
+ if (rs.mElement_UCHAR_3 == null) {
+ synchronized (rs) {
+ if (rs.mElement_UCHAR_3 == null) {
+ rs.mElement_UCHAR_3 = createVector(rs, DataType.UNSIGNED_8, 3);
+ }
+ }
}
return rs.mElement_UCHAR_3;
}
public static Element U8_4(RenderScript rs) {
- if(rs.mElement_UCHAR_4 == null) {
- rs.mElement_UCHAR_4 = createVector(rs, DataType.UNSIGNED_8, 4);
+ if (rs.mElement_UCHAR_4 == null) {
+ synchronized (rs) {
+ if (rs.mElement_UCHAR_4 == null) {
+ rs.mElement_UCHAR_4 = createVector(rs, DataType.UNSIGNED_8, 4);
+ }
+ }
}
return rs.mElement_UCHAR_4;
}
public static Element I8_2(RenderScript rs) {
- if(rs.mElement_CHAR_2 == null) {
- rs.mElement_CHAR_2 = createVector(rs, DataType.SIGNED_8, 2);
+ if (rs.mElement_CHAR_2 == null) {
+ synchronized (rs) {
+ if (rs.mElement_CHAR_2 == null) {
+ rs.mElement_CHAR_2 = createVector(rs, DataType.SIGNED_8, 2);
+ }
+ }
}
return rs.mElement_CHAR_2;
}
public static Element I8_3(RenderScript rs) {
- if(rs.mElement_CHAR_3 == null) {
- rs.mElement_CHAR_3 = createVector(rs, DataType.SIGNED_8, 3);
+ if (rs.mElement_CHAR_3 == null) {
+ synchronized (rs) {
+ if (rs.mElement_CHAR_3 == null) {
+ rs.mElement_CHAR_3 = createVector(rs, DataType.SIGNED_8, 3);
+ }
+ }
}
return rs.mElement_CHAR_3;
}
public static Element I8_4(RenderScript rs) {
- if(rs.mElement_CHAR_4 == null) {
- rs.mElement_CHAR_4 = createVector(rs, DataType.SIGNED_8, 4);
+ if (rs.mElement_CHAR_4 == null) {
+ synchronized (rs) {
+ if (rs.mElement_CHAR_4 == null) {
+ rs.mElement_CHAR_4 = createVector(rs, DataType.SIGNED_8, 4);
+ }
+ }
}
return rs.mElement_CHAR_4;
}
public static Element U16_2(RenderScript rs) {
- if(rs.mElement_USHORT_2 == null) {
- rs.mElement_USHORT_2 = createVector(rs, DataType.UNSIGNED_16, 2);
+ if (rs.mElement_USHORT_2 == null) {
+ synchronized (rs) {
+ if (rs.mElement_USHORT_2 == null) {
+ rs.mElement_USHORT_2 = createVector(rs, DataType.UNSIGNED_16, 2);
+ }
+ }
}
return rs.mElement_USHORT_2;
}
public static Element U16_3(RenderScript rs) {
- if(rs.mElement_USHORT_3 == null) {
- rs.mElement_USHORT_3 = createVector(rs, DataType.UNSIGNED_16, 3);
+ if (rs.mElement_USHORT_3 == null) {
+ synchronized (rs) {
+ if (rs.mElement_USHORT_3 == null) {
+ rs.mElement_USHORT_3 = createVector(rs, DataType.UNSIGNED_16, 3);
+ }
+ }
}
return rs.mElement_USHORT_3;
}
public static Element U16_4(RenderScript rs) {
- if(rs.mElement_USHORT_4 == null) {
- rs.mElement_USHORT_4 = createVector(rs, DataType.UNSIGNED_16, 4);
+ if (rs.mElement_USHORT_4 == null) {
+ synchronized (rs) {
+ if (rs.mElement_USHORT_4 == null) {
+ rs.mElement_USHORT_4 = createVector(rs, DataType.UNSIGNED_16, 4);
+ }
+ }
}
return rs.mElement_USHORT_4;
}
public static Element I16_2(RenderScript rs) {
- if(rs.mElement_SHORT_2 == null) {
- rs.mElement_SHORT_2 = createVector(rs, DataType.SIGNED_16, 2);
+ if (rs.mElement_SHORT_2 == null) {
+ synchronized (rs) {
+ if (rs.mElement_SHORT_2 == null) {
+ rs.mElement_SHORT_2 = createVector(rs, DataType.SIGNED_16, 2);
+ }
+ }
}
return rs.mElement_SHORT_2;
}
public static Element I16_3(RenderScript rs) {
- if(rs.mElement_SHORT_3 == null) {
- rs.mElement_SHORT_3 = createVector(rs, DataType.SIGNED_16, 3);
+ if (rs.mElement_SHORT_3 == null) {
+ synchronized (rs) {
+ if (rs.mElement_SHORT_3 == null) {
+ rs.mElement_SHORT_3 = createVector(rs, DataType.SIGNED_16, 3);
+ }
+ }
}
return rs.mElement_SHORT_3;
}
public static Element I16_4(RenderScript rs) {
- if(rs.mElement_SHORT_4 == null) {
- rs.mElement_SHORT_4 = createVector(rs, DataType.SIGNED_16, 4);
+ if (rs.mElement_SHORT_4 == null) {
+ synchronized (rs) {
+ if (rs.mElement_SHORT_4 == null) {
+ rs.mElement_SHORT_4 = createVector(rs, DataType.SIGNED_16, 4);
+ }
+ }
}
return rs.mElement_SHORT_4;
}
public static Element U32_2(RenderScript rs) {
- if(rs.mElement_UINT_2 == null) {
- rs.mElement_UINT_2 = createVector(rs, DataType.UNSIGNED_32, 2);
+ if (rs.mElement_UINT_2 == null) {
+ synchronized (rs) {
+ if (rs.mElement_UINT_2 == null) {
+ rs.mElement_UINT_2 = createVector(rs, DataType.UNSIGNED_32, 2);
+ }
+ }
}
return rs.mElement_UINT_2;
}
public static Element U32_3(RenderScript rs) {
- if(rs.mElement_UINT_3 == null) {
- rs.mElement_UINT_3 = createVector(rs, DataType.UNSIGNED_32, 3);
+ if (rs.mElement_UINT_3 == null) {
+ synchronized (rs) {
+ if (rs.mElement_UINT_3 == null) {
+ rs.mElement_UINT_3 = createVector(rs, DataType.UNSIGNED_32, 3);
+ }
+ }
}
return rs.mElement_UINT_3;
}
public static Element U32_4(RenderScript rs) {
- if(rs.mElement_UINT_4 == null) {
- rs.mElement_UINT_4 = createVector(rs, DataType.UNSIGNED_32, 4);
+ if (rs.mElement_UINT_4 == null) {
+ synchronized (rs) {
+ if (rs.mElement_UINT_4 == null) {
+ rs.mElement_UINT_4 = createVector(rs, DataType.UNSIGNED_32, 4);
+ }
+ }
}
return rs.mElement_UINT_4;
}
public static Element I32_2(RenderScript rs) {
- if(rs.mElement_INT_2 == null) {
- rs.mElement_INT_2 = createVector(rs, DataType.SIGNED_32, 2);
+ if (rs.mElement_INT_2 == null) {
+ synchronized (rs) {
+ if (rs.mElement_INT_2 == null) {
+ rs.mElement_INT_2 = createVector(rs, DataType.SIGNED_32, 2);
+ }
+ }
}
return rs.mElement_INT_2;
}
public static Element I32_3(RenderScript rs) {
- if(rs.mElement_INT_3 == null) {
- rs.mElement_INT_3 = createVector(rs, DataType.SIGNED_32, 3);
+ if (rs.mElement_INT_3 == null) {
+ synchronized (rs) {
+ if (rs.mElement_INT_3 == null) {
+ rs.mElement_INT_3 = createVector(rs, DataType.SIGNED_32, 3);
+ }
+ }
}
return rs.mElement_INT_3;
}
public static Element I32_4(RenderScript rs) {
- if(rs.mElement_INT_4 == null) {
- rs.mElement_INT_4 = createVector(rs, DataType.SIGNED_32, 4);
+ if (rs.mElement_INT_4 == null) {
+ synchronized (rs) {
+ if (rs.mElement_INT_4 == null) {
+ rs.mElement_INT_4 = createVector(rs, DataType.SIGNED_32, 4);
+ }
+ }
}
return rs.mElement_INT_4;
}
public static Element U64_2(RenderScript rs) {
- if(rs.mElement_ULONG_2 == null) {
- rs.mElement_ULONG_2 = createVector(rs, DataType.UNSIGNED_64, 2);
+ if (rs.mElement_ULONG_2 == null) {
+ synchronized (rs) {
+ if (rs.mElement_ULONG_2 == null) {
+ rs.mElement_ULONG_2 = createVector(rs, DataType.UNSIGNED_64, 2);
+ }
+ }
}
return rs.mElement_ULONG_2;
}
public static Element U64_3(RenderScript rs) {
- if(rs.mElement_ULONG_3 == null) {
- rs.mElement_ULONG_3 = createVector(rs, DataType.UNSIGNED_64, 3);
+ if (rs.mElement_ULONG_3 == null) {
+ synchronized (rs) {
+ if (rs.mElement_ULONG_3 == null) {
+ rs.mElement_ULONG_3 = createVector(rs, DataType.UNSIGNED_64, 3);
+ }
+ }
}
return rs.mElement_ULONG_3;
}
public static Element U64_4(RenderScript rs) {
- if(rs.mElement_ULONG_4 == null) {
- rs.mElement_ULONG_4 = createVector(rs, DataType.UNSIGNED_64, 4);
+ if (rs.mElement_ULONG_4 == null) {
+ synchronized (rs) {
+ if (rs.mElement_ULONG_4 == null) {
+ rs.mElement_ULONG_4 = createVector(rs, DataType.UNSIGNED_64, 4);
+ }
+ }
}
return rs.mElement_ULONG_4;
}
public static Element I64_2(RenderScript rs) {
- if(rs.mElement_LONG_2 == null) {
- rs.mElement_LONG_2 = createVector(rs, DataType.SIGNED_64, 2);
+ if (rs.mElement_LONG_2 == null) {
+ synchronized (rs) {
+ if (rs.mElement_LONG_2 == null) {
+ rs.mElement_LONG_2 = createVector(rs, DataType.SIGNED_64, 2);
+ }
+ }
}
return rs.mElement_LONG_2;
}
public static Element I64_3(RenderScript rs) {
- if(rs.mElement_LONG_3 == null) {
- rs.mElement_LONG_3 = createVector(rs, DataType.SIGNED_64, 3);
+ if (rs.mElement_LONG_3 == null) {
+ synchronized (rs) {
+ if (rs.mElement_LONG_3 == null) {
+ rs.mElement_LONG_3 = createVector(rs, DataType.SIGNED_64, 3);
+ }
+ }
}
return rs.mElement_LONG_3;
}
public static Element I64_4(RenderScript rs) {
- if(rs.mElement_LONG_4 == null) {
- rs.mElement_LONG_4 = createVector(rs, DataType.SIGNED_64, 4);
+ if (rs.mElement_LONG_4 == null) {
+ synchronized (rs) {
+ if (rs.mElement_LONG_4 == null) {
+ rs.mElement_LONG_4 = createVector(rs, DataType.SIGNED_64, 4);
+ }
+ }
}
return rs.mElement_LONG_4;
}
public static Element YUV(RenderScript rs) {
if (rs.mElement_YUV == null) {
- rs.mElement_YUV = createPixel(rs, DataType.UNSIGNED_8, DataKind.PIXEL_YUV);
+ synchronized (rs) {
+ if (rs.mElement_YUV == null) {
+ rs.mElement_YUV = createPixel(rs, DataType.UNSIGNED_8, DataKind.PIXEL_YUV);
+ }
+ }
}
return rs.mElement_YUV;
}
public static Element MATRIX_4X4(RenderScript rs) {
- if(rs.mElement_MATRIX_4X4 == null) {
- rs.mElement_MATRIX_4X4 = createUser(rs, DataType.MATRIX_4X4);
+ if (rs.mElement_MATRIX_4X4 == null) {
+ synchronized (rs) {
+ if (rs.mElement_MATRIX_4X4 == null) {
+ rs.mElement_MATRIX_4X4 = createUser(rs, DataType.MATRIX_4X4);
+ }
+ }
}
return rs.mElement_MATRIX_4X4;
}
@@ -780,15 +1035,23 @@ public class Element extends BaseObj {
}
public static Element MATRIX_3X3(RenderScript rs) {
- if(rs.mElement_MATRIX_3X3 == null) {
- rs.mElement_MATRIX_3X3 = createUser(rs, DataType.MATRIX_3X3);
+ if (rs.mElement_MATRIX_3X3 == null) {
+ synchronized (rs) {
+ if (rs.mElement_MATRIX_3X3 == null) {
+ rs.mElement_MATRIX_3X3 = createUser(rs, DataType.MATRIX_3X3);
+ }
+ }
}
return rs.mElement_MATRIX_3X3;
}
public static Element MATRIX_2X2(RenderScript rs) {
- if(rs.mElement_MATRIX_2X2 == null) {
- rs.mElement_MATRIX_2X2 = createUser(rs, DataType.MATRIX_2X2);
+ if (rs.mElement_MATRIX_2X2 == null) {
+ synchronized (rs) {
+ if (rs.mElement_MATRIX_2X2 == null) {
+ rs.mElement_MATRIX_2X2 = createUser(rs, DataType.MATRIX_2X2);
+ }
+ }
}
return rs.mElement_MATRIX_2X2;
}