Bug 732091 - Part 4: Add JNI-exposed functions on GeckoLayerClient to allow the compositor to update various properties. r=Cwiiis

This commit is contained in:
Kartikaya Gupta
2012-03-12 11:50:21 -04:00
parent 924f6e0e56
commit 7e287d9a19
5 changed files with 79 additions and 0 deletions

View File

@@ -113,6 +113,8 @@ jmethodID AndroidAddress::jGetThoroughfareMethod;
jclass AndroidGeckoLayerClient::jGeckoLayerClientClass = 0;
jmethodID AndroidGeckoLayerClient::jBeginDrawingMethod = 0;
jmethodID AndroidGeckoLayerClient::jEndDrawingMethod = 0;
jmethodID AndroidGeckoLayerClient::jSetFirstPaintViewport = 0;
jmethodID AndroidGeckoLayerClient::jSetPageSize = 0;
jmethodID AndroidGeckoLayerClient::jGetViewTransformMethod = 0;
jmethodID AndroidGeckoLayerClient::jCreateFrameMethod = 0;
jmethodID AndroidGeckoLayerClient::jActivateProgramMethod = 0;
@@ -349,6 +351,8 @@ AndroidGeckoLayerClient::InitGeckoLayerClientClass(JNIEnv *jEnv)
jBeginDrawingMethod = getMethod("beginDrawing", "(IILjava/lang/String;)Z");
jEndDrawingMethod = getMethod("endDrawing", "()V");
jSetFirstPaintViewport = getMethod("setFirstPaintViewport", "(FFFFF)V");
jSetPageSize = getMethod("setPageSize", "(FFF)V");
jGetViewTransformMethod = getMethod("getViewTransform",
"()Lorg/mozilla/gecko/gfx/ViewTransform;");
jCreateFrameMethod = getMethod("createFrame", "()Lorg/mozilla/gecko/gfx/LayerRenderer$Frame;");
@@ -789,6 +793,30 @@ AndroidGeckoLayerClient::EndDrawing()
return env->CallVoidMethod(wrapped_obj, jEndDrawingMethod);
}
void
AndroidGeckoLayerClient::SetFirstPaintViewport(float aOffsetX, float aOffsetY, float aZoom, float aPageWidth, float aPageHeight)
{
NS_ASSERTION(!isNull(), "SetFirstPaintViewport called on null layer client!");
JNIEnv *env = GetJNIForThread();
if (!env)
return;
AndroidBridge::AutoLocalJNIFrame jniFrame(env);
return env->CallVoidMethod(wrapped_obj, jSetFirstPaintViewport, aOffsetX, aOffsetY, aZoom, aPageWidth, aPageHeight);
}
void
AndroidGeckoLayerClient::SetPageSize(float aZoom, float aPageWidth, float aPageHeight)
{
NS_ASSERTION(!isNull(), "SetPageSize called on null layer client!");
JNIEnv *env = GetJNIForThread();
if (!env)
return;
AndroidBridge::AutoLocalJNIFrame jniFrame(env);
return env->CallVoidMethod(wrapped_obj, jSetPageSize, aZoom, aPageWidth, aPageHeight);
}
jobject
AndroidGeckoSurfaceView::GetSoftwareDrawBitmap()
{