From 6817fc460b45924ed28c5dda72482aa86d3bd2cc Mon Sep 17 00:00:00 2001 From: Kevin Lubick Date: Fri, 12 May 2023 19:27:20 +0000 Subject: [base] Migrate SkSurface creation to SkSurfaces factories Follow-up to http://review.skia.org/687639 Change-Id: I37ed05e68fa8d8edcad55e7700aca67e371f512d --- libs/hwui/Readback.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'libs/hwui/Readback.cpp') diff --git a/libs/hwui/Readback.cpp b/libs/hwui/Readback.cpp index 377b5bbc523e..afe4c3896ed2 100644 --- a/libs/hwui/Readback.cpp +++ b/libs/hwui/Readback.cpp @@ -30,6 +30,7 @@ #include #include #include "include/gpu/GpuTypes.h" // from Skia +#include #include #include #include @@ -173,16 +174,16 @@ void Readback::copySurfaceInto(ANativeWindow* window, const std::shared_ptrgetDestinationBitmap(srcRect.width(), srcRect.height()); SkBitmap* bitmap = &skBitmap; sk_sp tmpSurface = - SkSurface::MakeRenderTarget(mRenderThread.getGrContext(), skgpu::Budgeted::kYes, - bitmap->info(), 0, kTopLeft_GrSurfaceOrigin, nullptr); + SkSurfaces::RenderTarget(mRenderThread.getGrContext(), skgpu::Budgeted::kYes, + bitmap->info(), 0, kTopLeft_GrSurfaceOrigin, nullptr); // if we can't generate a GPU surface that matches the destination bitmap (e.g. 565) then we // attempt to do the intermediate rendering step in 8888 if (!tmpSurface.get()) { SkImageInfo tmpInfo = bitmap->info().makeColorType(SkColorType::kN32_SkColorType); - tmpSurface = SkSurface::MakeRenderTarget(mRenderThread.getGrContext(), - skgpu::Budgeted::kYes, - tmpInfo, 0, kTopLeft_GrSurfaceOrigin, nullptr); + tmpSurface = SkSurfaces::RenderTarget(mRenderThread.getGrContext(), + skgpu::Budgeted::kYes, + tmpInfo, 0, kTopLeft_GrSurfaceOrigin, nullptr); if (!tmpSurface.get()) { ALOGW("Unable to generate GPU buffer in a format compatible with the provided bitmap"); return request->onCopyFinished(CopyResult::UnknownError); @@ -348,19 +349,19 @@ bool Readback::copyLayerInto(Layer* layer, const SkRect* srcRect, const SkRect* * a scaling issue (b/62262733) that was encountered when sampling from an EGLImage into a * software buffer. */ - sk_sp tmpSurface = SkSurface::MakeRenderTarget(mRenderThread.getGrContext(), - skgpu::Budgeted::kYes, - bitmap->info(), - 0, - kTopLeft_GrSurfaceOrigin, nullptr); + sk_sp tmpSurface = SkSurfaces::RenderTarget(mRenderThread.getGrContext(), + skgpu::Budgeted::kYes, + bitmap->info(), + 0, + kTopLeft_GrSurfaceOrigin, nullptr); // if we can't generate a GPU surface that matches the destination bitmap (e.g. 565) then we // attempt to do the intermediate rendering step in 8888 if (!tmpSurface.get()) { SkImageInfo tmpInfo = bitmap->info().makeColorType(SkColorType::kN32_SkColorType); - tmpSurface = SkSurface::MakeRenderTarget(mRenderThread.getGrContext(), - skgpu::Budgeted::kYes, - tmpInfo, 0, kTopLeft_GrSurfaceOrigin, nullptr); + tmpSurface = SkSurfaces::RenderTarget(mRenderThread.getGrContext(), + skgpu::Budgeted::kYes, + tmpInfo, 0, kTopLeft_GrSurfaceOrigin, nullptr); if (!tmpSurface.get()) { ALOGW("Unable to generate GPU buffer in a format compatible with the provided bitmap"); return false; -- cgit v1.2.3-59-g8ed1b