From 6cd4656bf11d45ebac40a382c0c8bcb9a21f00cc Mon Sep 17 00:00:00 2001 From: Jamie Gennis Date: Thu, 10 Mar 2011 14:49:00 -0800 Subject: [PATCH 1/2] gl2_yuvtex: use the gralloc-provided stride. This change fixes the gl2_yuvtex test to use the stride chosen by the gralloc implementation rather than hard-coding it. Bug: 4081948 Change-Id: If7c96a20fc3fb1df2ff25e6afaa9f34dbad2002c --- opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp b/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp index 602ea1aa277dd..f0b8d1259a2c6 100644 --- a/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp +++ b/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp @@ -186,11 +186,6 @@ const int yuvTexUsage = GraphicBuffer::USAGE_HW_TEXTURE | GraphicBuffer::USAGE_SW_WRITE_RARELY; const int yuvTexFormat = HAL_PIXEL_FORMAT_YV12; const int yuvTexOffsetY = 0; -const int yuvTexStrideY = (yuvTexWidth + 0xf) & ~0xf; -const int yuvTexOffsetV = yuvTexStrideY * yuvTexHeight; -const int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf; -const int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * yuvTexHeight/2; -const int yuvTexStrideU = yuvTexStrideV; const bool yuvTexSameUV = false; static sp yuvTexBuffer; static GLuint yuvTex; @@ -200,6 +195,11 @@ bool setupYuvTexSurface(EGLDisplay dpy, EGLContext context) { int blockHeight = yuvTexHeight > 16 ? yuvTexHeight / 16 : 1; yuvTexBuffer = new GraphicBuffer(yuvTexWidth, yuvTexHeight, yuvTexFormat, yuvTexUsage); + int yuvTexStrideY = yuvTexBuffer->getStride(); + int yuvTexOffsetV = yuvTexStrideY * yuvTexHeight; + int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf; + int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * yuvTexHeight/2; + int yuvTexStrideU = yuvTexStrideV; char* buf = NULL; status_t err = yuvTexBuffer->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&buf)); if (err != 0) { From cc8fa160fbfcd17f369c15a2d33959fbb090ac6e Mon Sep 17 00:00:00 2001 From: Huahui Wu Date: Sun, 13 Mar 2011 18:13:42 -0700 Subject: [PATCH 2/2] b/3392594 keep the remain touch points when one is ended. This is the Java side code change for b/3392594. It adds an action index into the touch event data and pass it to the native side. Change-Id: Ibb393e62a590d0fff1dd3172041748e2b10501d6 --- core/java/android/webkit/WebView.java | 4 ++++ core/java/android/webkit/WebViewCore.java | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 8ef745b1ea3d0..4aa1f5eeeb184 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -5964,6 +5964,10 @@ public class WebView extends AbsoluteLayout int y = viewToContentY((int) ev.getY(c) + mScrollY); ted.mPoints[c] = new Point(x, y); } + if (ted.mAction == MotionEvent.ACTION_POINTER_DOWN + || ted.mAction == MotionEvent.ACTION_POINTER_UP) { + ted.mActionIndex = ev.getActionIndex(); + } ted.mMetaState = ev.getMetaState(); ted.mReprocess = true; ted.mMotionEvent = MotionEvent.obtain(ev); diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 979eb2b063c4e..bed77ef7357cc 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -572,7 +572,7 @@ final class WebViewCore { int framePtr, int nodePtr, int x, int y); private native boolean nativeHandleTouchEvent(int action, int[] idArray, - int[] xArray, int[] yArray, int count, int metaState); + int[] xArray, int[] yArray, int count, int actionIndex, int metaState); private native void nativeUpdateFrameCache(); @@ -829,6 +829,7 @@ final class WebViewCore { int mAction; int[] mIds; // Ids of the touch points Point[] mPoints; + int mActionIndex; // Associated pointer index for ACTION_POINTER_DOWN/UP int mMetaState; boolean mReprocess; MotionEvent mMotionEvent; @@ -1344,7 +1345,7 @@ final class WebViewCore { ted.mNativeLayerRect); } ted.mNativeResult = nativeHandleTouchEvent(ted.mAction, ted.mIds, - xArray, yArray, count, ted.mMetaState); + xArray, yArray, count, ted.mActionIndex, ted.mMetaState); Message.obtain( mWebView.mPrivateHandler, WebView.PREVENT_TOUCH_ID,