From a144ac64329978c258faadf3bc484cf4ae6c5d0d Mon Sep 17 00:00:00 2001 From: John Reck Date: Wed, 14 Mar 2012 21:06:41 -0700 Subject: Canvas on a texture Change-Id: I841b3e021298738c91701068992798a55290a520 --- Source/WebKit/android/nav/WebView.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'Source/WebKit/android/nav/WebView.cpp') diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index eddf0ab..0b2eaf6 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -633,6 +633,17 @@ void mapLayerRect(int layerId, SkIRect& rect) { } } +// This is called when WebView switches rendering modes in a more permanent fashion +// such as when the layer type is set or the view is attached/detached from the window +int setHwAccelerated(bool hwAccelerated) { + if (!m_glWebViewState) + return 0; + LayerAndroid* root = compositeRoot(); + if (root) + return root->setHwAccelerated(hwAccelerated); + return 0; +} + bool m_isDrawingPaused; private: // local state for WebView // private to getFrameCache(); other functions operate in a different thread @@ -1176,6 +1187,13 @@ static void nativeMapLayerRect(JNIEnv *env, jobject obj, jint nativeView, GraphicsJNI::irect_to_jrect(nativeRect, env, rect); } +static jint nativeSetHwAccelerated(JNIEnv *env, jobject obj, jint nativeView, + jboolean hwAccelerated) +{ + WebView* webview = reinterpret_cast(nativeView); + return webview->setHwAccelerated(hwAccelerated); +} + /* * JNI registration */ @@ -1254,6 +1272,8 @@ static JNINativeMethod gJavaWebViewMethods[] = { (void*) nativeIsBaseFirst }, { "nativeMapLayerRect", "(IILandroid/graphics/Rect;)V", (void*) nativeMapLayerRect }, + { "nativeSetHwAccelerated", "(IZ)I", + (void*) nativeSetHwAccelerated }, }; int registerWebView(JNIEnv* env) -- cgit v1.1