diff options
author | michaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-23 06:58:08 +0000 |
---|---|---|
committer | michaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-23 06:58:08 +0000 |
commit | 33af16f820b0a1a762851cd758c3d8956a76bbe5 (patch) | |
tree | 36f3da4dbf8035625e607255898ce9acf2f047ed /android_webview/java | |
parent | 147408a5e03460dfa439cb25c41f2d9cabf8f7e1 (diff) | |
download | chromium_src-33af16f820b0a1a762851cd758c3d8956a76bbe5.zip chromium_src-33af16f820b0a1a762851cd758c3d8956a76bbe5.tar.gz chromium_src-33af16f820b0a1a762851cd758c3d8956a76bbe5.tar.bz2 |
Add requestDrawGL method in InternalAccessDelegate
so, compositor (via AwContents) can request a GL functor callback outside of draw cycle.
BUG=233284
Review URL: https://chromiumcodereview.appspot.com/13877017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195746 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/java')
-rw-r--r-- | android_webview/java/src/org/chromium/android_webview/AwContents.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java index ecfb146..5db2093 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java @@ -91,6 +91,17 @@ public class AwContents { * @see View#setMeasuredDimension(int, int) */ void setMeasuredDimension(int measuredWidth, int measuredHeight); + + /** + * Requests a callback on the native DrawGL method (see getAwDrawGLFunction) + * if called from within onDraw, |canvas| will be non-null and hardware accelerated. + * otherwise, |canvas| will be null, and the container view itself will be hardware + * accelerated. + * + * @return false indicates the GL draw request was not accepted, and the caller + * should fallback to the SW path. + */ + boolean requestDrawGL(Canvas canvas); } private int mNativeAwContents; @@ -390,6 +401,7 @@ public class AwContents { return nativeGetAwDrawGLViewContext(mNativeAwContents); } + // TODO(michaelbai) : Remove this method once it is not called. public boolean onPrepareDrawGL(Canvas canvas) { if (mNativeAwContents == 0) return false; nativeSetScrollForHWFrame(mNativeAwContents, @@ -401,6 +413,10 @@ public class AwContents { public void onDraw(Canvas canvas) { if (mNativeAwContents == 0) return; + if (canvas.isHardwareAccelerated() && onPrepareDrawGL(canvas) && + mInternalAccessAdapter.requestDrawGL(canvas)) { + return; + } Rect clip = canvas.getClipBounds(); if (!nativeDrawSW(mNativeAwContents, canvas, clip.left, clip.top, clip.right - clip.left, clip.bottom - clip.top)) { |