summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2009-06-22 17:15:15 -0700
committerJason Sams <rjsams@android.com>2009-06-22 17:15:15 -0700
commit4b962e57a9a1fa923283f2d76855c1c68449564f (patch)
treeb6f1aefe41fbcd1d6bd29de6e46c40e234b48c48 /libs
parentbba134c8a1dcfe0c8473307a95899a02c9553504 (diff)
downloadframeworks_base-4b962e57a9a1fa923283f2d76855c1c68449564f.zip
frameworks_base-4b962e57a9a1fa923283f2d76855c1c68449564f.tar.gz
frameworks_base-4b962e57a9a1fa923283f2d76855c1c68449564f.tar.bz2
Cleanup includes so Log.h can use the tag. rsUtils.h is the file that should be included everywhere and contain rs global defines.
Diffstat (limited to 'libs')
-rw-r--r--libs/rs/jni/RenderScript_jni.cpp1
-rw-r--r--libs/rs/rsAllocation.cpp3
-rw-r--r--libs/rs/rsComponent.h6
-rw-r--r--libs/rs/rsContext.cpp3
-rw-r--r--libs/rs/rsContext.h8
-rw-r--r--libs/rs/rsDevice.h4
-rw-r--r--libs/rs/rsElement.h2
-rw-r--r--libs/rs/rsLight.cpp123
-rw-r--r--libs/rs/rsLight.h62
-rw-r--r--libs/rs/rsLocklessFifo.cpp1
-rw-r--r--libs/rs/rsLocklessFifo.h5
-rw-r--r--libs/rs/rsMatrix.cpp2
-rw-r--r--libs/rs/rsObjectBase.cpp1
-rw-r--r--libs/rs/rsProgramFragment.cpp3
-rw-r--r--libs/rs/rsProgramFragmentStore.cpp3
-rw-r--r--libs/rs/rsProgramVertex.cpp3
-rw-r--r--libs/rs/rsSampler.cpp5
-rw-r--r--libs/rs/rsSampler.h5
-rw-r--r--libs/rs/rsScriptC.cpp3
-rw-r--r--libs/rs/rsThreadIO.cpp2
-rw-r--r--libs/rs/rsThreadIO.h6
-rw-r--r--libs/rs/rsTriangleMesh.cpp2
-rw-r--r--libs/rs/rsTriangleMesh.h11
-rw-r--r--libs/rs/rsUtils.h8
24 files changed, 219 insertions, 53 deletions
diff --git a/libs/rs/jni/RenderScript_jni.cpp b/libs/rs/jni/RenderScript_jni.cpp
index b592364..5ac1f3a 100644
--- a/libs/rs/jni/RenderScript_jni.cpp
+++ b/libs/rs/jni/RenderScript_jni.cpp
@@ -21,7 +21,6 @@
#include <math.h>
#include <utils/misc.h>
-#include <utils/Log.h>
#include <ui/EGLNativeWindowSurface.h>
#include <ui/Surface.h>
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index 3a01a75..dab3299 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -16,6 +16,9 @@
#include "rsContext.h"
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+
using namespace android;
using namespace android::renderscript;
diff --git a/libs/rs/rsComponent.h b/libs/rs/rsComponent.h
index 205e575..e1b0585 100644
--- a/libs/rs/rsComponent.h
+++ b/libs/rs/rsComponent.h
@@ -17,11 +17,7 @@
#ifndef ANDROID_RS_STRUCTURED_COMPONENT_H
#define ANDROID_RS_STRUCTURED_COMPONENT_H
-#include <stdint.h>
-#include <sys/types.h>
-#include <stdlib.h>
-
-#include "RenderScript.h"
+#include "rsUtils.h"
#include "rsObjectBase.h"
// ---------------------------------------------------------------------------
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 7c46c0e..0f78df4 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -19,6 +19,9 @@
#include "rsThreadIO.h"
#include "utils/String8.h"
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+
using namespace android;
using namespace android::renderscript;
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index 3f27751..26d665b 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -17,10 +17,6 @@
#ifndef ANDROID_RS_CONTEXT_H
#define ANDROID_RS_CONTEXT_H
-#include <utils/Vector.h>
-#include <ui/EGLNativeWindowSurface.h>
-#include <ui/Surface.h>
-
#include "rsType.h"
#include "rsMatrix.h"
#include "rsAllocation.h"
@@ -38,6 +34,10 @@
#include "rsgApiStructs.h"
#include "rsLocklessFifo.h"
+#include <ui/EGLNativeWindowSurface.h>
+#include <ui/Surface.h>
+
+
// ---------------------------------------------------------------------------
namespace android {
diff --git a/libs/rs/rsDevice.h b/libs/rs/rsDevice.h
index 3de3ffa..156315f 100644
--- a/libs/rs/rsDevice.h
+++ b/libs/rs/rsDevice.h
@@ -17,9 +17,7 @@
#ifndef ANDROID_RS_DEVICE_H
#define ANDROID_RS_DEVICE_H
-#include <utils/Vector.h>
-
-//#include "StructuredComponent.h"
+#include "rsUtils.h"
// ---------------------------------------------------------------------------
namespace android {
diff --git a/libs/rs/rsElement.h b/libs/rs/rsElement.h
index 2434977..ea6fa8f 100644
--- a/libs/rs/rsElement.h
+++ b/libs/rs/rsElement.h
@@ -17,8 +17,6 @@
#ifndef ANDROID_STRUCTURED_ELEMENT_H
#define ANDROID_STRUCTURED_ELEMENT_H
-#include <utils/Vector.h>
-
#include "rsComponent.h"
// ---------------------------------------------------------------------------
diff --git a/libs/rs/rsLight.cpp b/libs/rs/rsLight.cpp
new file mode 100644
index 0000000..67d0095
--- /dev/null
+++ b/libs/rs/rsLight.cpp
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2009 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.
+ */
+
+#include "rsContext.h"
+
+using namespace android;
+using namespace android::renderscript;
+
+
+Light::Light(bool isLocal, bool isMono)
+{
+ mIsLocal = isLocal;
+ mIsMono = isMono;
+
+ mX = 0;
+ mY = 0;
+ mZ = 0;
+
+ mR = 1.f;
+ mG = 1.f;
+ mB = 1.f;
+}
+
+Light::~Light()
+{
+}
+
+void Light::setPosition(float x, float y, float z)
+{
+ mX = x;
+ mY = y;
+ mZ = z;
+}
+
+void Light::setColor(float r, float g, float b)
+{
+ mR = r;
+ mG = g;
+ mB = b;
+}
+
+////////////////////////////////////////////
+
+LightState::LightState()
+{
+ clear();
+}
+
+LightState::~LightState()
+{
+}
+
+void LightState::clear()
+{
+ mIsLocal = false;
+ mIsMono = false;
+}
+
+
+////////////////////////////////////////////////////
+//
+
+namespace android {
+namespace renderscript {
+
+void rsi_LightBegin(Context *rsc)
+{
+ rsc->mStateLight.clear();
+}
+
+void rsi_LightSetLocal(Context *rsc, bool isLocal)
+{
+ rsc->mStateLight.mIsLocal = isLocal;
+}
+
+void rsi_LightSetMonochromatic(Context *rsc, bool isMono)
+{
+ rsc->mStateLight.mIsMono = isMono;
+}
+
+RsLight rsi_LightCreate(Context *rsc)
+{
+ Light *l = new Light(rsc->mStateLight.mIsLocal,
+ rsc->mStateLight.mIsMono);
+ l->incRef();
+ return l;
+}
+
+void rsi_LightDestroy(Context *rsc, RsLight vl)
+{
+ Light *l = static_cast<Light *>(vl);
+ l->decRef();
+}
+
+void rsi_LightSetColor(Context *rsc, RsLight vl, float r, float g, float b)
+{
+ Light *l = static_cast<Light *>(vl);
+ l->setColor(r, g, b);
+}
+
+void rsi_LightSetPosition(Context *rsc, RsLight vl, float x, float y, float z)
+{
+ Light *l = static_cast<Light *>(vl);
+ l->setPosition(x, y, z);
+}
+
+
+
+}
+}
diff --git a/libs/rs/rsLight.h b/libs/rs/rsLight.h
new file mode 100644
index 0000000..76d1ecc
--- /dev/null
+++ b/libs/rs/rsLight.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2009 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.
+ */
+
+#ifndef ANDROID_LIGHT_H
+#define ANDROID_LIGHT_H
+
+
+#include "rsObjectBase.h"
+
+// ---------------------------------------------------------------------------
+namespace android {
+namespace renderscript {
+
+
+// An element is a group of Components that occupies one cell in a structure.
+class Light : public ObjectBase
+{
+public:
+ Light(bool isLocal, bool isMono);
+ virtual ~Light();
+
+ // Values, mutable after creation.
+ void setPosition(float x, float y, float z);
+ void setColor(float r, float g, float b);
+
+protected:
+ float mR, mG, mB;
+ float mX, mY, mZ;
+ bool mIsLocal;
+ bool mIsMono;
+};
+
+
+class LightState {
+public:
+ LightState();
+ ~LightState();
+
+ void clear();
+
+ bool mIsMono;
+ bool mIsLocal;
+};
+
+
+}
+}
+#endif //ANDROID_LIGHT_H
+
diff --git a/libs/rs/rsLocklessFifo.cpp b/libs/rs/rsLocklessFifo.cpp
index 37ec14b..fae92e5 100644
--- a/libs/rs/rsLocklessFifo.cpp
+++ b/libs/rs/rsLocklessFifo.cpp
@@ -18,7 +18,6 @@
using namespace android;
-#include <utils/Log.h>
LocklessCommandFifo::LocklessCommandFifo()
{
diff --git a/libs/rs/rsLocklessFifo.h b/libs/rs/rsLocklessFifo.h
index 2f4d5c5..abeddf7 100644
--- a/libs/rs/rsLocklessFifo.h
+++ b/libs/rs/rsLocklessFifo.h
@@ -18,10 +18,7 @@
#define ANDROID_RS_LOCKLESS_FIFO_H
-#include <stdint.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <pthread.h>
+#include "rsUtils.h"
namespace android {
diff --git a/libs/rs/rsMatrix.cpp b/libs/rs/rsMatrix.cpp
index 258b836..5f68197 100644
--- a/libs/rs/rsMatrix.cpp
+++ b/libs/rs/rsMatrix.cpp
@@ -20,8 +20,6 @@
#include "string.h"
#include "math.h"
-#include <utils/Log.h>
-
using namespace android;
using namespace android::renderscript;
diff --git a/libs/rs/rsObjectBase.cpp b/libs/rs/rsObjectBase.cpp
index 8f5232a..6842c37 100644
--- a/libs/rs/rsObjectBase.cpp
+++ b/libs/rs/rsObjectBase.cpp
@@ -15,7 +15,6 @@
*/
#include "rsObjectBase.h"
-#include <utils/Log.h>
using namespace android;
using namespace android::renderscript;
diff --git a/libs/rs/rsProgramFragment.cpp b/libs/rs/rsProgramFragment.cpp
index 8777335..f9eb1b2 100644
--- a/libs/rs/rsProgramFragment.cpp
+++ b/libs/rs/rsProgramFragment.cpp
@@ -17,6 +17,9 @@
#include "rsContext.h"
#include "rsProgramFragment.h"
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+
using namespace android;
using namespace android::renderscript;
diff --git a/libs/rs/rsProgramFragmentStore.cpp b/libs/rs/rsProgramFragmentStore.cpp
index 96d37ae..0b65680 100644
--- a/libs/rs/rsProgramFragmentStore.cpp
+++ b/libs/rs/rsProgramFragmentStore.cpp
@@ -17,6 +17,9 @@
#include "rsContext.h"
#include "rsProgramFragmentStore.h"
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+
using namespace android;
using namespace android::renderscript;
diff --git a/libs/rs/rsProgramVertex.cpp b/libs/rs/rsProgramVertex.cpp
index 19afad5..ec66662 100644
--- a/libs/rs/rsProgramVertex.cpp
+++ b/libs/rs/rsProgramVertex.cpp
@@ -17,6 +17,9 @@
#include "rsContext.h"
#include "rsProgramVertex.h"
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+
using namespace android;
using namespace android::renderscript;
diff --git a/libs/rs/rsSampler.cpp b/libs/rs/rsSampler.cpp
index d89346e..418f127 100644
--- a/libs/rs/rsSampler.cpp
+++ b/libs/rs/rsSampler.cpp
@@ -14,16 +14,13 @@
* limitations under the License.
*/
-#include "rsContext.h"
-
-
#include <GLES/gl.h>
#include <GLES/glext.h>
-#include <utils/Log.h>
#include "rsContext.h"
#include "rsSampler.h"
+
using namespace android;
using namespace android::renderscript;
diff --git a/libs/rs/rsSampler.h b/libs/rs/rsSampler.h
index 45d8c61..4b504f6 100644
--- a/libs/rs/rsSampler.h
+++ b/libs/rs/rsSampler.h
@@ -17,11 +17,6 @@
#ifndef ANDROID_RS_SAMPLER_H
#define ANDROID_RS_SAMPLER_H
-#include <math.h>
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
#include "rsAllocation.h"
#include "RenderScript.h"
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index e170b8c..27c13bd 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -21,6 +21,9 @@
#include "acc/acc.h"
#include "utils/String8.h"
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+
using namespace android;
using namespace android::renderscript;
diff --git a/libs/rs/rsThreadIO.cpp b/libs/rs/rsThreadIO.cpp
index 5641581..5f62ad1 100644
--- a/libs/rs/rsThreadIO.cpp
+++ b/libs/rs/rsThreadIO.cpp
@@ -16,8 +16,6 @@
#include "rsContext.h"
-#include <utils/Log.h>
-
#include "rsThreadIO.h"
using namespace android;
diff --git a/libs/rs/rsThreadIO.h b/libs/rs/rsThreadIO.h
index 973ee05..72746c5 100644
--- a/libs/rs/rsThreadIO.h
+++ b/libs/rs/rsThreadIO.h
@@ -17,11 +17,7 @@
#ifndef ANDROID_RS_THREAD_IO_H
#define ANDROID_RS_THREAD_IO_H
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "RenderScript.h"
-
+#include "rsUtils.h"
#include "rsLocklessFifo.h"
// ---------------------------------------------------------------------------
diff --git a/libs/rs/rsTriangleMesh.cpp b/libs/rs/rsTriangleMesh.cpp
index 6595ebc..f26b765 100644
--- a/libs/rs/rsTriangleMesh.cpp
+++ b/libs/rs/rsTriangleMesh.cpp
@@ -22,8 +22,6 @@ using namespace android::renderscript;
#include <GLES/gl.h>
#include <GLES/glext.h>
-#include <utils/Log.h>
-
TriangleMesh::TriangleMesh()
{
mVertexElement = NULL;
diff --git a/libs/rs/rsTriangleMesh.h b/libs/rs/rsTriangleMesh.h
index 4e15d5a..e56c7c2 100644
--- a/libs/rs/rsTriangleMesh.h
+++ b/libs/rs/rsTriangleMesh.h
@@ -17,15 +17,6 @@
#ifndef ANDROID_RS_TRIANGLE_MESH_H
#define ANDROID_RS_TRIANGLE_MESH_H
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <math.h>
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <utils/Vector.h>
#include "RenderScript.h"
@@ -60,7 +51,7 @@ public:
size_t mSizeNorm;
// GL buffer info
- GLuint mBufferObjects[2];
+ uint32_t mBufferObjects[2];
void analyzeElement();
protected:
diff --git a/libs/rs/rsUtils.h b/libs/rs/rsUtils.h
index 5a43fb3..0a31097 100644
--- a/libs/rs/rsUtils.h
+++ b/libs/rs/rsUtils.h
@@ -17,9 +17,13 @@
#ifndef ANDROID_RS_UTILS_H
#define ANDROID_RS_UTILS_H
-#include <stdint.h>
-#include <sys/types.h>
+#include "RenderScript.h"
+
+#define LOG_TAG "rs"
+#include <utils/Log.h>
+#include <utils/Vector.h>
#include <stdlib.h>
+#include <pthread.h>
namespace android {
namespace renderscript {