diff options
author | 2023-05-02 13:31:00 +0000 | |
---|---|---|
committer | 2023-05-02 16:23:29 +0000 | |
commit | a0fccc38fc2a9f36c5b4d346be81857cfac12890 (patch) | |
tree | 47fd0207a2d42be11f30eea84ba1225f827236c3 | |
parent | 0de19335aad671606d75c10111280648105c2015 (diff) |
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
-rw-r--r-- | libs/hwui/pipeline/skia/StretchMask.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/libs/hwui/pipeline/skia/StretchMask.cpp b/libs/hwui/pipeline/skia/StretchMask.cpp index cad3703d8d2b..1676787ef671 100644 --- a/libs/hwui/pipeline/skia/StretchMask.cpp +++ b/libs/hwui/pipeline/skia/StretchMask.cpp @@ -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( - width, - height, - SkColorType::kAlpha_8_SkColorType, - SkAlphaType::kPremul_SkAlphaType) - ); + // 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 + )); 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); |