summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2010-11-03 14:27:11 -0700
committerJason Sams <rjsams@android.com>2010-11-03 14:27:11 -0700
commitd5f06300341df0990be3e0b7a26fa49b13c6fc19 (patch)
treeb6ab4893e599c401debbe0f0282e28303c5514d9 /graphics
parent4b8d36b30ad2e87f3969034eb42dc14b99f03686 (diff)
downloadframeworks_base-d5f06300341df0990be3e0b7a26fa49b13c6fc19.zip
frameworks_base-d5f06300341df0990be3e0b7a26fa49b13c6fc19.tar.gz
frameworks_base-d5f06300341df0990be3e0b7a26fa49b13c6fc19.tar.bz2
RS Error cleanup.
Thow java exception during init if the GL driver fails rather than native crash. Change-Id: Ie96ef5a2ac12e64f9456545d86157c4c95179a8e
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/renderscript/RSDriverException.java32
-rw-r--r--graphics/java/android/renderscript/RSIllegalArgumentException.java31
-rw-r--r--graphics/java/android/renderscript/RSInvalidStateException.java32
-rw-r--r--graphics/java/android/renderscript/RSRuntimeException.java31
-rw-r--r--graphics/java/android/renderscript/RenderScriptGL.java3
-rw-r--r--graphics/java/android/renderscript/Type.java8
6 files changed, 129 insertions, 8 deletions
diff --git a/graphics/java/android/renderscript/RSDriverException.java b/graphics/java/android/renderscript/RSDriverException.java
new file mode 100644
index 0000000..61787e6
--- /dev/null
+++ b/graphics/java/android/renderscript/RSDriverException.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2010 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;
+
+
+/**
+ * Base class for all exceptions thrown by the Android
+ * Renderscript
+ * @hide
+ */
+public class RSDriverException extends RSRuntimeException {
+ public RSDriverException(String string) {
+ super(string);
+ }
+}
+
+
+
diff --git a/graphics/java/android/renderscript/RSIllegalArgumentException.java b/graphics/java/android/renderscript/RSIllegalArgumentException.java
new file mode 100644
index 0000000..8d67a8d
--- /dev/null
+++ b/graphics/java/android/renderscript/RSIllegalArgumentException.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2010 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;
+
+
+/**
+ * Base class for all exceptions thrown by the Android
+ * Renderscript
+ * @hide
+ */
+public class RSIllegalArgumentException extends RSRuntimeException {
+ public RSIllegalArgumentException(String string) {
+ super(string);
+ }
+}
+
+
diff --git a/graphics/java/android/renderscript/RSInvalidStateException.java b/graphics/java/android/renderscript/RSInvalidStateException.java
new file mode 100644
index 0000000..53b9479
--- /dev/null
+++ b/graphics/java/android/renderscript/RSInvalidStateException.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2010 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;
+
+
+/**
+ * Base class for all exceptions thrown by the Android
+ * Renderscript
+ * @hide
+ */
+public class RSInvalidStateException extends RSRuntimeException {
+ public RSInvalidStateException(String string) {
+ super(string);
+ }
+}
+
+
+
diff --git a/graphics/java/android/renderscript/RSRuntimeException.java b/graphics/java/android/renderscript/RSRuntimeException.java
new file mode 100644
index 0000000..4c97937
--- /dev/null
+++ b/graphics/java/android/renderscript/RSRuntimeException.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2010 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;
+
+
+/**
+ * Base class for all exceptions thrown by the Android
+ * Renderscript
+ * @hide
+ */
+public class RSRuntimeException
+ extends java.lang.RuntimeException {
+ public RSRuntimeException(String string) {
+ super(string);
+ }
+}
+
diff --git a/graphics/java/android/renderscript/RenderScriptGL.java b/graphics/java/android/renderscript/RenderScriptGL.java
index 5fe69cd..21cbb9a 100644
--- a/graphics/java/android/renderscript/RenderScriptGL.java
+++ b/graphics/java/android/renderscript/RenderScriptGL.java
@@ -128,6 +128,9 @@ public class RenderScriptGL extends RenderScript {
mSurfaceConfig.mStencilMin, mSurfaceConfig.mStencilPref,
mSurfaceConfig.mSamplesMin, mSurfaceConfig.mSamplesPref,
mSurfaceConfig.mSamplesQ);
+ if (mContext == 0) {
+ throw new RSDriverException("Failed to create RS context.");
+ }
mMessageThread = new MessageThread(this);
mMessageThread.start();
Element.initPredefined(this);
diff --git a/graphics/java/android/renderscript/Type.java b/graphics/java/android/renderscript/Type.java
index caa8b13..9a40d1f 100644
--- a/graphics/java/android/renderscript/Type.java
+++ b/graphics/java/android/renderscript/Type.java
@@ -33,8 +33,6 @@ public class Type extends BaseObj {
int mElementCount;
Element mElement;
- Class mJavaClass;
-
public Element getElement() {
return mElement;
}
@@ -124,12 +122,6 @@ public class Type extends BaseObj {
calcElementCount();
}
- public static Type createFromClass(RenderScript rs, Class c, int size, String scriptName) {
- android.util.Log.e("RenderScript", "Calling depricated createFromClass");
- return null;
- }
-
-
public static class Builder {
RenderScript mRS;
Dimension[] mDimensions;