diff options
author | 2023-05-12 19:27:20 +0000 | |
---|---|---|
committer | 2023-05-18 12:41:39 +0000 | |
commit | 6817fc460b45924ed28c5dda72482aa86d3bd2cc (patch) | |
tree | 506484725b1cadb187defc8c264b81c2d53827df /libs/hwui/Readback.cpp | |
parent | c86cbd743383a0a65d461fb3c059f74d839ddf53 (diff) |
[base] Migrate SkSurface creation to SkSurfaces factories
Follow-up to http://review.skia.org/687639
Change-Id: I37ed05e68fa8d8edcad55e7700aca67e371f512d
Diffstat (limited to 'libs/hwui/Readback.cpp')
-rw-r--r-- | libs/hwui/Readback.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
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 <SkSamplingOptions.h> #include <SkSurface.h> #include "include/gpu/GpuTypes.h" // from Skia +#include <include/gpu/ganesh/SkSurfaceGanesh.h> #include <gui/TraceUtils.h> #include <private/android/AHardwareBufferHelpers.h> #include <shaders/shaders.h> @@ -173,16 +174,16 @@ void Readback::copySurfaceInto(ANativeWindow* window, const std::shared_ptr<Copy SkBitmap skBitmap = request->getDestinationBitmap(srcRect.width(), srcRect.height()); SkBitmap* bitmap = &skBitmap; sk_sp<SkSurface> 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<SkSurface> tmpSurface = SkSurface::MakeRenderTarget(mRenderThread.getGrContext(), - skgpu::Budgeted::kYes, - bitmap->info(), - 0, - kTopLeft_GrSurfaceOrigin, nullptr); + sk_sp<SkSurface> 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; |