diff options
author | Xin Li <delphij@google.com> | 2020-08-31 21:21:38 -0700 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2020-08-31 21:21:38 -0700 |
commit | 628590d7ec80e10a3fc24b1c18a1afb55cca10a8 (patch) | |
tree | 4b1c3f52d86d7fb53afbe9e9438468588fa489f8 /libs/hwui/pipeline/skia/GLFunctorDrawable.cpp | |
parent | b11b8ec3aec8bb42f2c07e1c5ac7942da293baa8 (diff) | |
parent | d2d3a20624d968199353ccf6ddbae6f3ac39c9af (diff) |
Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: I3d92a6de21a938f6b352ec26dc23420c0fe02b27
Change-Id: Ifdb80563ef042738778ebb8a7581a97c4e3d96e2
Diffstat (limited to 'libs/hwui/pipeline/skia/GLFunctorDrawable.cpp')
-rw-r--r-- | libs/hwui/pipeline/skia/GLFunctorDrawable.cpp | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp b/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp index a1b2b18195bc..8f67f97fb4bc 100644 --- a/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp +++ b/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp @@ -26,6 +26,7 @@ #include "SkAndroidFrameworkUtils.h" #include "SkClipStack.h" #include "SkRect.h" +#include "include/private/SkM44.h" namespace android { namespace uirenderer { @@ -47,29 +48,20 @@ static void setScissor(int viewportHeight, const SkIRect& clip) { 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 = canvas->internal_private_accessTopLayerRenderTargetContext(); - if (!renderTargetContext) { - ALOGW("Unable to extract renderTarget info from canvas; aborting GLFunctor draw"); - return false; - } + LOG_ALWAYS_FATAL_IF(!renderTargetContext, "Failed to retrieve GrRenderTargetContext"); GrRenderTarget* renderTarget = renderTargetContext->accessRenderTarget(); - if (!renderTarget) { - ALOGW("Unable to extract renderTarget info from canvas; aborting GLFunctor draw"); - return false; - } + LOG_ALWAYS_FATAL_IF(!renderTarget, "accessRenderTarget failed"); GrGLFramebufferInfo fboInfo; - if (!renderTarget->getBackendRenderTarget().getGLFramebufferInfo(&fboInfo)) { - ALOGW("Unable to extract renderTarget info from canvas; aborting GLFunctor draw"); - return false; - } + LOG_ALWAYS_FATAL_IF(!renderTarget->getBackendRenderTarget().getGLFramebufferInfo(&fboInfo), + "getGLFrameBufferInfo failed"); *outFboID = fboInfo.fFBOID; *outFboSize = SkISize::Make(renderTargetContext->width(), renderTargetContext->height()); - return true; } void GLFunctorDrawable::onDraw(SkCanvas* canvas) { @@ -84,15 +76,16 @@ void GLFunctorDrawable::onDraw(SkCanvas* canvas) { return; } + // flush will create a GrRenderTarget if not already present. + canvas->flush(); + GLuint fboID = 0; SkISize fboSize; - if (!GetFboDetails(canvas, &fboID, &fboSize)) { - return; - } + GetFboDetails(canvas, &fboID, &fboSize); SkIRect surfaceBounds = canvas->internal_private_getTopLayerBounds(); SkIRect clipBounds = canvas->getDeviceClipBounds(); - SkMatrix44 mat4(canvas->getTotalMatrix()); + SkM44 mat4(canvas->experimental_getLocalToDevice()); SkRegion clipRegion; canvas->temporary_internal_getRgnClip(&clipRegion); @@ -118,7 +111,7 @@ void GLFunctorDrawable::onDraw(SkCanvas* canvas) { // update the matrix and clip that we pass to the WebView to match the coordinates of // the offscreen layer - mat4.preTranslate(-clipBounds.fLeft, -clipBounds.fTop, 0); + mat4.preTranslate(-clipBounds.fLeft, -clipBounds.fTop); clipBounds.offsetTo(0, 0); clipRegion.translate(-surfaceBounds.fLeft, -surfaceBounds.fTop); @@ -126,7 +119,7 @@ void GLFunctorDrawable::onDraw(SkCanvas* canvas) { // we are drawing into a (clipped) offscreen layer so we must update the clip and matrix // from device coordinates to the layer's coordinates clipBounds.offset(-surfaceBounds.fLeft, -surfaceBounds.fTop); - mat4.preTranslate(-surfaceBounds.fLeft, -surfaceBounds.fTop, 0); + mat4.preTranslate(-surfaceBounds.fLeft, -surfaceBounds.fTop); } DrawGlInfo info; @@ -137,12 +130,11 @@ void GLFunctorDrawable::onDraw(SkCanvas* canvas) { info.isLayer = fboID != 0; info.width = fboSize.width(); info.height = fboSize.height(); - mat4.asColMajorf(&info.transform[0]); + mat4.getColMajor(&info.transform[0]); info.color_space_ptr = canvas->imageInfo().colorSpace(); // ensure that the framebuffer that the webview will render into is bound before we clear // the stencil and/or draw the functor. - canvas->flush(); glViewport(0, 0, info.width, info.height); glBindFramebuffer(GL_FRAMEBUFFER, fboID); |