Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc8a8e8c authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Add support for partial invalidates in WebView Bug #3461349" into honeycomb-mr1

parents 823f5bf3 cabfcc13
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -245,11 +245,12 @@ class GLES20Canvas extends HardwareCanvas {
    private static native void nDestroyDisplayList(int displayList);

    @Override
    public boolean drawDisplayList(DisplayList displayList) {
        return nDrawDisplayList(mRenderer, ((GLES20DisplayList) displayList).mNativeDisplayList);
    public boolean drawDisplayList(DisplayList displayList, Rect dirty) {
        return nDrawDisplayList(mRenderer,
                ((GLES20DisplayList) displayList).mNativeDisplayList, dirty);
    }

    private static native boolean nDrawDisplayList(int renderer, int displayList);
    private static native boolean nDrawDisplayList(int renderer, int displayList, Rect dirty);

    ///////////////////////////////////////////////////////////////////////////
    // Hardware layer
+6 −1
Original line number Diff line number Diff line
@@ -53,8 +53,13 @@ public abstract class HardwareCanvas extends Canvas {
     * Draws the specified display list onto this canvas.
     * 
     * @param displayList The display list to replay.
     * @param dirty The dirty region to redraw in the next pass, matters only
     *        if this method returns true, can be null.
     * 
     * @return True if the content of the display list requires another
     *         drawing pass (invalidate()), false otherwise
     */
    abstract boolean drawDisplayList(DisplayList displayList);
    abstract boolean drawDisplayList(DisplayList displayList, Rect dirty);

    /**
     * Draws the specified layer onto this canvas.
+12 −5
Original line number Diff line number Diff line
@@ -285,6 +285,8 @@ public abstract class HardwareRenderer {

        private boolean mDestroyed;
        
        private final Rect mRedrawClip = new Rect();

        GlRenderer(int glVersion, boolean translucent) {
            mGlVersion = glVersion;
            mTranslucent = translucent;
@@ -606,8 +608,13 @@ public abstract class HardwareRenderer {

                        DisplayList displayList = view.getDisplayList();
                        if (displayList != null) {
                            if (canvas.drawDisplayList(displayList)) {
                            if (canvas.drawDisplayList(displayList, mRedrawClip)) {
                                if (mRedrawClip.isEmpty()) {
                                    view.invalidate();
                                } else {
                                    view.getParent().invalidateChild(view, mRedrawClip);
                                }
                                mRedrawClip.setEmpty();
                            }
                        } else {
                            // Shouldn't reach here
@@ -646,8 +653,8 @@ public abstract class HardwareRenderer {
        private int checkCurrent() {
            // TODO: Don't check the current context when we have one per UI thread
            // TODO: Use a threadlocal flag to know whether the surface has changed
            if (sEgl.eglGetCurrentContext() != sEglContext ||
                    sEgl.eglGetCurrentSurface(EGL10.EGL_DRAW) != mEglSurface) {
            if (!sEglContext.equals(sEgl.eglGetCurrentContext()) ||
                    !mEglSurface.equals(sEgl.eglGetCurrentSurface(EGL10.EGL_DRAW))) {
                if (!sEgl.eglMakeCurrent(sEglDisplay, mEglSurface, mEglSurface, sEglContext)) {
                    fallback(true);
                    Log.e(LOG_TAG, "eglMakeCurrent failed " +
+1 −1
Original line number Diff line number Diff line
@@ -2585,7 +2585,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                    }
                } else {
                    child.mPrivateFlags &= ~DIRTY_MASK;
                    ((HardwareCanvas) canvas).drawDisplayList(displayList);
                    ((HardwareCanvas) canvas).drawDisplayList(displayList, null);
                }
            }
        } else if (cache != null) {
+9 −5
Original line number Diff line number Diff line
@@ -351,7 +351,8 @@ public class WebView extends AbsoluteLayout

    private ZoomManager mZoomManager;

    private Rect mGLRectViewport = new Rect();
    private final Rect mGLRectViewport = new Rect();
    private final Rect mViewRectViewport = new Rect();
    private boolean mGLViewportEmpty = false;

    /**
@@ -4152,7 +4153,7 @@ public class WebView extends AbsoluteLayout

        if (canvas.isHardwareAccelerated()) {
            int functor = nativeGetDrawGLFunction(mGLViewportEmpty ? null : mGLRectViewport,
                    getScale(), extras);
                    mGLViewportEmpty ? null : mViewRectViewport, getScale(), extras);
            ((HardwareCanvas) canvas).callDrawGLFunction(functor);
        } else {
            DrawFilter df = null;
@@ -5258,6 +5259,7 @@ public class WebView extends AbsoluteLayout
            // Then need to invert the Y axis, just for GL
            View rootView = getRootView();
            int rootViewHeight = rootView.getHeight();
            mViewRectViewport.set(mGLRectViewport);
            int savedWebViewBottom = mGLRectViewport.bottom;
            mGLRectViewport.bottom = rootViewHeight - mGLRectViewport.top - getVisibleTitleHeight();
            mGLRectViewport.top = rootViewHeight - savedWebViewBottom;
@@ -5265,7 +5267,8 @@ public class WebView extends AbsoluteLayout
        } else {
            mGLViewportEmpty = true;
        }
        nativeUpdateDrawGLFunction(mGLViewportEmpty ? null : mGLRectViewport);
        nativeUpdateDrawGLFunction(mGLViewportEmpty ? null : mGLRectViewport,
                mGLViewportEmpty ? null : mViewRectViewport);
    }

    /**
@@ -8531,8 +8534,9 @@ public class WebView extends AbsoluteLayout
            boolean splitIfNeeded);
    private native void     nativeDumpDisplayTree(String urlOrNull);
    private native boolean  nativeEvaluateLayersAnimations();
    private native int      nativeGetDrawGLFunction(Rect rect, float scale, int extras);
    private native void     nativeUpdateDrawGLFunction(Rect rect);
    private native int      nativeGetDrawGLFunction(Rect rect, Rect viewRect,
            float scale, int extras);
    private native void     nativeUpdateDrawGLFunction(Rect rect, Rect viewRect);
    private native boolean  nativeDrawGL(Rect rect, float scale, int extras);
    private native void     nativeExtendSelection(int x, int y);
    private native int      nativeFindAll(String findLower, String findUpper,
Loading