Move discard and asyncRescaleAndReadPixels* to SkBaseGpuDevice
The goal here is to delegate these calls to the SkBaseGpuDevice-derived
classes so SkSurface_Gpu doesn't need to know about SDCs.
Bug: skia:11837
Change-Id: I28bea7ad1cf5d9fc0ce690b2bd70ff79e022f8d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414998
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/SkBaseGpuDevice.h b/src/gpu/SkBaseGpuDevice.h
index 9cb6f33..b448922 100644
--- a/src/gpu/SkBaseGpuDevice.h
+++ b/src/gpu/SkBaseGpuDevice.h
@@ -10,6 +10,8 @@
#include "src/gpu/GrSurfaceProxyView.h"
+#include "include/core/SkImage.h"
+
// NOTE: when not defined, SkGpuDevice extends SkBaseDevice directly and manages its clip stack
// using GrClipStack. When false, SkGpuDevice continues to extend SkClipStackDevice and uses
// SkClipStack and GrClipStackClip to manage the clip stack.
@@ -52,6 +54,7 @@
virtual bool wait(int numSemaphores,
const GrBackendSemaphore* waitSemaphores,
bool deleteSemaphoresAfterWait) = 0;
+ virtual void discard() = 0;
virtual bool replaceBackingProxy(SkSurface::ContentChangeMode,
sk_sp<GrRenderTargetProxy>,
@@ -61,6 +64,27 @@
const SkSurfaceProps&) = 0;
bool replaceBackingProxy(SkSurface::ContentChangeMode);
+ using RescaleGamma = SkImage::RescaleGamma;
+ using RescaleMode = SkImage::RescaleMode;
+ using ReadPixelsCallback = SkImage::ReadPixelsCallback;
+ using ReadPixelsContext = SkImage::ReadPixelsContext;
+
+ virtual void asyncRescaleAndReadPixels(const SkImageInfo& info,
+ const SkIRect& srcRect,
+ RescaleGamma rescaleGamma,
+ RescaleMode rescaleMode,
+ ReadPixelsCallback callback,
+ ReadPixelsContext context) = 0;
+
+ virtual void asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvColorSpace,
+ sk_sp<SkColorSpace> dstColorSpace,
+ const SkIRect& srcRect,
+ SkISize dstSize,
+ RescaleGamma rescaleGamma,
+ RescaleMode,
+ ReadPixelsCallback callback,
+ ReadPixelsContext context) = 0;
+
protected:
sk_sp<GrRecordingContext> fContext;