Expose ActivateProgram() and DeactivateProgram() to widget

This commit is contained in:
Patrick Walton 2012-02-13 13:55:10 -08:00
Родитель ab605909db
Коммит 7a4fea4098
3 изменённых файлов: 42 добавлений и 0 удалений

Просмотреть файл

@ -239,5 +239,15 @@ public class GeckoGLLayerClient extends GeckoLayerClient
Layer.RenderContext screenContext = mLayerRenderer.createScreenContext();
return mLayerRenderer.createFrame(false, pageContext, screenContext);
}
/** For Gecko to use. */
public void activateProgram() {
mLayerRenderer.activateProgram();
}
/** For Gecko to use. */
public void deactivateProgram() {
mLayerRenderer.deactivateProgram();
}
}

Просмотреть файл

@ -121,6 +121,8 @@ jmethodID AndroidGeckoSoftwareLayerClient::jGetRenderOffsetMethod = 0;
jclass AndroidGeckoGLLayerClient::jGeckoGLLayerClientClass = 0;
jmethodID AndroidGeckoGLLayerClient::jGetViewTransformMethod = 0;
jmethodID AndroidGeckoGLLayerClient::jCreateFrameMethod = 0;
jmethodID AndroidGeckoGLLayerClient::jActivateProgramMethod = 0;
jmethodID AndroidGeckoGLLayerClient::jDeactivateProgramMethod = 0;
jclass AndroidLayerRendererFrame::jLayerRendererFrameClass = 0;
jmethodID AndroidLayerRendererFrame::jBeginDrawingMethod = 0;
@ -387,6 +389,8 @@ AndroidGeckoGLLayerClient::InitGeckoGLLayerClientClass(JNIEnv *jEnv)
"()Lorg/mozilla/gecko/gfx/ViewTransform;");
jCreateFrameMethod = getMethod("createFrame",
"(FFF)Lorg/mozilla/gecko/gfx/LayerRenderer$Frame;");
jActivateProgramMethod = getMethod("activateProgram", "()V");
jDeactivateProgramMethod = getMethod("deactivateProgram", "()V");
#endif
}
@ -942,6 +946,30 @@ AndroidGeckoGLLayerClient::CreateFrame(AndroidLayerRendererFrame& aFrame,
aFrame.Init(frameJObj);
}
void
AndroidGeckoGLLayerClient::ActivateProgram()
{
JNIEnv *env = GetJNIForThread();
NS_ABORT_IF_FALSE(env, "No JNI environment at ActivateProgram()!");
if (!env) {
return;
}
env->CallVoidMethod(wrapped_obj, jActivateProgramMethod);
}
void
AndroidGeckoGLLayerClient::DeactivateProgram()
{
JNIEnv *env = GetJNIForThread();
NS_ABORT_IF_FALSE(env, "No JNI environment at DeactivateProgram()!");
if (!env) {
return;
}
env->CallVoidMethod(wrapped_obj, jDeactivateProgramMethod);
}
void
AndroidLayerRendererFrame::BeginDrawing()
{

Просмотреть файл

@ -272,11 +272,15 @@ public:
void GetViewTransform(AndroidViewTransform& aViewTransform);
void CreateFrame(AndroidLayerRendererFrame& aFrame, float aXOffset, float aYOffset,
float aZoomFactor);
void ActivateProgram();
void DeactivateProgram();
private:
static jclass jGeckoGLLayerClientClass;
static jmethodID jGetViewTransformMethod;
static jmethodID jCreateFrameMethod;
static jmethodID jActivateProgramMethod;
static jmethodID jDeactivateProgramMethod;
AndroidGeckoGLLayerClientViewTransformGetter mViewTransformGetter;
};