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

Commit 3b3e8dd4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix for WebView not drawing in a layer" into rvc-dev am: 70a24c32 am: 22647c3f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12121325

Change-Id: I29f3b701c4cbfca33ffc4332c13981add6372f19
parents 8f3067eb 22647c3f
Loading
Loading
Loading
Loading
+9 −18
Original line number Original line Diff line number Diff line
@@ -48,29 +48,20 @@ static void setScissor(int viewportHeight, const SkIRect& clip) {
    glScissor(clip.fLeft, y, clip.width(), height);
    glScissor(clip.fLeft, y, clip.width(), height);
}
}


static bool GetFboDetails(SkCanvas* canvas, GLuint* outFboID, SkISize* outFboSize) {
static void GetFboDetails(SkCanvas* canvas, GLuint* outFboID, SkISize* outFboSize) {
    GrRenderTargetContext* renderTargetContext =
    GrRenderTargetContext* renderTargetContext =
            canvas->internal_private_accessTopLayerRenderTargetContext();
            canvas->internal_private_accessTopLayerRenderTargetContext();
    if (!renderTargetContext) {
    LOG_ALWAYS_FATAL_IF(!renderTargetContext, "Failed to retrieve GrRenderTargetContext");
        ALOGW("Unable to extract renderTarget info from canvas; aborting GLFunctor draw");
        return false;
    }


    GrRenderTarget* renderTarget = renderTargetContext->accessRenderTarget();
    GrRenderTarget* renderTarget = renderTargetContext->accessRenderTarget();
    if (!renderTarget) {
    LOG_ALWAYS_FATAL_IF(!renderTarget, "accessRenderTarget failed");
        ALOGW("Unable to extract renderTarget info from canvas; aborting GLFunctor draw");
        return false;
    }


    GrGLFramebufferInfo fboInfo;
    GrGLFramebufferInfo fboInfo;
    if (!renderTarget->getBackendRenderTarget().getGLFramebufferInfo(&fboInfo)) {
    LOG_ALWAYS_FATAL_IF(!renderTarget->getBackendRenderTarget().getGLFramebufferInfo(&fboInfo),
        ALOGW("Unable to extract renderTarget info from canvas; aborting GLFunctor draw");
        "getGLFrameBufferInfo failed");
        return false;
    }


    *outFboID = fboInfo.fFBOID;
    *outFboID = fboInfo.fFBOID;
    *outFboSize = SkISize::Make(renderTargetContext->width(), renderTargetContext->height());
    *outFboSize = SkISize::Make(renderTargetContext->width(), renderTargetContext->height());
    return true;
}
}


void GLFunctorDrawable::onDraw(SkCanvas* canvas) {
void GLFunctorDrawable::onDraw(SkCanvas* canvas) {
@@ -85,11 +76,12 @@ void GLFunctorDrawable::onDraw(SkCanvas* canvas) {
        return;
        return;
    }
    }


    // flush will create a GrRenderTarget if not already present.
    canvas->flush();

    GLuint fboID = 0;
    GLuint fboID = 0;
    SkISize fboSize;
    SkISize fboSize;
    if (!GetFboDetails(canvas, &fboID, &fboSize)) {
    GetFboDetails(canvas, &fboID, &fboSize);
        return;
    }


    SkIRect surfaceBounds = canvas->internal_private_getTopLayerBounds();
    SkIRect surfaceBounds = canvas->internal_private_getTopLayerBounds();
    SkIRect clipBounds = canvas->getDeviceClipBounds();
    SkIRect clipBounds = canvas->getDeviceClipBounds();
@@ -143,7 +135,6 @@ void GLFunctorDrawable::onDraw(SkCanvas* canvas) {


    // ensure that the framebuffer that the webview will render into is bound before we clear
    // ensure that the framebuffer that the webview will render into is bound before we clear
    // the stencil and/or draw the functor.
    // the stencil and/or draw the functor.
    canvas->flush();
    glViewport(0, 0, info.width, info.height);
    glViewport(0, 0, info.width, info.height);
    glBindFramebuffer(GL_FRAMEBUFFER, fboID);
    glBindFramebuffer(GL_FRAMEBUFFER, fboID);