diff options
author | Romain Guy <romainguy@android.com> | 2010-06-26 00:13:53 -0700 |
---|---|---|
committer | Romain Guy <romainguy@android.com> | 2010-06-26 00:13:53 -0700 |
commit | bd6b79b40247aea7bfe13d0831c6c0472df6c636 (patch) | |
tree | 71c913ec50df87a9463e30c8a28e5cb29e734c79 /core/jni | |
parent | 7ae7ac48aa2b53453c9805075171ecd5bcafd7de (diff) | |
download | frameworks_base-bd6b79b40247aea7bfe13d0831c6c0472df6c636.zip frameworks_base-bd6b79b40247aea7bfe13d0831c6c0472df6c636.tar.gz frameworks_base-bd6b79b40247aea7bfe13d0831c6c0472df6c636.tar.bz2 |
Add implementations for saveLayerAlpha() and textured rects.
Even though there's an implementation for textured rects, drawBitmap() is not
hooked up yet as it will require a good texture cache.
This method is implemented using FBOs. There's currently an issue either in the
driver or in the Canvas renderer that forces the FBO to be fullscreen, which is
extremely expensive and yields terrible performance.
Change-Id: I148419195e12d45653c60186938aa78c23a68e2c
Diffstat (limited to 'core/jni')
-rw-r--r-- | core/jni/android_view_GLES20Canvas.cpp | 67 |
1 files changed, 43 insertions, 24 deletions
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp index d3b6558..fd9ce44 100644 --- a/core/jni/android_view_GLES20Canvas.cpp +++ b/core/jni/android_view_GLES20Canvas.cpp @@ -92,6 +92,22 @@ static void android_view_GLES20Renderer_restoreToCount(JNIEnv* env, jobject canv } // ---------------------------------------------------------------------------- +// Layers +// ---------------------------------------------------------------------------- + +static jint android_view_GLES20Renderer_saveLayer(JNIEnv* env, jobject canvas, + OpenGLRenderer* renderer, jfloat left, jfloat top, jfloat right, jfloat bottom, + SkPaint* paint, jint saveFlags) { + return renderer->saveLayer(left, top, right, bottom, paint, saveFlags); +} + +static jint android_view_GLES20Renderer_saveLayerAlpha(JNIEnv* env, jobject canvas, + OpenGLRenderer* renderer, jfloat left, jfloat top, jfloat right, jfloat bottom, + jint alpha, jint saveFlags) { + return renderer->saveLayerAlpha(left, top, right, bottom, alpha, saveFlags); +} + +// ---------------------------------------------------------------------------- // Clipping // ---------------------------------------------------------------------------- @@ -178,30 +194,33 @@ static void android_view_GLES20Renderer_drawRect(JNIEnv* env, jobject canvas, 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 }, - - { "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 }, - - { "nQuickReject", "(IFFFFI)Z", (void*) android_view_GLES20Renderer_quickReject }, - { "nClipRect", "(IFFFF)Z", (void*) android_view_GLES20Renderer_clipRectF }, - { "nClipRect", "(IIIII)Z", (void*) android_view_GLES20Renderer_clipRect }, - - { "nTranslate", "(IFF)V", (void*) android_view_GLES20Renderer_translate }, - { "nRotate", "(IF)V", (void*) android_view_GLES20Renderer_rotate }, - { "nScale", "(IFF)V", (void*) android_view_GLES20Renderer_scale }, - - { "nSetMatrix", "(II)V", (void*) android_view_GLES20Renderer_setMatrix }, - { "nGetMatrix", "(II)V", (void*) android_view_GLES20Renderer_getMatrix }, - { "nConcatMatrix", "(II)V", (void*) android_view_GLES20Renderer_concatMatrix }, - - { "nDrawColor", "(III)V", (void*) android_view_GLES20Renderer_drawColor }, - { "nDrawRect", "(IFFFFI)V", (void*) android_view_GLES20Renderer_drawRect }, + { "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 }, + + { "nSaveLayer", "(IFFFFII)I", (void*) android_view_GLES20Renderer_saveLayer }, + { "nSaveLayerAlpha", "(IFFFFII)I", (void*) android_view_GLES20Renderer_saveLayerAlpha }, + + { "nQuickReject", "(IFFFFI)Z", (void*) android_view_GLES20Renderer_quickReject }, + { "nClipRect", "(IFFFF)Z", (void*) android_view_GLES20Renderer_clipRectF }, + { "nClipRect", "(IIIII)Z", (void*) android_view_GLES20Renderer_clipRect }, + + { "nTranslate", "(IFF)V", (void*) android_view_GLES20Renderer_translate }, + { "nRotate", "(IF)V", (void*) android_view_GLES20Renderer_rotate }, + { "nScale", "(IFF)V", (void*) android_view_GLES20Renderer_scale }, + + { "nSetMatrix", "(II)V", (void*) android_view_GLES20Renderer_setMatrix }, + { "nGetMatrix", "(II)V", (void*) android_view_GLES20Renderer_getMatrix }, + { "nConcatMatrix", "(II)V", (void*) android_view_GLES20Renderer_concatMatrix }, + + { "nDrawColor", "(III)V", (void*) android_view_GLES20Renderer_drawColor }, + { "nDrawRect", "(IFFFFI)V", (void*) android_view_GLES20Renderer_drawRect }, { "nGetClipBounds", "(ILandroid/graphics/Rect;)Z", (void*) android_view_GLES20Renderer_getClipBounds }, |