summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-06-22 18:56:38 -0700
committerRomain Guy <romainguy@google.com>2010-06-23 12:36:03 -0700
commitbb9524b6bdddc7ac77d8628daa8b366b8a7be4a4 (patch)
treeb38978e88e8434e0a4bd8ac8e5c70bf2af26b3ea /core/jni
parent03f0292744094ec107ffce71301c394503a31ded (diff)
downloadframeworks_base-bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4.zip
frameworks_base-bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4.tar.gz
frameworks_base-bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4.tar.bz2
Add implementations for clipRect(), save() and restore().
The current implementation of clipRect() does not apply local transformations before setting the new clip. Change-Id: I5997871bb638dfcd1a8ef96354846af52427e445
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android_view_GLES20Canvas.cpp60
1 files changed, 54 insertions, 6 deletions
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index 5766083..8c2a04c 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -54,7 +54,47 @@ static void android_view_GLES20Renderer_prepare(JNIEnv* env, jobject canvas, jin
}
// ----------------------------------------------------------------------------
-// Draw color
+// State
+// ----------------------------------------------------------------------------
+
+static jint android_view_GLES20Renderer_save(JNIEnv* env, jobject canvas, jint renderer,
+ jint flags) {
+
+ return UI->save(flags);
+}
+
+static jint android_view_GLES20Renderer_getSaveCount(JNIEnv* env, jobject canvas, jint renderer) {
+ return UI->getSaveCount();
+}
+
+static void android_view_GLES20Renderer_restore(JNIEnv* env, jobject canvas, jint renderer) {
+ UI->restore();
+}
+
+static void android_view_GLES20Renderer_restoreToCount(JNIEnv* env, jobject canvas, jint renderer,
+ jint saveCount) {
+
+ UI->restoreToCount(saveCount);
+}
+
+// ----------------------------------------------------------------------------
+// Clipping
+// ----------------------------------------------------------------------------
+
+static bool android_view_GLES20Renderer_clipRectF(JNIEnv* env, jobject canvas, jint renderer,
+ jfloat left, jfloat top, jfloat right, jfloat bottom) {
+
+ return UI->clipRect(left, top, right, bottom);
+}
+
+static bool android_view_GLES20Renderer_clipRect(JNIEnv* env, jobject canvas, jint renderer,
+ jint left, jint top, jint right, jint bottom) {
+
+ return UI->clipRect(float(left), float(top), float(right), float(bottom));
+}
+
+// ----------------------------------------------------------------------------
+// Drawing
// ----------------------------------------------------------------------------
static void android_view_GLES20Renderer_drawColor(JNIEnv* env, jobject canvas, jint renderer,
@@ -70,12 +110,20 @@ static void android_view_GLES20Renderer_drawColor(JNIEnv* env, jobject canvas, j
const char* const kClassPathName = "android/view/GLES20Canvas";
static JNINativeMethod gMethods[] = {
- { "nCreateRenderer", "()I", (void*) android_view_GLES20Renderer_createRenderer },
- { "nDestroyRenderer", "(I)V", (void*) android_view_GLES20Renderer_destroyRenderer },
- { "nSetViewport", "(III)V", (void*) android_view_GLES20Renderer_setViewport },
- { "nPrepare", "(I)V", (void*) android_view_GLES20Renderer_prepare },
+ { "nCreateRenderer", "()I", (void*) android_view_GLES20Renderer_createRenderer },
+ { "nDestroyRenderer", "(I)V", (void*) android_view_GLES20Renderer_destroyRenderer },
+ { "nSetViewport", "(III)V", (void*) android_view_GLES20Renderer_setViewport },
+ { "nPrepare", "(I)V", (void*) android_view_GLES20Renderer_prepare },
+
+ { "nSave", "(II)I", (void*) android_view_GLES20Renderer_save },
+ { "nRestore", "(I)V", (void*) android_view_GLES20Renderer_restore },
+ { "nRestoreToCount", "(II)V", (void*) android_view_GLES20Renderer_restoreToCount },
+ { "nGetSaveCount", "(I)I", (void*) android_view_GLES20Renderer_getSaveCount },
+
+ { "nClipRect", "(IFFFF)Z", (void*) android_view_GLES20Renderer_clipRectF },
+ { "nClipRect", "(IIIII)Z", (void*) android_view_GLES20Renderer_clipRect },
- { "nDrawColor", "(III)V", (void*) android_view_GLES20Renderer_drawColor },
+ { "nDrawColor", "(III)V", (void*) android_view_GLES20Renderer_drawColor },
};
int register_android_view_GLES20Canvas(JNIEnv* env) {