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

Commit a0fccc38 authored by Kevin Lubick's avatar Kevin Lubick
Browse files

Replace direct SkSurface creation with canvas->makeSurface

This is causing Skia to need to define GPU-specific canvas
methods even when Android is being built without a GPU backend.

Change-Id: I490a6fc01851a809b90b7e98e220ff5a340fc4df
parent 0de19335
Loading
Loading
Loading
Loading
+10 −13
Original line number Diff line number Diff line
@@ -18,14 +18,13 @@
#include "SkBlendMode.h"
#include "SkCanvas.h"
#include "SkSurface.h"
#include "include/gpu/GpuTypes.h" // from Skia

#include "TransformCanvas.h"
#include "SkiaDisplayList.h"

using android::uirenderer::StretchMask;

void StretchMask::draw(GrRecordingContext* context,
void StretchMask::draw(GrRecordingContext*,
                       const StretchEffect& stretch,
                       const SkRect& bounds,
                       skiapipeline::SkiaDisplayList* displayList,
@@ -35,16 +34,14 @@ void StretchMask::draw(GrRecordingContext* context,
    if (mMaskSurface == nullptr || mMaskSurface->width() != width ||
        mMaskSurface->height() != height) {
        // Create a new surface if we don't have one or our existing size does
        // not match.
        mMaskSurface = SkSurface::MakeRenderTarget(
            context,
            skgpu::Budgeted::kYes,
            SkImageInfo::Make(
        // not match. SkCanvas::makeSurface returns a new surface that will
        // be GPU-backed if canvas was also.
        mMaskSurface = canvas->makeSurface(SkImageInfo::Make(
            width,
            height,
            SkColorType::kAlpha_8_SkColorType,
                SkAlphaType::kPremul_SkAlphaType)
        );
            SkAlphaType::kPremul_SkAlphaType
        ));
        mIsDirty = true;
    }

@@ -53,7 +50,7 @@ void StretchMask::draw(GrRecordingContext* context,
        // Make sure to apply target transformation to the mask canvas
        // to ensure the replayed drawing commands generate the same result
        auto previousMatrix = displayList->mParentMatrix;
        displayList->mParentMatrix = maskCanvas->getTotalMatrix();
        displayList->mParentMatrix = maskCanvas->getLocalToDeviceAs3x3();
        maskCanvas->save();
        maskCanvas->drawColor(0, SkBlendMode::kClear);
        TransformCanvas transformCanvas(maskCanvas, SkBlendMode::kSrcOver);