summaryrefslogtreecommitdiff
path: root/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp
diff options
context:
space:
mode:
authorAdlai Holler <adlai@google.com>2020-09-16 10:37:19 -0400
committerAdlai Holler <adlai@google.com>2020-09-18 14:42:41 +0000
commitab762153fb6156ac014bd715100697e20aac9516 (patch)
tree69d278fa299f20581d676088950604bf51536f48 /libs/hwui/pipeline/skia/GLFunctorDrawable.cpp
parentb850bfbd7854b12c5932faba7c240e29057d919b (diff)
Migrate from SkCanvas::getGrContext to SkCanvas::recordingContext
This is part of API cleanup as we make DDL usage more mainstream in Skia. Since Android doesn't use DDLs, the cast from recordingContext to directContext will always succeed and there's no functional change. Change-Id: Ie585cf6c97d01fecf082f146d5692999371fd39d
Diffstat (limited to 'libs/hwui/pipeline/skia/GLFunctorDrawable.cpp')
-rw-r--r--libs/hwui/pipeline/skia/GLFunctorDrawable.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp b/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp
index dd0fc695c246..bfbdc5c009c0 100644
--- a/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp
+++ b/libs/hwui/pipeline/skia/GLFunctorDrawable.cpp
@@ -56,7 +56,8 @@ static void GetFboDetails(SkCanvas* canvas, GLuint* outFboID, SkISize* outFboSiz
}
void GLFunctorDrawable::onDraw(SkCanvas* canvas) {
- if (canvas->getGrContext() == nullptr) {
+ GrDirectContext* directContext = GrAsDirectContext(canvas->recordingContext());
+ if (directContext == nullptr) {
// We're dumping a picture, render a light-blue rectangle instead
// TODO: Draw the WebView text on top? Seemingly complicated as SkPaint doesn't
// seem to have a default typeface that works. We only ever use drawGlyphs, which
@@ -87,7 +88,7 @@ void GLFunctorDrawable::onDraw(SkCanvas* canvas) {
SkImageInfo surfaceInfo =
canvas->imageInfo().makeWH(clipBounds.width(), clipBounds.height());
tmpSurface =
- SkSurface::MakeRenderTarget(canvas->getGrContext(), SkBudgeted::kYes, surfaceInfo);
+ SkSurface::MakeRenderTarget(directContext, SkBudgeted::kYes, surfaceInfo);
tmpSurface->getCanvas()->clear(SK_ColorTRANSPARENT);
GrGLFramebufferInfo fboInfo;
@@ -141,7 +142,7 @@ void GLFunctorDrawable::onDraw(SkCanvas* canvas) {
// notify Skia that we just updated the FBO and stencil
const uint32_t grState = kStencil_GrGLBackendState | kRenderTarget_GrGLBackendState;
- canvas->getGrContext()->resetContext(grState);
+ directContext->resetContext(grState);
SkCanvas* tmpCanvas = canvas;
if (tmpSurface) {
@@ -188,7 +189,7 @@ void GLFunctorDrawable::onDraw(SkCanvas* canvas) {
glClear(GL_STENCIL_BUFFER_BIT);
}
- canvas->getGrContext()->resetContext();
+ directContext->resetContext();
// if there were unclipped save layers involved we draw our offscreen surface to the canvas
if (tmpSurface) {