Remove SkBaseDevice::flush (take 2)

Another small step in removing SkCanvas::flush

Change-Id: I6f3bec367e582754b8463b7bfe6a2542436ca829
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335647
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Robert Phillips 2020-11-30 08:32:38 -05:00 committed by Skia Commit-Bot
parent 77b68e8599
commit ca92424e21
7 changed files with 17 additions and 19 deletions

View File

@ -37,6 +37,8 @@ Milestone 89
a MTLDevice and MTLCommandQueue is deprecated.
https://review.skia.org/334426
* SkCanvas::flush has been deprecated.
* * *
Milestone 88

View File

@ -254,6 +254,8 @@ public:
If SkCanvas is associated with GPU surface, resolves all pending GPU operations.
If SkCanvas is associated with raster surface, has no effect; raster draw
operations are never deferred.
DEPRECATED: Replace usage with GrDirectContext::flush()
*/
void flush();

View File

@ -51,6 +51,7 @@
#include <new>
#if SK_SUPPORT_GPU
#include "include/gpu/GrDirectContext.h"
#include "src/gpu/SkGr.h"
#endif
@ -624,10 +625,13 @@ void SkCanvas::flush() {
}
void SkCanvas::onFlush() {
SkBaseDevice* device = this->getDevice();
if (device) {
device->flush();
#if SK_SUPPORT_GPU
auto dContext = GrAsDirectContext(this->recordingContext());
if (dContext) {
dContext->flushAndSubmit();
}
#endif
}
SkSurface* SkCanvas::getSurface() const {

View File

@ -447,10 +447,6 @@ private:
this->setDeviceCoordinateSystem(SkMatrix::I(), globalCTM, x, y);
}
/** Causes any deferred drawing to the device to be completed.
*/
virtual void flush() {}
virtual SkImageFilterCache* getImageFilterCache() { return nullptr; }
friend class SkNoPixelsDevice;

View File

@ -1028,16 +1028,6 @@ void SkGpuDevice::drawDrawable(SkDrawable* drawable, const SkMatrix* matrix, SkC
///////////////////////////////////////////////////////////////////////////////
void SkGpuDevice::flush() {
auto direct = fContext->asDirectContext();
if (!direct) {
return;
}
direct->priv().flushSurface(fRenderTargetContext->asSurfaceProxy());
direct->submit();
}
bool SkGpuDevice::wait(int numSemaphores, const GrBackendSemaphore* waitSemaphores,
bool deleteSemaphoresAfterWait) {
ASSERT_SINGLE_OWNER

View File

@ -130,7 +130,6 @@ public:
sk_sp<SkSpecialImage> makeSpecial(const SkImage*) override;
sk_sp<SkSpecialImage> snapSpecial(const SkIRect&, bool = false) override;
void flush() override;
bool wait(int numSemaphores, const GrBackendSemaphore* waitSemaphores,
bool deleteSemaphoresAfterWait);

View File

@ -62,7 +62,12 @@ SkCanvas* GrVkSecondaryCBDrawContext::getCanvas() {
}
void GrVkSecondaryCBDrawContext::flush() {
fDevice->flush();
auto dContext = GrAsDirectContext(fDevice->recordingContext());
if (dContext) {
dContext->priv().flushSurface(fDevice->accessRenderTargetContext()->asSurfaceProxy());
dContext->submit();
}
}
bool GrVkSecondaryCBDrawContext::wait(int numSemaphores,