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

Commit 67a9f2ab authored by Nicolas Roard's avatar Nicolas Roard
Browse files

GL Rendering

This is a two-parts CL, Its counterpart is https://android-git.corp.google.com/g/#change,71690

Change-Id: I8ebe7f3bce84e76c903908768d010f46f3a30a4c
parent 1b0133a4
Loading
Loading
Loading
Loading
+41 −14
Original line number Diff line number Diff line
@@ -1965,7 +1965,7 @@ public class WebView extends AbsoluteLayout
    public void clearView() {
        mContentWidth = 0;
        mContentHeight = 0;
        if (mNativeClass != 0) nativeSetBaseLayer(0);
        setBaseLayer(0, null);
        mWebViewCore.sendMessage(EventHub.CLEAR_CONTENT);
    }

@@ -3619,6 +3619,17 @@ public class WebView extends AbsoluteLayout
        }
    }

    void setBaseLayer(int layer, Rect invalRect) {
        if (mNativeClass == 0)
            return;
        if (invalRect == null) {
            Rect rect = new Rect(0, 0, mContentWidth, mContentHeight);
            nativeSetBaseLayer(layer, rect);
        } else {
            nativeSetBaseLayer(layer, invalRect);
        }
    }

    private void onZoomAnimationStart() {
        // If it is in password mode, turn it off so it does not draw misplaced.
        if (inEditingMode() && nativeFocusCandidateIsPassword()) {
@@ -3719,6 +3730,20 @@ public class WebView extends AbsoluteLayout
        } else if (drawCursorRing) {
            extras = DRAW_EXTRAS_CURSOR_RING;
        }

        if (canvas.isHardwareAccelerated()) {
            try {
                if (canvas.acquireContext()) {
                      Rect rect = new Rect(getLeft(), getTop(), getRight(),
                                           getBottom() - getVisibleTitleHeight());
                      if (nativeDrawGL(rect, getScale(), extras)) {
                          invalidate();
                      }
                }
            } finally {
                canvas.releaseContext();
            }
        } else {
            DrawFilter df = null;
            if (mZoomManager.isZoomAnimating() || UIAnimationsRunning) {
                df = mZoomFilter;
@@ -3731,6 +3756,7 @@ public class WebView extends AbsoluteLayout
            if (content != 0) {
                mWebViewCore.sendMessage(EventHub.SPLIT_PICTURE_SET, content, 0);
            }
        }

        if (extras == DRAW_EXTRAS_CURSOR_RING) {
            if (mTouchMode == TOUCH_SHORTPRESS_START_MODE) {
@@ -6621,7 +6647,7 @@ public class WebView extends AbsoluteLayout
                case NEW_PICTURE_MSG_ID: {
                    // called for new content
                    final WebViewCore.DrawData draw = (WebViewCore.DrawData) msg.obj;
                    nativeSetBaseLayer(draw.mBaseLayer);
                    setBaseLayer(draw.mBaseLayer, draw.mInvalRegion.getBounds());
                    final Point viewSize = draw.mViewPoint;
                    WebViewCore.ViewState viewState = draw.mViewState;
                    boolean isPictureAfterFirstLayout = viewState != null;
@@ -7603,6 +7629,7 @@ public class WebView extends AbsoluteLayout
            boolean splitIfNeeded);
    private native void     nativeDumpDisplayTree(String urlOrNull);
    private native boolean  nativeEvaluateLayersAnimations();
    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);
    private native void     nativeFindNext(boolean forward);
@@ -7664,7 +7691,7 @@ public class WebView extends AbsoluteLayout
    private native void     nativeSetFindIsEmpty();
    private native void     nativeSetFindIsUp(boolean isUp);
    private native void     nativeSetHeightCanMeasure(boolean measure);
    private native void     nativeSetBaseLayer(int layer);
    private native void     nativeSetBaseLayer(int layer, Rect invalRect);
    private native void     nativeShowCursorTimed();
    private native void     nativeReplaceBaseContent(int content);
    private native void     nativeCopyBaseContentToPicture(Picture pict);