Feed all top-level GPU accessors through skgpu::BaseDevice
This pulls the GPU-specific accessors off of SkCanvas and SkDevice - moving them all to skgpu::BaseDevice and SkCanvasPriv.
This will allow us to more easily change the gpu class hierarchy (esp. changing GrSurfaceDrawContext to skgpu::v1:SurfaceDrawContext) w/o churning the public API.
Bug: skia:11837
Change-Id: I4e205255706680ac58ffe40f714884c2ee7ac799
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431036
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/BaseDevice.h b/src/gpu/BaseDevice.h
index fbd28c5..1427921 100644
--- a/src/gpu/BaseDevice.h
+++ b/src/gpu/BaseDevice.h
@@ -11,6 +11,9 @@
#include "include/core/SkImage.h"
#include "include/private/GrTypesPriv.h"
+class GrRenderTargetProxy;
+class GrSurfaceDrawContext;
+class GrSurfaceFillContext;
class GrSurfaceProxyView;
// NOTE: when not defined, SkGpuDevice extends SkBaseDevice directly and manages its clip stack
@@ -40,17 +43,20 @@
kUninit_InitContents
};
- BaseDevice(sk_sp<GrRecordingContext> rContext,
- const SkImageInfo& ii,
- const SkSurfaceProps& props)
- : INHERITED(ii, props)
- , fContext(std::move(rContext)) {
- }
+ BaseDevice(sk_sp<GrRecordingContext>, const SkImageInfo&, const SkSurfaceProps&);
virtual GrSurfaceProxyView readSurfaceView() = 0;
- GrRenderTargetProxy* targetProxy() override;
- GrRecordingContext* recordingContext() const override { return fContext.get(); }
+ BaseDevice* asGpuDevice() override { return this; }
+
+#if SK_GPU_V1
+ // TODO: make this return a skgpu::v1:SurfaceDrawContext
+ virtual GrSurfaceDrawContext* surfaceDrawContext() { return nullptr; }
+#endif
+
+ virtual GrSurfaceFillContext* surfaceFillContext() = 0;
+ GrRenderTargetProxy* targetProxy();
+ GrRecordingContext* recordingContext() const { return fContext.get(); }
virtual bool wait(int numSemaphores,
const GrBackendSemaphore* waitSemaphores,