From c9a642edf2d1c7f5380fe829adbb1a692f9969a6 Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Mon, 19 Mar 2018 12:29:39 -0400 Subject: New read pixels implementation that is simpler but does all conversions on CPU. Change-Id: Ia548cd24a8544b35a233311706faf48de353b7cf Reviewed-on: https://skia-review.googlesource.com/109902 Commit-Queue: Brian Salomon Reviewed-by: Robert Phillips --- include/gpu/GrCaps.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'include/gpu') diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h index 27ad6a164d..02a51a092d 100644 --- a/include/gpu/GrCaps.h +++ b/include/gpu/GrCaps.h @@ -186,7 +186,15 @@ public: * If this returns false then the caller should implement a fallback where a temporary texture * is created, pixels are written to it, and then that is copied or drawn into the the surface. */ - virtual bool surfaceSupportsWritePixels(const GrSurface* surface) const = 0; + virtual bool surfaceSupportsWritePixels(const GrSurface*) const = 0; + + /** + * Backends may have restrictions on what types of surfaces support GrGpu::readPixels(). + * If this returns false then the caller should implement a fallback where a temporary texture + * is created, the surface is drawn or copied into the temporary, and pixels are read from the + * temporary. + */ + virtual bool surfaceSupportsReadPixels(const GrSurface*) const = 0; /** * Given a dst pixel config and a src color type what color type must the caller coax the @@ -197,6 +205,15 @@ public: return GrPixelConfigToColorType(config); } + /** + * Given a src pixel config and a dst color type what color type must the caller read to using + * GrGpu::readPixels() and then coax into dstColorType. + */ + virtual GrColorType supportedReadPixelsColorType(GrPixelConfig config, + GrColorType /*dstColorType*/) const { + return GrPixelConfigToColorType(config); + } + bool suppressPrints() const { return fSuppressPrints; } size_t bufferMapThreshold() const { -- cgit v1.2.3